Matthijs Kooijman
544c9b2fb0
Make the InsertBefore argument to FindInsertedValue optional, so you can find an inserted value without modifying the code.
...
llvm-svn: 52319
2008-06-16 13:28:31 +00:00
Matthijs Kooijman
238b1e8d69
Pass around Instruction* instead of Instruction& in FindInsertedValue and friends.
...
llvm-svn: 52318
2008-06-16 13:13:08 +00:00
Matthijs Kooijman
dedcf00fcc
80 column fixes.
...
llvm-svn: 52316
2008-06-16 12:57:37 +00:00
Matthijs Kooijman
1dd7d9cdc1
Move FindScalarValue from InstructionCombining.cpp to ValueTracking.cpp. While
...
I'm at it, rename it to FindInsertedValue.
The only functional change is that newly created instructions are no longer
added to instcombine's worklist, but that is not really necessary anyway (and
I'll commit some improvements next that will completely remove the need).
llvm-svn: 52315
2008-06-16 12:48:21 +00:00
Chris Lattner
0bc9e4aa8f
simplify some code by using a helper function. This really really
...
wants a 'nocapture' predicate.
llvm-svn: 52304
2008-06-16 06:38:26 +00:00
Chris Lattner
35be1f6c83
move a bunch of predicates up into their own section
...
in this file, no other changes.
llvm-svn: 52303
2008-06-16 06:30:22 +00:00
Chris Lattner
12453dd555
Other parts of this code treat noalias arguments as objects for
...
the purposes of escape analysis.
llvm-svn: 52302
2008-06-16 06:28:01 +00:00
Chris Lattner
e987a3bdd1
If we are checking to see if the result of a call aliases a
...
pointer derived from a local allocation, if the local allocation
never escapes, the pointers can't alias. This implements PR2436
llvm-svn: 52301
2008-06-16 06:19:11 +00:00
Chris Lattner
4e38446b34
Refactor basicaa's main alias function somethin' fierce.
...
This fixes several minor bugs (such as returning noalias
for comparisons between external weak functions an null) but
is mostly a cleanup.
llvm-svn: 52299
2008-06-16 06:10:11 +00:00
Wojciech Matyjewicz
58f5cc8864
Fix PR2434. When scanning for exising binary operator to reuse don't
...
take into account the instrucion pointed by InsertPt. Thanks to it,
returning the new value of InsertPt to the InsertBinop() caller can be
avoided. The bug was, actually, in visitAddRecExpr() method which wasn't
correctly handling changes of InsertPt. There shouldn't be any
performance regression, as -gvn pass (run after -indvars) removes any
redundant binops.
llvm-svn: 52291
2008-06-15 19:07:39 +00:00
Wojciech Matyjewicz
f66a7fe9de
Change 'while' loop to 'do' loop.
...
Add a safety measure. It isn't safe to assume in ScalarEvolutionExpander that
all loops are in canonical form (but it should be safe for loops that have
AddRecs).
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
llvm-svn: 52275
2008-06-14 16:48:22 +00:00
Nick Lewycky
0aa53f2b52
Crash less. The i64 restriction in BinomialCoefficient caused some problems
...
with code that was expecting different bit widths for different values.
Make getTruncateOrZeroExtend a method on ScalarEvolution, and use it.
llvm-svn: 52248
2008-06-13 04:38:55 +00:00
Chris Lattner
67a5a4eba8
Expose a public interface to this pass.
...
llvm-svn: 52029
2008-06-05 23:45:18 +00:00
Chris Lattner
ea07bf8c1b
Let libcall semantics decide whether it knows about functions
...
with definitions or not.
llvm-svn: 52028
2008-06-05 23:38:34 +00:00
Matthijs Kooijman
1fd76cd396
Update comments and documentation to reflect that GCSE and ValueNumbering are
...
deprecated by the GVN and GVNPRE passes.
llvm-svn: 51983
2008-06-05 07:55:49 +00:00
Matthijs Kooijman
a03f85df05
Replace two manual loops with calls to CallSite::hasArguments (no functional changes).
...
llvm-svn: 51947
2008-06-04 16:57:50 +00:00
Chris Lattner
5839247e92
Add #includes required by GCC 4.3, thanks for Zhongxing Xu
...
for reporting this.
llvm-svn: 51926
2008-06-04 04:46:14 +00:00
Chris Lattner
3e1cd5c9bf
Remove unneeded code I added.
...
llvm-svn: 51878
2008-06-02 18:39:07 +00:00
Wojciech Matyjewicz
06e4c8a420
Fixes PR2395. Looking for a constant in a GEP tail (when the first GEP
...
is longer than the second one) should stop after finding one. Added break
instruction guarantees it. It also changes difference between offsets to
absolute value of this difference in the condition.
llvm-svn: 51875
2008-06-02 17:26:12 +00:00
Chris Lattner
ea60f0ccc3
move CannotBeNegativeZero to ValueTracking. Simplify some signbit comparisons.
...
llvm-svn: 51864
2008-06-02 01:29:46 +00:00
Chris Lattner
4960857273
move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBits
...
out of instcombine into a new file in libanalysis. This also teaches
ComputeNumSignBits about the number of sign bits in a constantint.
llvm-svn: 51863
2008-06-02 01:18:21 +00:00
Owen Anderson
ee111c28b8
Remember to update the reverse non-local cache when cleaning up dirty entries. This fixes PR2397.
...
llvm-svn: 51846
2008-06-01 21:03:52 +00:00
Owen Anderson
67a1d5ec35
Make ping more aggressive in finding nonlocal caching errors.
...
llvm-svn: 51845
2008-06-01 20:51:41 +00:00
Dan Gohman
15eb8b47aa
Fix a typo in a comment.
...
llvm-svn: 51718
2008-05-30 00:08:18 +00:00
Dan Gohman
24ad4a21e3
Fix a copy+paste error in a comment.
...
llvm-svn: 51717
2008-05-30 00:02:02 +00:00
Owen Anderson
0eabbbfc58
Add newline at end of file.
...
llvm-svn: 51701
2008-05-29 21:05:16 +00:00
Owen Anderson
0e26c5897a
Force postdom to be linked into opt and bugpoint, even though it is no longer used by any passes.
...
llvm-svn: 51686
2008-05-29 17:00:13 +00:00
Gabor Greif
39350bab39
convert another operand loop to iterator formulation
...
llvm-svn: 51661
2008-05-29 00:51:08 +00:00
Dan Gohman
4b11213552
Use Function::getEntryBlock instead of Function::begin, for clarity.
...
llvm-svn: 51613
2008-05-27 20:55:29 +00:00
Dan Gohman
327d2c6167
Print debug output when any edge becomes executable, including
...
the first visited edge.
llvm-svn: 51612
2008-05-27 20:47:30 +00:00
Duncan Sands
4757a8dd76
Fix some constructs that gcc-4.4 warns about.
...
llvm-svn: 51591
2008-05-27 11:50:51 +00:00
Nick Lewycky
f24743a6bb
Don't treat values as signed when looking at loop steppings in HowForToNonZero.
...
llvm-svn: 51560
2008-05-25 23:43:32 +00:00
Nick Lewycky
744dad8004
"ret (constexpr)" can't be folded into a Constant. Add a method to
...
Analysis/ConstantFolding to fold ConstantExpr's, then make instcombine use it
to try to use targetdata to fold constant expressions on void instructions.
Also extend the icmp(inttoptr, inttoptr) folding to handle the case where
int size != ptr size.
llvm-svn: 51559
2008-05-25 20:56:15 +00:00
Dan Gohman
f25b89f697
Use isSingleValueType instead of isFirstClassType to
...
exclude struct and array types.
llvm-svn: 51452
2008-05-22 23:43:22 +00:00
Gabor Greif
0c41f351cc
transform more loops to iterator form, detabify
...
llvm-svn: 51436
2008-05-22 19:24:54 +00:00
Gabor Greif
0c8b237857
Rewrite operand loops to use iterators. This shrinks .o file (at gcc4.0.1 -O3 x86) substantially (>500 bytes). Reason still unknown.
...
llvm-svn: 51423
2008-05-22 06:43:33 +00:00
Chris Lattner
5a09a5fb88
Free and vaarg are not really volatile.
...
llvm-svn: 51407
2008-05-22 03:23:06 +00:00
Gabor Greif
aa0a5c230c
suppress gcc3.4.6's <no value returned> warnings
...
llvm-svn: 51372
2008-05-21 14:07:30 +00:00
Chris Lattner
821dc30131
Fix PR2346 by marking vaarg as volatile so that licm doesn't try to
...
hoist them.
llvm-svn: 51356
2008-05-20 22:05:28 +00:00
Chris Lattner
5c3ce73720
Add a bool to isEdgeFeasible that tells it whether to treat unknown
...
value as undef or untracked.
llvm-svn: 51295
2008-05-20 03:39:39 +00:00
Gabor Greif
d61f20217a
API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
...
llvm-svn: 51200
2008-05-16 19:29:10 +00:00
Dan Gohman
48ac9aec33
Use static and anonymous namespaces consistently with other passes.
...
llvm-svn: 51156
2008-05-15 19:43:55 +00:00
Owen Anderson
5e6431c140
Fix memdep's handling of invokes when finding the dependency of another call
...
instruction. This fixes some Ada miscompiles reported in PR2324.
llvm-svn: 51069
2008-05-13 21:25:37 +00:00
Dan Gohman
bab18cae46
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Chris Lattner
0eb3dfb3b0
prune #includes.
...
llvm-svn: 50962
2008-05-12 01:13:53 +00:00
Chris Lattner
f459fcde61
Add a new SparsePropagation analysis utility, which allows you to do
...
SCCP like sparse lattice analysis with relative ease. Just pick your
lattice function and implement the transfer function and you're good.
Just make sure you don't break monotonicity ;-)
llvm-svn: 50961
2008-05-12 01:12:24 +00:00
Torok Edwin
9b85a8dc92
put LibCallAliasAnalysis into anonymous namespace to avoid
...
clashes on ::X
llvm-svn: 50912
2008-05-09 20:35:45 +00:00
Chris Lattner
dfd5ee9b42
Remove dead return. Thanks to Bill for the review!
...
llvm-svn: 50863
2008-05-08 18:26:56 +00:00
Chris Lattner
9011ceba89
Add support for constant folding the 'offsetof' pattern even if the
...
base is not zero. This fixes test/C++Frontend/2008-05-07-CrazyOffsetOf.cpp
llvm-svn: 50840
2008-05-08 04:54:43 +00:00
Chris Lattner
3ee18d7c51
Add a new LibCallAliasAnalysis pass, which is parameterized
...
by an instance of LibCallInfo to provide mod/ref info of
standard library functions. This is powerful enough to
say that 'sqrt' is readonly except that it modifies errno,
or that "printf doesn't store to memory unless the %n
constraint is present" etc.
llvm-svn: 50827
2008-05-07 19:53:05 +00:00