Dan Gohman
e78d27bcf9
Update comments to new-style syntax.
...
llvm-svn: 79263
2009-08-17 18:45:31 +00:00
Nick Lewycky
afaae7957e
Don't crash on critical edge. Patch by Andre Tavares.
...
llvm-svn: 79252
2009-08-17 17:00:57 +00:00
Dan Gohman
e8847ebe10
Fix debug output to include a newline after printing a Value, now
...
that Value's operator<< doesn't include one.
llvm-svn: 79240
2009-08-17 15:25:05 +00:00
Duncan Sands
d0eda03882
Don't access the first element of a potentially empty
...
vector (&Formals[0]). With this change llvm-gcc builds
with expensive checking enabled for C, C++ and Fortran.
While there, change a std::vector into a SmallVector.
This is partly gratuitous, but mostly because not all
STL vector implementations define the data method (and
it should be faster).
llvm-svn: 79237
2009-08-17 14:33:27 +00:00
Nick Lewycky
e791519ea3
Don't crash trying to promote VLAs.
...
llvm-svn: 79226
2009-08-17 05:37:31 +00:00
Eli Friedman
ca19f19760
Fix for PR3016: detect the tricky case, where there are
...
unfoldable references to a PHI node in the block being folded, and disable
the transformation in that case. The correct transformation of such PHI
nodes depends on whether BB dominates Succ, and dominance is expensive
to compute here. (Alternatively, it's possible to check whether any
uses are live, but that's also essentially a dominance calculation.
Another alternative is to use reg2mem, but it probably isn't a good idea to
use that in simplifycfg.)
Also, remove some incorrect code from CanPropagatePredecessorsForPHIs
which is made unnecessary with this patch: it didn't consider the case
where a PHI node in BB has multiple uses.
llvm-svn: 79174
2009-08-16 04:23:49 +00:00
Benjamin Kramer
5c54156e82
Don't try to get the context from an erased Instruction.
...
llvm-svn: 79134
2009-08-15 21:07:49 +00:00
Nick Lewycky
de61ef6c5e
SSI construction should just go ahead and ignore instructions in unreachable
...
blocks.
llvm-svn: 79132
2009-08-15 20:12:18 +00:00
Dan Gohman
b3aa090ddf
Make TargetData optional in GlobalOpt and ArgumentPromotion.
...
llvm-svn: 78967
2009-08-14 00:11:03 +00:00
Owen Anderson
dc11fe967d
Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
...
llvm-svn: 78955
2009-08-13 23:27:32 +00:00
Owen Anderson
9df206d02d
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Mon P Wang
d56e4482fc
When InstCombine simplifies a load -> extract element to gep -> load, place
...
the new load by the old load instead of by the extract element because
a store could have occurred between the load and extract element.
llvm-svn: 78891
2009-08-13 05:12:13 +00:00
Andreas Bolka
a2220fbb8d
Simplify conditional.
...
llvm-svn: 78889
2009-08-13 03:05:20 +00:00
Andreas Bolka
68a2326175
Simplify and reduce indentation using early exits.
...
No intended functionality change.
llvm-svn: 78888
2009-08-13 03:00:57 +00:00
Andreas Bolka
c4476bdb2e
DEBUGify some DOUTs.
...
llvm-svn: 78887
2009-08-13 02:45:03 +00:00
Andreas Bolka
00d6ad063a
Prune trailing whitespace.
...
llvm-svn: 78886
2009-08-13 02:40:50 +00:00
Dan Gohman
00ee3a9a1a
Transform -X/C to X/-C, implementing a README.txt entry.
...
llvm-svn: 78812
2009-08-12 16:37:02 +00:00
Dan Gohman
d5b6e35080
Optimize (x/C)*C to x if the division is exact.
...
llvm-svn: 78811
2009-08-12 16:33:09 +00:00
Dan Gohman
9ea1b2644b
Update instcombine's debug output to account for Value*'s operator<<
...
not appending its own newline.
llvm-svn: 78810
2009-08-12 16:28:31 +00:00
Dan Gohman
9a6b2f19e5
Remove a bunch more now-unnecessary Context arguments.
...
llvm-svn: 78809
2009-08-12 16:23:25 +00:00
Dan Gohman
ccb751285b
Eliminate a bunch of now unnecessary explicit Context variables.
...
llvm-svn: 78808
2009-08-12 16:04:34 +00:00
Owen Anderson
dbf9a912fb
Add contexts to some of the MVT APIs. No functionality change yet, just the infrastructure work needed to get the contexts to where they need to be first.
...
llvm-svn: 78759
2009-08-12 00:36:31 +00:00
Dan Gohman
8d69df5773
Optimize exact sdiv by a constant power of 2 to ashr.
...
llvm-svn: 78714
2009-08-11 20:47:47 +00:00
Dan Gohman
e3fa540e7a
Remove unnecessary casts.
...
llvm-svn: 78664
2009-08-11 15:15:10 +00:00
Devang Patel
4609ecd4bd
Remove dead metadata.
...
llvm-svn: 78651
2009-08-11 06:31:57 +00:00
Owen Anderson
b4bce99769
Rename MVT to EVT, in preparation for splitting SimpleValueType out into its own struct type.
...
llvm-svn: 78610
2009-08-10 22:56:29 +00:00
Daniel Dunbar
87825212a4
More ProfileInfo improvements.
...
- Part of optimal static profiling patch sequence by Andreas Neustifter.
- Store edge, block, and function information separately for each functions
(instead of in one giant map).
- Return frequencies as double instead of int, and use a sentinel value for
missing information.
llvm-svn: 78477
2009-08-08 17:43:09 +00:00
Devang Patel
625352f701
Fix dom frontier update. This fixes PR4667.
...
Patch by Jakub Staszak.
llvm-svn: 78388
2009-08-07 17:16:44 +00:00
Dan Gohman
1c41d60c4a
Fix a bunch of namespace pollution.
...
llvm-svn: 78363
2009-08-07 01:32:21 +00:00
Devang Patel
ee39ff2666
Use DebugInfoFinder.
...
llvm-svn: 78333
2009-08-06 20:53:06 +00:00
Owen Anderson
3d0e1b855d
Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.
...
llvm-svn: 78258
2009-08-05 23:16:16 +00:00
Dan Gohman
bee2eedb5f
Check for !isa<Constant> instead of isa<Instruction>. This
...
matches what the comment says, and it avoids spurious BitCast
instructions for Argument values.
llvm-svn: 78121
2009-08-04 23:23:56 +00:00
Dan Gohman
39f93f6443
Add a new Constant::getIntegerValue helper function, and convert a
...
few places in InstCombine to use it, to fix problems handling pointer
types. This fixes the recent llvm-gcc bootstrap error.
llvm-svn: 78005
2009-08-03 22:07:33 +00:00
Eli Friedman
af54b9b643
Make SimplifyDemandedUseBits generate vector constants where
...
appropriate. Patch per report on llvmdev. No testcase because the
original report didn't come with a testcase, and I can't come up with a case
that actually fails.
llvm-svn: 77986
2009-08-03 19:15:42 +00:00
Owen Anderson
1dc40e205b
Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
...
metadata related, which I'm waiting on to avoid conflicting with Devang.
llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Dan Gohman
0831bdef1d
Fix GVN's debug output, now that operator<< on Value* doesn't print
...
a trailing newline.
llvm-svn: 77719
2009-07-31 20:24:18 +00:00
Bill Wendling
6920c80ab6
- Convert the rest of the DOUTs to DEBUG+errs().
...
- One formatting change.
No intended functionality change.
llvm-svn: 77717
2009-07-31 19:52:24 +00:00
Eli Friedman
7bb0485237
PR4662: Fix a crash introduced by the recent LLVMContext changes.
...
llvm-svn: 77716
2009-07-31 19:36:47 +00:00
Owen Anderson
d0e6352c97
Move getTrue() and getFalse() to 2.5-like APIs.
...
llvm-svn: 77685
2009-07-31 17:39:07 +00:00
Owen Anderson
93ccaf5c60
Move more code back to 2.5 APIs.
...
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Daniel Dunbar
81f704c26a
Twines: Don't allow implicit conversion from integers, this is too tricky.
...
llvm-svn: 77605
2009-07-30 17:37:43 +00:00
Daniel Dunbar
4d07efb3c4
Switch obvious clients to Twine instead of utostr (when they were already using
...
a Twine, e.g., for names).
- I am a little ambivalent about this; we don't want the string conversion of
utostr, but using overload '+' mixed with string and integer arguments is
sketchy. On the other hand, this particular usage is something of an idiom.
llvm-svn: 77579
2009-07-30 04:20:37 +00:00
Douglas Gregor
8c9b60cabc
Eliminate a few unused-variable warnings
...
llvm-svn: 77519
2009-07-29 22:41:10 +00:00
Owen Anderson
881d928f9b
Move types back to the 2.5 API.
...
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Daniel Dunbar
89cb72a6bc
Fix PR4645 which was fallout from the fix for PR4641.
...
- Call RAUW to delete all instructions (this is a patch from Nick Lewycky).
llvm-svn: 77512
2009-07-29 22:00:43 +00:00
Benjamin Kramer
da986c3fc9
Remove now unused Context variables.
...
llvm-svn: 77495
2009-07-29 19:14:17 +00:00
Owen Anderson
0ce2151b36
Move ConstantExpr to 2.5 API.
...
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Nick Lewycky
e0524c1795
Bulk erasing instructions without RAUWing them is unsafe. Instead, break them
...
into a new BB that has no predecessors.
llvm-svn: 77433
2009-07-29 05:17:50 +00:00
Devang Patel
cb23671431
Rename MDNode.h header. It defines MDnode and other metadata classes.
...
New name is Metadata.h.
llvm-svn: 77370
2009-07-28 21:49:47 +00:00
Owen Anderson
390e9778d4
Return ConstantVector to 2.5 API.
...
llvm-svn: 77366
2009-07-28 21:19:26 +00:00
Owen Anderson
aa8c94b051
Change ConstantArray to 2.5 API.
...
llvm-svn: 77347
2009-07-28 18:32:17 +00:00
Dan Gohman
0d0dd7b732
Teach instcombine to respect and preserve inbounds. Add inbounds
...
to a few tests where it is required for the expected transformation.
llvm-svn: 77290
2009-07-28 01:40:03 +00:00
Mike Stump
8902846c69
Fix a small little typo.
...
llvm-svn: 77289
2009-07-28 01:35:34 +00:00
Dan Gohman
11eb2ee32c
Replace dyn_castGetElementPtr with dyn_cast<GEPOperator>.
...
llvm-svn: 77286
2009-07-28 00:37:50 +00:00
Dan Gohman
361e911b89
Grab the LLVMContext and parent Module of SI ahead of the
...
point where SI can get deleted. This fixes a use of free'd memory.
This fixes Externals/Povray.
llvm-svn: 77285
2009-07-28 00:37:06 +00:00
Mike Stump
6cc3ea28df
Fix a release-asserts warning. Debug functions should be marked used,
...
if there are no other uses. If people don't need this routine
anymore, if should be deleted.
llvm-svn: 77274
2009-07-27 23:33:34 +00:00
Mike Stump
be4029ff76
Avoid build warnings.
...
llvm-svn: 77271
2009-07-27 23:14:11 +00:00
Owen Anderson
d729f993b8
Move ConstantStruct back to 2.5 API.
...
llvm-svn: 77266
2009-07-27 22:29:26 +00:00
Owen Anderson
256c2c250e
Move ConstantFP construction back to the 2.5-ish API.
...
llvm-svn: 77247
2009-07-27 20:59:43 +00:00
Devang Patel
dfa0528df7
Do not seed mstadata into the value map.
...
llvm-svn: 77208
2009-07-27 17:17:04 +00:00
Daniel Dunbar
4a36d5dcfd
Remove Value::getName{Start,End}, the last of the old Name APIs.
...
llvm-svn: 77152
2009-07-26 09:48:23 +00:00
Daniel Dunbar
64abfd0337
Remove Value::getNameLen
...
llvm-svn: 77148
2009-07-26 08:34:35 +00:00
Daniel Dunbar
75a66c519b
Eliminate some uses of DOUT, cerr, and getNameStart().
...
llvm-svn: 77145
2009-07-26 07:49:05 +00:00
Daniel Dunbar
038a7f0d35
Remove Value::{isName, getNameRef}.
...
Also, change MDString to use a StringRef.
llvm-svn: 77098
2009-07-25 23:55:21 +00:00
Daniel Dunbar
251177c96e
Initial update to VMCore to use Twines for string arguments.
...
- The only meat here is in Value.{h,cpp} the rest is essential 'const
std::string &' -> 'const Twine &'.
llvm-svn: 77048
2009-07-25 04:41:11 +00:00
Eric Christopher
b5f8390b6c
Fix 80-col violations.
...
llvm-svn: 77045
2009-07-25 02:45:27 +00:00
Eric Christopher
df9c86fc26
Move ExtractElementInst to ::Create instead of new. Update all uses.
...
llvm-svn: 77044
2009-07-25 02:28:41 +00:00
Dan Gohman
9a7deba67e
Convert a few more things to use raw_ostream.
...
llvm-svn: 77039
2009-07-25 01:43:01 +00:00
Dan Gohman
fdf1a11a27
Convert a few more uses of llvm/Support/Streams.h to raw_ostream.
...
llvm-svn: 77033
2009-07-25 01:13:51 +00:00
Dan Gohman
acc5d6eaae
Make AliasAnalysis and related classes use
...
getAnalysisIfAvailable<TargetData>().
llvm-svn: 77028
2009-07-25 00:48:42 +00:00
Daniel Dunbar
8496064116
More migration to raw_ostream, the water has dried up around the iostream hole.
...
- Some clients which used DOUT have moved to DEBUG. We are deprecating the
"magic" DOUT behavior which avoided calling printing functions when the
statement was disabled. In addition to being unnecessary magic, it had the
downside of leaving code in -Asserts builds, and of hiding potentially
unnecessary computations.
llvm-svn: 77019
2009-07-25 00:23:56 +00:00
Owen Anderson
cc33e89571
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
...
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Dan Gohman
b895f668cc
AliasAnalysis wants sizes in address-units, not bits.
...
llvm-svn: 77009
2009-07-24 23:01:30 +00:00
Dan Gohman
58619d5ad2
Fix this condition I accidentally inverted.
...
llvm-svn: 76988
2009-07-24 18:31:07 +00:00
Dan Gohman
f1a01b8cc0
Convert several more passes to use getAnalysisIfAvailable<TargetData>()
...
instead of getAnalysis<TargetData>().
llvm-svn: 76982
2009-07-24 18:13:53 +00:00
Daniel Dunbar
339c88008f
Move more to raw_ostream, provide support for writing MachineBasicBlock,
...
LiveInterval, etc to raw_ostream.
llvm-svn: 76965
2009-07-24 10:36:58 +00:00
Daniel Dunbar
e3fea713f1
Switch to getNameStr().
...
llvm-svn: 76962
2009-07-24 08:24:36 +00:00
Daniel Dunbar
b5adc13728
Convert StringMap to using StringRef for its APIs.
...
- Yay for '-'s and simplifications!
- I kept StringMap::GetOrCreateValue for compatibility purposes, this can
eventually go away. Likewise the StringMapEntry Create functions still follow
the old style.
- NIFC.
llvm-svn: 76888
2009-07-23 18:17:34 +00:00
Chris Lattner
2ed4453d0e
refactor a blob of code out to a new 'FoldOrOfFCmps' function and
...
simplify it.
llvm-svn: 76866
2009-07-23 05:46:22 +00:00
Chris Lattner
c687344f0c
Make some existing optimizations that would only trigger on scalars
...
also apply to vectors. This allows us to compile this:
#include <emmintrin.h>
__m128i a(__m128 a, __m128 b) { return a==a & b==b; }
__m128i b(__m128 a, __m128 b) { return a!=a | b!=b; }
to:
_a:
cmpordps %xmm1, %xmm0
ret
_b:
cmpunordps %xmm1, %xmm0
ret
with clang instead of to a ton of horrible code.
llvm-svn: 76863
2009-07-23 05:32:17 +00:00
Chris Lattner
af6fdef894
refactor a bunch of code out into a helper function,
...
no functionality change.
llvm-svn: 76859
2009-07-23 05:14:02 +00:00
Daniel Dunbar
51818313fe
Remove unnecessary store to temporary std::string.
...
llvm-svn: 76782
2009-07-22 20:46:46 +00:00
Eli Friedman
ca2e01b721
Don't give a massive inlining cost bonus to available_externally
...
functions with a single use; eliminating the single use may eliminate
the function from the current module, but usually doesn't eliminate
it from the final program.
llvm-svn: 76730
2009-07-22 08:12:59 +00:00
Owen Anderson
cc287b28c9
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Dan Gohman
b45091f0f9
Convert instcombine from using using getAnalysis<TargetData> to
...
getAnalysisIfAvailable<TargetData>.
llvm-svn: 76676
2009-07-21 23:21:54 +00:00
Owen Anderson
7f61f8dc30
Rename getConstantInt{True|False} to get{True|False} at Chris' behest.
...
llvm-svn: 76598
2009-07-21 18:03:38 +00:00
Ted Kremenek
60d0ab4838
Update CMake files.
...
llvm-svn: 76595
2009-07-21 17:43:20 +00:00
Owen Anderson
b64eef73cf
Move a bit more state over to the LLVMContext.
...
llvm-svn: 76533
2009-07-21 02:47:59 +00:00
Chris Lattner
31022c9412
use ExpandInlineAsm on TargetLowering instead of TargetAsmInfo.
...
llvm-svn: 76442
2009-07-20 17:52:52 +00:00
Dan Gohman
00b05492f1
Revert the addition of hasNoPointerOverflow to GEPOperator.
...
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.
Remove a few optimizations that depended on this flag.
llvm-svn: 76437
2009-07-20 17:43:30 +00:00
Chris Lattner
eac40b1473
implement a new magic global "llvm.compiler.used" which is like llvm.used, but
...
doesn't cause ".no_dead_strip" to be emitted on darwin.
llvm-svn: 76399
2009-07-20 06:14:25 +00:00
Bill Wendling
1a10a060cb
Add plumbing for the `linker_private' linkage type. This type is meant for
...
"private" symbols which the assember shouldn't strip, but which the linker may
remove after evaluation. This is mostly useful for Objective-C metadata.
This is plumbing, so we don't have a use of it yet. More to come, etc.
llvm-svn: 76385
2009-07-20 01:03:30 +00:00
Eli Friedman
e507c1afaa
Canonicalize bitcasts between types like <1 x i64> and i64 to
...
insertelement/extractelement.
I'm not entirely sure this is precisely what we want to do: should we
prefer bitcast(insertelement) or insertelement(bitcast)? Similarly. should we
prefer extractelement(bitcast) or bitcast(extractelement)?
llvm-svn: 76345
2009-07-18 23:06:53 +00:00
Eli Friedman
debc43cb11
Back out 76300; apparently the preference is to canonicalize the other
...
way (bitcast -> insert/extractelement).
llvm-svn: 76325
2009-07-18 19:04:16 +00:00
Chris Lattner
ffd009f039
add a fixme
...
llvm-svn: 76324
2009-07-18 18:49:04 +00:00
Eli Friedman
65a5fe312a
Add combine: X sdiv (1 << Y) -> X udiv (1 << Y) when X doesn't have the
...
sign bit set.
llvm-svn: 76304
2009-07-18 09:53:21 +00:00
Eli Friedman
cb34ee3ac3
Remove no-op check.
...
llvm-svn: 76302
2009-07-18 09:21:25 +00:00
Eli Friedman
b7b1eca368
Remove dead check.
...
llvm-svn: 76301
2009-07-18 09:12:15 +00:00
Eli Friedman
f1878fcda1
Canonicalize insert/extractelement from single-element vectors into
...
bitcasts.
It would also be possible to canonicalize the other way; does anyone
have a preference?
llvm-svn: 76300
2009-07-18 09:07:47 +00:00
Eli Friedman
7b1597133d
Fix simplifylibcalls memset recognition to work on 64-bit platforms
...
where int is 32 bits.
llvm-svn: 76293
2009-07-18 08:34:51 +00:00
Nick Lewycky
ec10fcbd04
Replace intersectWith with maximalIntersectWith. The latter guarantees that
...
all values belonging to the intersection will belong to the resulting range.
The former was inconsistent about that point (either way is fine, just pick
one.) This is part of PR4545.
llvm-svn: 76289
2009-07-18 06:34:42 +00:00
Eli Friedman
b5b88b60b3
Fix the inline cost calculation to take into account instructions
...
which cannot be folded even if they have constant operands. Significantly
helps if_spppsubr.c attached to PR4573.
llvm-svn: 76285
2009-07-18 05:26:06 +00:00
Eli Friedman
c0d63a2fec
Add line breaks to make the debug output a bit more readable.
...
llvm-svn: 76284
2009-07-18 05:12:58 +00:00
Dan Gohman
e45061eefe
Convert more code to use Operator instead of explicitly handling both
...
ConstantExpr and Instruction. This involves duplicating some code
between GetElementPtrInst and GEPOperator, but it's not a lot.
llvm-svn: 76265
2009-07-17 23:55:56 +00:00
Dan Gohman
93cbd452ed
Make BasicAliasAnalysis and Value::getUnderlyingObject use
...
GEPOperator's hasNoPointer0verflow(), and make a few places in instcombine
that create GEPs that may overflow clear the NoOverflow value. Among
other things, this partially addresses PR2831.
llvm-svn: 76252
2009-07-17 22:25:10 +00:00
Dan Gohman
bda1bacf36
Fix some typos in a comment.
...
llvm-svn: 76249
2009-07-17 22:16:21 +00:00
Dan Gohman
25a722cc45
Add a new Operator class, for handling Instructions and ConstantExprs
...
in a convenient manner, factoring out some common code from
InstructionCombining and ValueTracking. Move the contents of
BinaryOperators.h into Operator.h and use Operator to generalize them
to support ConstantExprs as well as Instructions.
llvm-svn: 76232
2009-07-17 20:47:02 +00:00
Daniel Dunbar
8ce5e03431
Initialize another Context, in the hopes of unbreaking CBE.
...
llvm-svn: 76184
2009-07-17 16:20:23 +00:00
Eli Friedman
b56b3ca224
Replace isTrapping with a new, similar method called
...
isSafeToSpeculativelyExecute. The new method is a bit closer to what
the callers actually care about in that it rejects more things callers
don't want. It also adds more precise handling for integer
division, and unifies code for analyzing the legality of a speculative
load.
llvm-svn: 76150
2009-07-17 04:28:42 +00:00
Owen Anderson
21d2d69727
Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
...
our current context-passing stuff, which is also fixed here
llvm-svn: 76089
2009-07-16 18:04:31 +00:00
Owen Anderson
4483fbda5e
Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
...
llvm-svn: 75863
2009-07-15 23:53:25 +00:00
Eli Friedman
6aa39dcd93
Switch invars away from using isTrapping when it really shouldn't be
...
using it.
llvm-svn: 75852
2009-07-15 22:48:29 +00:00
Eli Friedman
048d13f9bb
Don't restrict the set of instructions where we try to constant-fold the
...
operands; it's possible to end up with a constant-foldable operand to
most instructions, even those which can't trap.
llvm-svn: 75845
2009-07-15 22:13:34 +00:00
Dan Gohman
6cc9cb6dc4
Fix indentation.
...
llvm-svn: 75723
2009-07-15 01:26:32 +00:00
Dan Gohman
81885d5b80
Make makeLoopInvariant report whether it made any changes or not,
...
and use this to simplify more code.
llvm-svn: 75722
2009-07-15 01:25:43 +00:00
Owen Anderson
8c85061ee6
Move EVER MORE stuff over to LLVMContext.
...
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Dale Johannesen
35fc3243a8
Revert 75571; I'm convinced this isn't the right thing to do.
...
llvm-svn: 75642
2009-07-14 17:48:25 +00:00
Torok Edwin
f955a6ef49
llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
...
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").
llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Dan Gohman
084661b1b5
Require IVUsers after LCSSA, since LCSSA does not preserve IVUsers.
...
This results in the pass manager running IVUsers only once for
indvars, instead of twice.
llvm-svn: 75633
2009-07-14 14:26:23 +00:00
Eli Friedman
63028801b8
Fix trivial todo in instcombine.
...
llvm-svn: 75586
2009-07-14 02:01:53 +00:00
Dan Gohman
493855541b
Update LoopSimplify and LoopUnswitch to use the new makeLoopInvariant
...
function.
llvm-svn: 75584
2009-07-14 01:37:59 +00:00
Dan Gohman
b9f3a3c96b
Fix indvars to not assume that a loop with a single unique exit
...
block has a single unique exiting block.
llvm-svn: 75579
2009-07-14 01:09:02 +00:00
Dale Johannesen
de1ed58935
Don't delete asm's just because their inputs are undefined;
...
xor R, R is a common and valid idiom for zeroing a register, for example.
llvm-svn: 75571
2009-07-14 00:45:38 +00:00
Eli Friedman
a6c7a3d44e
PR4548: optimize zext+udiv+trunc to udiv.
...
llvm-svn: 75539
2009-07-13 22:46:01 +00:00
Eli Friedman
6b51ac6728
Canonicalize boolean +/- a constant to a select.
...
(I think it's reasonably clear that we want to have a canonical form for
constructs like this; if anyone thinks that a select is not the best
canonical form, please tell me.)
llvm-svn: 75531
2009-07-13 22:27:52 +00:00
Owen Anderson
3501454313
These don't really need contexts either.
...
llvm-svn: 75528
2009-07-13 22:18:28 +00:00
Dan Gohman
f6caa6f1e3
Make Loop and MachineLoop be subclasses of LoopBase, rather than typedefs,
...
using the Curiously Recurring Template Pattern with LoopBase.
This will help further refactoring, and future functionality for
Loop. Also, Headers can now foward-declare Loop, instead of pulling
in LoopInfo.h or doing tricks.
llvm-svn: 75519
2009-07-13 21:51:15 +00:00
Eli Friedman
b2a8c4ffc9
Misc simplifications to InstCombiner::commonIntCastTransforms. Most of
...
the changes are allowed by not calling this function for bitcasts.
The Instruction::AShr case is dead because
SimplifyDemandedInstructionBits handles that case.
llvm-svn: 75514
2009-07-13 21:45:57 +00:00
Eli Friedman
baf7e04afa
Fix comment.
...
llvm-svn: 75499
2009-07-13 20:58:59 +00:00
Owen Anderson
1e5155161a
Move more functionality over to LLVMContext.
...
llvm-svn: 75497
2009-07-13 20:58:05 +00:00
Eli Friedman
832f33550c
Don't bother to call commonIntCastTransforms for bitcasts; int->int
...
bitcasts will always be eliminated anyway.
llvm-svn: 75495
2009-07-13 20:53:00 +00:00
Owen Anderson
393d8b0a0c
Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
...
This involves temporarily hard wiring some parts to use the global context. This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.
llvm-svn: 75445
2009-07-13 04:09:18 +00:00
Eli Friedman
8c0118042a
Remove check which is duplicated in
...
InstCombiner::visitSelectInstWithICmp.
llvm-svn: 75409
2009-07-12 02:00:05 +00:00
Chris Lattner
edf6f031d8
silence a vc++ warning.
...
llvm-svn: 75393
2009-07-11 22:31:59 +00:00
Torok Edwin
ae8a3ff177
assert(0) -> LLVM_UNREACHABLE.
...
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.
llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Torok Edwin
9b41a5faf2
Convert more assert(0)+abort() -> LLVM_UNREACHABLE,
...
and abort()/exit() -> llvm_report_error().
llvm-svn: 75363
2009-07-11 13:10:19 +00:00
Nick Lewycky
fee40fdcd9
Move a method that creates constant ranges relative to another constant range
...
per icmp predicate out of predsimplify and into ConstantRange.
Add another utility method that determines whether one range is a subset of
another. Combine with the former to determine whether icmp pred range, range
is known to be true or not.
llvm-svn: 75357
2009-07-11 06:15:39 +00:00
Owen Anderson
7076f1ffb7
Push LLVMContext through the PatternMatch API.
...
llvm-svn: 75255
2009-07-10 17:35:01 +00:00
Owen Anderson
49226b1075
This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
...
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Owen Anderson
98aa906e73
A little bit more LLVMContextification.
...
llvm-svn: 75159
2009-07-09 18:36:20 +00:00
Nick Lewycky
c707d9c60d
There's no need to consider PHI nodes in the same block as the instruction
...
we're inserting sigma/phi functions for. Patch by Andre Tavares.
llvm-svn: 75138
2009-07-09 15:59:27 +00:00
Nick Lewycky
02ee56adb2
Add some statistics to SSI so we can see what it's up to.
...
Add an -ssi-everything pass which calls createSSI on everything in the function.
llvm-svn: 75135
2009-07-09 15:33:14 +00:00
Owen Anderson
9331034838
Push LLVMContext _back_ through IRBuilder.
...
llvm-svn: 75040
2009-07-08 20:50:47 +00:00
Dan Gohman
d9b9ed628f
Tell ScalarEvolution to forget a loop before starting to delete it.
...
This way ScalarEvolution can examine the loop to determine what state
it needs to update, if it chooses.
llvm-svn: 75029
2009-07-08 19:14:29 +00:00
Owen Anderson
332aae685b
Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
...
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Nick Lewycky
d46a7b2d22
Remove the vicmp and vfcmp instructions. Because we never had a release with
...
these instructions, no autoupgrade or backwards compatibility support is
provided.
llvm-svn: 74991
2009-07-08 03:04:38 +00:00
Owen Anderson
7a1f69e433
Push LLVMContext through GlobalVariables and IRBuilder.
...
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Dan Gohman
dd7f97c496
Change all SCEV* to SCEV *.
...
llvm-svn: 74918
2009-07-07 17:06:11 +00:00
Owen Anderson
121f736d9c
"LLVMContext* " --> "LLVMContext *"
...
llvm-svn: 74878
2009-07-06 23:00:19 +00:00
Owen Anderson
5f268720e9
Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's through the ValueTracking API.
...
llvm-svn: 74873
2009-07-06 22:37:39 +00:00
Owen Anderson
ad3229d281
Thread LLVMContext through the constant folding APIs, which touches a lot of files.
...
llvm-svn: 74844
2009-07-06 18:42:36 +00:00
Owen Anderson
4eb0f1a3bd
More LLVMContext-ification.
...
llvm-svn: 74811
2009-07-06 01:34:54 +00:00
Owen Anderson
977aa11bc6
More LLVMContext-ification.
...
llvm-svn: 74807
2009-07-05 22:41:43 +00:00
Mike Stump
78ecb66f56
Fix build.
...
llvm-svn: 74782
2009-07-03 22:11:58 +00:00
Owen Anderson
a8ce571a68
Even more passes being LLVMContext'd.
...
llvm-svn: 74781
2009-07-03 19:42:02 +00:00
Nick Lewycky
b01a2dc7ba
Add Static Single Information construction pass written by André Tavares!
...
Use it by requiring it through the pass manager, then calling its createSSI
method on the variables that you want in SSI form.
llvm-svn: 74780
2009-07-03 19:28:36 +00:00
Duncan Sands
1708a93077
Add newline at end of file.
...
llvm-svn: 74773
2009-07-03 15:30:58 +00:00
Owen Anderson
6795819c9e
Second batch of passes using LLVMContext.
...
llvm-svn: 74753
2009-07-03 00:54:20 +00:00
Owen Anderson
7fb95ff5dd
Convert the first batch of passes to use LLVMContext.
...
llvm-svn: 74748
2009-07-03 00:17:18 +00:00
Chris Lattner
3d8ec50f8a
fix inverted logic pointed out by John McCall, noticed by inspection.
...
This was considering vector intrinsics to have cost 2, but non-vector
intrinsics to have cost 1, which is backward.
llvm-svn: 74698
2009-07-02 15:39:39 +00:00
Dan Gohman
e89dc58a7e
Fix a bunch of other places that used operator[] to test whether
...
a key is present in a std::map or DenseMap to use find instead.
llvm-svn: 74676
2009-07-02 00:17:47 +00:00
Dan Gohman
499f79ba60
Request LCSSA after LoopSimplify. This fixes a problem in which the
...
PassManager was scheduling LCSSA before LoopSimplify, which does not
preserve LCSSA.
llvm-svn: 74661
2009-07-01 23:21:38 +00:00
Dan Gohman
e3b1f9e14b
Fix an instcombine abort on a scalar-to-vector bitcast. This fixes PR4487.
...
llvm-svn: 74646
2009-07-01 21:38:46 +00:00
Owen Anderson
81b8dabb53
Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
...
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.
Patches for Clang and LLVM-GCC to follow.
llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Chris Lattner
4bdaace06e
improve the APIs for creating struct and function types with no arguments/elements
...
to not have to create a temporary vector (in the API at least). Patch by Jay Foad!
llvm-svn: 74584
2009-07-01 04:13:31 +00:00
Dan Gohman
49c397bf4b
Minor code simplification.
...
llvm-svn: 74491
2009-06-30 01:24:43 +00:00
Dan Gohman
28702fab4e
Don't try to split a loop when the controlling icmp instruction
...
doesn't have an IV-based operand. This fixes PR4471.
llvm-svn: 74399
2009-06-27 22:58:27 +00:00
Dan Gohman
fcd5eedead
Remove the block from the LoopInfo, rather than just the Loop.
...
LoopInfo will handle removing it from the Loop, as well as updating
its own tables.
llvm-svn: 74398
2009-06-27 22:32:36 +00:00
Dan Gohman
8d2a45fadb
Teach LoopSimplify how to merge multiple loop exits into a single exit,
...
when one of them can be converted to a trivial icmp and conditional
branch.
This addresses what is essentially a phase ordering problem.
SimplifyCFG knows how to do this transformation, but it doesn't do so
if the primary block has any instructions in it other than an icmp and
a branch. In the given testcase, the block contains other instructions,
however they are loop-invariant and can be hoisted. SimplifyCFG doesn't
have LoopInfo though, so it can't hoist them. And, it's important that
the blocks be merged before LoopRotation, as it doesn't support
multiple-exit loops.
llvm-svn: 74396
2009-06-27 21:30:38 +00:00
Dan Gohman
a753bd44ff
More minor code simplifications.
...
llvm-svn: 74395
2009-06-27 21:23:40 +00:00
Dan Gohman
4acfd5098d
When a value is used multiple times within a single PHI, instructions
...
inserted to replace that value must dominate all of of the basic
blocks associated with the uses of the value in the PHI, not just
one of them.
llvm-svn: 74376
2009-06-27 05:16:57 +00:00
Dan Gohman
4f74e815f1
Incorporate the insertion point into the key of SCEVExpander's CSE map.
...
This helps it avoid reusing an instruction that doesn't dominate all
of the users, in cases where the original instruction was inserted
before all of the users were known. This may result in redundant
expansions of sub-expressions that depend on loop-unpredictable values
in some cases, however this isn't very common, and it primarily impacts
IndVarSimplify, so GVN can be expected to clean these up.
This eliminates the need for IndVarSimplify's FixUsesBeforeDefs,
which fixes several bugs.
llvm-svn: 74352
2009-06-26 22:53:46 +00:00
Devang Patel
4f5d296df0
Remove unused routines.
...
llvm-svn: 74351
2009-06-26 22:53:22 +00:00
Owen Anderson
2bcd131128
Constify this value.
...
llvm-svn: 74330
2009-06-26 21:39:56 +00:00
Douglas Gregor
6d9b0e8c19
Fix linking of llvm-ld and lli with CMake, from Xerxes Rånby
...
llvm-svn: 74285
2009-06-26 15:37:00 +00:00
Devang Patel
84a8914a4a
Remove debug info anchors - llvm.dbg.compile_units, llvm.dbg.subprograms
...
and llvm.dbg.global_variables.
llvm-svn: 74251
2009-06-26 01:49:18 +00:00
Dan Gohman
71b1c43d91
Change this code to a form about which VC++ reportedly isn't unhappy.
...
llvm-svn: 74243
2009-06-26 00:35:12 +00:00
Dan Gohman
ba8760719f
Fix LCSSA to avoid emitting a PHI node for the unwind destination of
...
an invoke instruction, since the value isn't really live across that
edge.
llvm-svn: 74242
2009-06-26 00:31:13 +00:00
Dan Gohman
3983d5070b
Minor code simplification.
...
llvm-svn: 74240
2009-06-26 00:26:03 +00:00
Dan Gohman
68902a1ad2
Reword a few comments.
...
llvm-svn: 74146
2009-06-25 00:22:44 +00:00
Dan Gohman
c2c1e1ff38
When inserting code into a loop preheader, insert it before the
...
terminator, instead of after the last phi. This fixes a bug
exposed by ScalarEvolution analyzing more kinds of loops.
This fixes PR4436.
llvm-svn: 74072
2009-06-24 14:31:06 +00:00
Dan Gohman
4f4bda36df
Extend ScalarEvolution's multiple-exit support to compute exact
...
trip counts in more cases.
Generalize ScalarEvolution's isLoopGuardedByCond code to recognize
And and Or conditions, splitting the code out into an
isNecessaryCond helper function so that it can evaluate Ands and Ors
recursively, and make SCEVExpander be much more aggressive about
hoisting instructions out of loops.
test/CodeGen/X86/pr3495.ll has an additional instruction now, but
it appears to be due to an arbitrary register allocation difference.
llvm-svn: 74048
2009-06-24 01:18:18 +00:00
Dan Gohman
1eb6954545
Don't emit a redundant BitCastInst if the value to be defined in the
...
preheader is already an instruction.
llvm-svn: 74031
2009-06-24 00:28:59 +00:00
Dan Gohman
b4f58ad636
Fix a few minor issues that were exposed by the removal of SCEVHandle.
...
llvm-svn: 73910
2009-06-22 22:08:45 +00:00
Owen Anderson
c023151c9f
SCEVHandle is no more!
...
llvm-svn: 73906
2009-06-22 21:39:50 +00:00
Dan Gohman
8426522d55
Fix this code to correctly handle loops with multiple exits. Until
...
now, this hasn't mattered, because ScalarEvolution hasn't been able
to compute trip counts for loops with multiple exits. But it will
soon.
llvm-svn: 73864
2009-06-22 00:15:15 +00:00
Dan Gohman
1a33c92bb2
Rename a variable for consistency with the ExitBlock vs ExitingBlock
...
terminology that LoopInfo uses.
llvm-svn: 73863
2009-06-21 23:48:38 +00:00
Dan Gohman
a81541945b
Fix a typo in a comment that Frits von Bommel noticed.
...
llvm-svn: 73796
2009-06-19 23:41:37 +00:00
Dan Gohman
651faa1905
Re-apply r73718, now that the fix in r73787 is in, and add a
...
hand-crafted testcase which demonstrates the bug that was exposed
in 254.gap.
llvm-svn: 73793
2009-06-19 23:23:27 +00:00
Dan Gohman
9bd151655f
Fix LSR's OptimizeSMax to ignore max operators with more than 2 operands,
...
which it isn't prepared to handle.
llvm-svn: 73787
2009-06-19 23:03:46 +00:00
Evan Cheng
b90241ac42
Revert 73718. It's breaking 254.gap.
...
llvm-svn: 73783
2009-06-19 21:15:06 +00:00
Chris Lattner
8f6f044afd
make jump threading handle lexically identical compare instructions
...
as if they were multiple uses of the same instruction. This interacts
well with the existing loadpre that j-t does to open up many new jump
threads earlier.
llvm-svn: 73768
2009-06-19 16:27:56 +00:00
Nick Lewycky
a5f89b09c6
Teach jump threading to look at comparisons between phi nodes and non-constants.
...
llvm-svn: 73755
2009-06-19 04:56:29 +00:00
Chris Lattner
8ddc06469c
Improve tail call elim to move loads above readonly calls
...
when it allows forming a tail call. Patch by Frits van
Bommel. This implements PR4323.
llvm-svn: 73752
2009-06-19 04:22:16 +00:00
Chris Lattner
3a683c551f
part of PR4405: disable a contentious optimization for
...
strcmp -> memcmp when the lengths of the strings are unknown.
Patch by Nick Lewycky!
llvm-svn: 73751
2009-06-19 04:17:36 +00:00
Dan Gohman
da82dc2ec1
Generalize LSR's OptimizeSMax to handle unsigned max tests as well
...
as signed max tests. Along with r73717, this helps CodeGen avoid
emitting code for a maximum operation for this class of loop.
llvm-svn: 73718
2009-06-18 20:23:18 +00:00
Anton Korobeynikov
fed9dcc88c
Revert IRBuilder CC propagation. Fix SimplifyLibCalls instead.
...
llvm-svn: 73715
2009-06-18 20:05:31 +00:00
Dan Gohman
fd857b0406
Remove the code from IVUsers that attempted to handle
...
casted induction variables in cases where the cast
isn't foldable. It ended up being a pessimization in
many cases. This could be fixed, but it would require
a bunch of complicated code in IVUsers' clients. The
advantages of this approach aren't visible enough to
justify it at this time.
llvm-svn: 73706
2009-06-18 16:54:06 +00:00
Dan Gohman
dc884a7830
Generalize the zext(trunc(t) & C) instcombine to work even with
...
C is not a low-bits mask, and add a similar instcombine for
zext((trunc(t) & C) ^ C).
llvm-svn: 73705
2009-06-18 16:30:21 +00:00
Dan Gohman
1530824138
Instcombine zext(trunc(x) & mask) to x&mask, even if the trunc has
...
multiple users.
llvm-svn: 73656
2009-06-17 23:17:05 +00:00