Matthijs Kooijman
fa4d0b883a
Make BuildSubAggregate use FindInsertedElement again to prevent it from
...
inserting extractvalues. In particular, this prevents the insertion of
extractvalues that can't be folded away later. Also add an example of when this
stuff is needed.
llvm-svn: 52328
2008-06-16 14:13:46 +00:00
Matthijs Kooijman
69801d4fd1
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
86cda9e050
Pass around Instruction* instead of Instruction& in FindInsertedValue and friends.
...
llvm-svn: 52318
2008-06-16 13:13:08 +00:00
Matthijs Kooijman
5cb387735d
80 column fixes.
...
llvm-svn: 52316
2008-06-16 12:57:37 +00:00
Matthijs Kooijman
e92e18be5a
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
fb46605e47
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
2d33297d00
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
fa48258a61
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
b35d9b5e07
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
98ad816f58
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
ae9753b29d
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
8bf66ee13b
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
ed169d531d
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
3816aa7ef7
Expose a public interface to this pass.
...
llvm-svn: 52029
2008-06-05 23:45:18 +00:00
Chris Lattner
0282d0247e
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
5afc2740b7
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
2353f35989
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
6449690da4
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
2e01a69e72
Remove unneeded code I added.
...
llvm-svn: 51878
2008-06-02 18:39:07 +00:00
Wojciech Matyjewicz
416867a81b
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
a12a6de683
move CannotBeNegativeZero to ValueTracking. Simplify some signbit comparisons.
...
llvm-svn: 51864
2008-06-02 01:29:46 +00:00
Chris Lattner
965c769b3c
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
54ea37b9e9
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
b77103b7e4
Make ping more aggressive in finding nonlocal caching errors.
...
llvm-svn: 51845
2008-06-01 20:51:41 +00:00
Dan Gohman
be8f77859b
Fix a typo in a comment.
...
llvm-svn: 51718
2008-05-30 00:08:18 +00:00
Dan Gohman
7a68b6694b
Fix a copy+paste error in a comment.
...
llvm-svn: 51717
2008-05-30 00:02:02 +00:00
Owen Anderson
dd378c9ae0
Add newline at end of file.
...
llvm-svn: 51701
2008-05-29 21:05:16 +00:00
Owen Anderson
b1ba352efa
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
f712664ec3
convert another operand loop to iterator formulation
...
llvm-svn: 51661
2008-05-29 00:51:08 +00:00
Dan Gohman
a61379eeea
Use Function::getEntryBlock instead of Function::begin, for clarity.
...
llvm-svn: 51613
2008-05-27 20:55:29 +00:00
Dan Gohman
3ec5520286
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
698348dfac
Fix some constructs that gcc-4.4 warns about.
...
llvm-svn: 51591
2008-05-27 11:50:51 +00:00
Nick Lewycky
3195b393d6
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
f6ccd2580c
"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
8830714bff
Use isSingleValueType instead of isFirstClassType to
...
exclude struct and array types.
llvm-svn: 51452
2008-05-22 23:43:22 +00:00
Gabor Greif
ff77c8b608
transform more loops to iterator form, detabify
...
llvm-svn: 51436
2008-05-22 19:24:54 +00:00
Gabor Greif
b90b3728a7
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
b0ccc8c8bb
Free and vaarg are not really volatile.
...
llvm-svn: 51407
2008-05-22 03:23:06 +00:00
Gabor Greif
6e38b0ef41
suppress gcc3.4.6's <no value returned> warnings
...
llvm-svn: 51372
2008-05-21 14:07:30 +00:00
Chris Lattner
b76ad168dc
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
f479856957
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
e1f6e4b21d
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
f52c8044ea
Use static and anonymous namespaces consistently with other passes.
...
llvm-svn: 51156
2008-05-15 19:43:55 +00:00
Owen Anderson
3ab976a21f
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
d78c400b5b
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
9fdb814a56
prune #includes.
...
llvm-svn: 50962
2008-05-12 01:13:53 +00:00
Chris Lattner
5287765d1a
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
42d46f2aa3
put LibCallAliasAnalysis into anonymous namespace to avoid
...
clashes on ::X
llvm-svn: 50912
2008-05-09 20:35:45 +00:00
Chris Lattner
d12c519b74
Remove dead return. Thanks to Bill for the review!
...
llvm-svn: 50863
2008-05-08 18:26:56 +00:00
Chris Lattner
f4b42f545b
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
621d33bbc0
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
Chris Lattner
9a35f1b702
Add a new interface for describing the behavior of library calls. This
...
Currently is sufficient to describe mod/ref behavior but will hopefully
eventually be extended for other purposes.
This isn't used by anything yet.
llvm-svn: 50820
2008-05-07 18:21:13 +00:00
Nick Lewycky
f0bdd22ffd
Fix typo and indentation.
...
llvm-svn: 50706
2008-05-06 04:03:18 +00:00
Dan Gohman
6a2da37c0e
Make several variable declarations static.
...
llvm-svn: 50696
2008-05-06 01:53:16 +00:00
Dan Gohman
a8b7e78f54
Remove uses of llvm/System/IncludeFile.h that are no longer needed.
...
llvm-svn: 50695
2008-05-06 01:32:53 +00:00
Torok Edwin
2a45575c71
Implement destructor for PostDominatorTree to eliminate a memory leak.
...
llvm-svn: 50607
2008-05-03 20:25:26 +00:00
Devang Patel
ab8cacee2d
Add assert.
...
llvm-svn: 50596
2008-05-02 22:13:33 +00:00
Dan Gohman
79fff7cf85
Fix the way AliasSet::print prints "may alias".
...
llvm-svn: 50051
2008-04-21 19:48:48 +00:00
Duncan Sands
5429033c03
Fix a "large integer implicitly truncated to unsigned type"
...
warning.
llvm-svn: 50033
2008-04-21 07:35:28 +00:00
Dale Johannesen
6145727b43
(re)fix handling of UGT. Pointed out by Nick Lewycky.
...
llvm-svn: 49991
2008-04-20 16:58:57 +00:00
Chris Lattner
3b18762f40
Switch to using Simplified ConstantFP::get API.
...
llvm-svn: 49977
2008-04-20 00:41:09 +00:00
Dale Johannesen
ce9dc86994
Fix a scalar evolution bug. Reversing everything
...
does not work because of 0; 2>0 but -2U is also >0.
llvm-svn: 49928
2008-04-18 21:38:31 +00:00
Owen Anderson
f9ae76d89c
Make GVN able to remove unnecessary calls to read-only functions again.
...
llvm-svn: 49842
2008-04-17 05:36:50 +00:00
Owen Anderson
57236b58f7
Major repairs to the post-dominators implementation. Patch from Florian Brandner!
...
llvm-svn: 49768
2008-04-16 04:21:16 +00:00
Dale Johannesen
8fc8a272e0
Don't assume a tail call can't reference a byval
...
argument to the outer function, this isn't correct.
llvm-svn: 49731
2008-04-15 17:41:34 +00:00
Dan Gohman
2cd8e38ab9
Teach AliasSetTracker about VAArgInst.
...
llvm-svn: 49674
2008-04-14 18:34:50 +00:00
Dan Gohman
5e6ce7bb33
In the special case, call the comparison function instead of
...
manually performing the comparison. This allows the special
case to work correctly even in the case where someone is
experimenting with a different comparison function :-).
llvm-svn: 49670
2008-04-14 18:23:56 +00:00
Chris Lattner
cc9709cff4
add a new CallGraphNode::removeCallEdgeFor method, tidy some comments.
...
llvm-svn: 49617
2008-04-13 19:41:25 +00:00
Dan Gohman
9b5ffc8408
Fix a typo in a comment.
...
llvm-svn: 49504
2008-04-10 23:02:38 +00:00
Owen Anderson
53336d8055
Fix for PR2190. Memdep's non-local caching was checking dirtied blocks in the
...
wrong order.
llvm-svn: 49499
2008-04-10 22:13:32 +00:00
Daniel Berlin
b646062ad5
Fix PR 2169.
...
llvm-svn: 49339
2008-04-07 14:20:50 +00:00
Gabor Greif
e9ecc68d8f
API changes for class Use size reduction, wave 1.
...
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.
llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Dan Gohman
3717cdaf22
Set blockBegin to point to the beginning of the block,
...
not the end.
llvm-svn: 48999
2008-03-31 22:08:00 +00:00
Erick Tryzelaar
4a0da98825
Expose Function::viewCFG and Function::viewCFGOnly to bindings.
...
llvm-svn: 48982
2008-03-31 16:22:09 +00:00
Chris Lattner
519a51a76f
minor code cleanups, allow constant folding sinf/cosf.
...
llvm-svn: 48961
2008-03-30 18:02:00 +00:00
Dan Gohman
9988569af8
Don't include <map> in Pass.h, which doesn't need it. This requires
...
adding <map> to many files that actually do need it.
llvm-svn: 48667
2008-03-21 23:51:57 +00:00
Devang Patel
4d638f1a42
These passes preserve CFG.
...
This patch fixes Benchmarks/Trimaran/enc-pc1/enc-pc1 failure reported by Grawp-PIC i386 nightly tester
llvm-svn: 48623
2008-03-20 23:27:18 +00:00
Andrew Lenharth
1a3ebe36f7
enable -analyze for andersens
...
llvm-svn: 48601
2008-03-20 15:36:44 +00:00
Devang Patel
80e43fa744
Restore isCFGOnly property of various analysis passes.
...
llvm-svn: 48579
2008-03-20 02:25:21 +00:00
Devang Patel
718da668ab
PassInfo keep tracks whether a pass is an analysis pass or not.
...
llvm-svn: 48554
2008-03-19 21:56:59 +00:00
Devang Patel
af75ab8130
Do not use virtual function to identify an analysis pass.
...
llvm-svn: 48520
2008-03-19 00:48:41 +00:00
Daniel Berlin
5fef9aea12
Fix PR 2160 by making sure arguments to external functions get marked as pointing to anything
...
llvm-svn: 48509
2008-03-18 22:22:53 +00:00
Scott Michel
08ef1b2bdb
Dial down gcc's warnings: don't use 0UL when 0U suffices (and when the
...
variables and methods themselves only use unsigned.)
llvm-svn: 48492
2008-03-18 16:55:06 +00:00
Devang Patel
864970e9b6
Identify Analysis pass.
...
Do not run analysis pass again if analysis info is still available.
This fixes PR1441.
llvm-svn: 48476
2008-03-18 00:39:19 +00:00
Daniel Berlin
c3d98074a9
Add Hybrid Cycle Detection to Andersen's analysis.
...
Patch by Curtis Dunham.
llvm-svn: 47959
2008-03-05 19:31:47 +00:00
Gabor Greif
f77e6977a0
Fix http://llvm.org/bugs/show_bug.cgi?id=2104 by ordering lexicographically what gets printed. Be const-correct in PrintResults and uninline it too
...
llvm-svn: 47712
2008-02-28 08:38:45 +00:00
Bill Wendling
7bb51dfbb1
De-tabify.
...
llvm-svn: 47598
2008-02-26 10:51:52 +00:00
Evan Cheng
01d6257e81
Temporarily reverting 46959.
...
llvm-svn: 47542
2008-02-25 03:57:32 +00:00
Dan Gohman
d723b13f14
Change a C-style cast to const_cast, to avoid a -Wcast-qual warning.
...
llvm-svn: 47437
2008-02-21 17:33:24 +00:00
Nick Lewycky
5a3db1406a
Simplify this code, no functionality change.
...
llvm-svn: 47434
2008-02-21 09:14:53 +00:00
Nick Lewycky
839adb877a
GlobalValues are Constants, remove redundant code. Also fix typo in a comment.
...
llvm-svn: 47433
2008-02-21 08:34:02 +00:00
Anton Korobeynikov
579f07135a
Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
...
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Nick Lewycky
b0a2f9513f
Use getConstant for ConstantInts.
...
llvm-svn: 47361
2008-02-20 06:58:55 +00:00
Nick Lewycky
1c44ebcf86
Add 'umax' similar to 'smax' SCEV. Closes PR2003.
...
Parse reversed smax and umax as smin and umin and express them with negative
or binary-not SCEVs (which are really just subtract under the hood).
Parse 'xor %x, -1' as (-1 - %x).
Remove dead code (ConstantInt::get always returns a ConstantInt).
Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets
passed into a uint64_t. Instead, create the -1 directly from
ConstantInt::getAllOnesValue().
llvm-svn: 47360
2008-02-20 06:48:22 +00:00
Duncan Sands
eec73618af
Fix a compiler warning.
...
llvm-svn: 47328
2008-02-19 09:28:48 +00:00
Owen Anderson
d2d7c6b309
In addition to arguments passed to it, memcpy (and all other calls) can ModRef pointers that alias their arguments as well. This fixes PR2057.
...
llvm-svn: 47317
2008-02-19 06:47:18 +00:00
Chris Lattner
8ed77c41d8
don't bother calling getUnderlyingObject for non-pointers.
...
llvm-svn: 47272
2008-02-18 17:28:21 +00:00
Owen Anderson
cc01ebbac6
Since we're not checking for the more general AllocationInst first, we need to explicitly check
...
that Object is an Argument before casting it to one.
llvm-svn: 47268
2008-02-18 10:11:00 +00:00
Owen Anderson
bdf7ed9495
This check is not correct for mallocs, so exclude them earlier.
...
llvm-svn: 47263
2008-02-18 09:11:02 +00:00
Owen Anderson
57a98b7f4b
Fix a comment, and a bug where we weren't applying the tail call logic in cases that failed the first test.
...
llvm-svn: 47253
2008-02-18 03:52:21 +00:00
Owen Anderson
fa2ba5352f
Fix bugs that Chris noticed in my last patch.
...
llvm-svn: 47252
2008-02-18 02:31:23 +00:00
Chris Lattner
8432cc662f
bitcasts of pointers are always pointers.
...
If we see a memcpy of a pointer, make sure to check later
uses of the pointer as well.
llvm-svn: 47250
2008-02-18 02:11:28 +00:00
Owen Anderson
2e3edf193a
Teach getModRefInfo that memcpy, memmove, and memset don't "capture" memory addresses.
...
Also, noalias arguments are be considered "like" stack allocated ones for this purpose, because
the only way they can be modref'ed is if they escape somewhere in the current function.
llvm-svn: 47247
2008-02-17 21:29:08 +00:00
Wojciech Matyjewicz
0e411f653c
Fix typo. Thanks to Duncan for noticing.
...
llvm-svn: 47062
2008-02-13 12:21:32 +00:00
Wojciech Matyjewicz
35545fd84d
Add comments as per review feedback.
...
llvm-svn: 47061
2008-02-13 11:51:34 +00:00
Owen Anderson
00dba4f734
Re-apply the patch to improve the optimizations of memcpy's, with several
...
bugs fixed. This now passes PPC bootstrap.
llvm-svn: 47026
2008-02-12 21:15:18 +00:00
Wojciech Matyjewicz
1d2c27b23e
Fix PR2002. Suppose n is the initial value for the induction
...
variable (with step 1) and m is its final value. Then, the correct trip
count is SMAX(m,n)-n. Previously, we used SMAX(0,m-n), but m-n may
overflow and can't in general be interpreted as signed.
Patch by Nick Lewycky.
llvm-svn: 47007
2008-02-12 15:09:36 +00:00
Wojciech Matyjewicz
adae053b53
If the LHS of the comparison is a loop-invariant we also want to move it
...
to the RHS. This simple change allows to compute loop iteration count
for loops with condition similar to the one in the testcase (which seems
to be quite common).
llvm-svn: 46959
2008-02-11 18:37:34 +00:00
Wojciech Matyjewicz
d2d9764cc8
Fix PR1798 - an error in the evaluation of SCEVAddRecExpr at an
...
arbitrary iteration.
The patch:
1) changes SCEVSDivExpr into SCEVUDivExpr,
2) replaces PartialFact() function with BinomialCoefficient(); the
computations (essentially, the division) in BinomialCoefficient() are
performed with the apprioprate bitwidth necessary to avoid overflow;
unsigned division is used instead of the signed one.
Computations in BinomialCoefficient() require support from the code
generator for APInts. Currently, we use a hack rounding up the
neccessary bitwidth to the nearest power of 2. The hack is easy to turn
off in future.
One remaining issue: we assume the divisor of the binomial coefficient
formula can be computed accurately using 16 bits. It means we can handle
AddRecs of length up to 9. In future, we should use APInts to evaluate
the divisor.
Thanks to Nicholas for cooperation!
llvm-svn: 46955
2008-02-11 11:03:14 +00:00
Wojciech Matyjewicz
784d071e16
We should check that existing cast operation has the appropriate opcode before we reuse it.
...
llvm-svn: 46908
2008-02-09 18:30:13 +00:00
Tanya Lattner
182a9fd39f
Throttle the non-local dependence analysis for basic blocks with more than 50 predecessors. Added command line option to play with this threshold.
...
llvm-svn: 46790
2008-02-06 00:54:55 +00:00
Owen Anderson
1de5997119
Fix an obscure read-after-free bug that Duncan found.
...
llvm-svn: 46738
2008-02-05 04:34:03 +00:00
Dan Gohman
a65951fef0
Avoid unnecessarily casting away const, fixing a FIXME.
...
llvm-svn: 46591
2008-01-31 01:05:10 +00:00
Owen Anderson
b255ada55b
Fix an issue where, under very specific circumstances, memdep could end up dereferencing the end
...
of one of its internal maps.
llvm-svn: 46541
2008-01-30 01:24:05 +00:00
Chris Lattner
23dd05514e
getUnderlyingObject can return null, handle this.
...
llvm-svn: 46318
2008-01-24 19:07:10 +00:00
Chris Lattner
9104d71269
Teach basicaa that 'byval' arguments define a new memory location that
...
can't be aliased to other known objects. This allows us to know that byval
pointer args don't alias globals, etc.
llvm-svn: 46315
2008-01-24 18:00:32 +00:00
Nick Lewycky
d1200b00dc
Don't be rude, emit debugging info where asked to.
...
llvm-svn: 45485
2008-01-02 02:49:20 +00:00
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner
a087a8d2ce
remove attribution from lib Makefiles.
...
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Gordon Henriksen
34eb6d877e
Adding bindings for memory buffers and module providers. Switching
...
to exceptions rather than variants for error handling in Ocaml.
llvm-svn: 45226
2007-12-19 22:30:40 +00:00
Dan Gohman
8a332b235d
Add explicit keywords, and fix a minor typo that they uncovered.
...
llvm-svn: 45034
2007-12-14 15:41:34 +00:00
Wojciech Matyjewicz
86d51b896e
Make these loops follow GetGEPOperands() behavior.
...
Let: %q = GEP %p, X, ...
If %p is a GEP, we can chase baseptr further, only if X==0.
llvm-svn: 44999
2007-12-13 16:22:58 +00:00
Duncan Sands
9ab0943b86
Revert r44626, which turned off the use of readonly
...
and readnone for functions with bodies because it
broke llvm-gcc-4.2 bootstrap. It turns out that,
because of LLVM's array_ref hack, gcc was computing
pure/const attributes wrong (now fixed by turning
off the gcc ipa-pure-const pass).
llvm-svn: 44937
2007-12-12 16:01:40 +00:00
Chris Lattner
b3ba3d9827
Fix a bug in my previous patch, thanks to Jay Foad for
...
pointing this out and correcting the patch!
llvm-svn: 44907
2007-12-12 03:56:54 +00:00
Daniel Berlin
0af43a1895
Changes from Curtis Dunham implementing lazy cycle detection algorithm.
...
Changes from me implementing different way of representing points-to anything.
Changes from me that improve slightly on LCD.
llvm-svn: 44895
2007-12-12 00:37:04 +00:00
Chris Lattner
6a6b3fb62b
Implement constant folding if vector<->vector bitcasts where the number
...
of source/dest elements changes. This implements
test/Transforms/InstCombine/bitcast-vector-fold.ll
llvm-svn: 44855
2007-12-11 07:29:44 +00:00
Chris Lattner
d2265b45ae
Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
...
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe. While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".
llvm-svn: 44817
2007-12-10 22:53:04 +00:00
Chris Lattner
3f42d12072
Fix PR1782, patch by Wojtek Matyjewicz!
...
llvm-svn: 44733
2007-12-09 07:35:13 +00:00
Owen Anderson
086b2c4537
Fix several cache coherence bugs in MemDep/GVN that were found. Also add some (disabled) debugging code
...
to make such problems easier to diagnose in the future, written by Duncan Sands.
llvm-svn: 44695
2007-12-08 01:37:09 +00:00
Duncan Sands
abba5e218c
Commit 44487 broke bootstrap of llvm-gcc-4.2. It is
...
not yet clear why, but in the meantime work around the
problem by making less use of readnone/readonly info.
llvm-svn: 44626
2007-12-05 21:03:28 +00:00
Duncan Sands
38ef3a8ec7
Rather than having special rules like "intrinsics cannot
...
throw exceptions", just mark intrinsics with the nounwind
attribute. Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).
llvm-svn: 44544
2007-12-03 20:06:50 +00:00
Duncan Sands
68b6f50938
Integrate the readonly/readnone logic more deeply
...
into alias analysis. This meant updating the API
which now has versions of the getModRefBehavior,
doesNotAccessMemory and onlyReadsMemory methods
which take a callsite parameter. These should be
used unless the callsite is not known, since in
general they can do a better job than the versions
that take a function. Also, users should no longer
call the version of getModRefBehavior that takes
both a function and a callsite. To reduce the
chance of misuse it is now protected.
llvm-svn: 44487
2007-12-01 07:51:45 +00:00
Chris Lattner
907703cecd
chain update requests properly.
...
llvm-svn: 44460
2007-11-30 18:52:58 +00:00
Duncan Sands
5208d1ab4a
Add some convenience methods for querying attributes, and
...
use them.
llvm-svn: 44403
2007-11-28 17:07:01 +00:00
Duncan Sands
ad0ea2d430
Fix PR1146: parameter attributes are longer part of
...
the function type, instead they belong to functions
and function calls. This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll). Hopefully
a bitcode guru (who might that be? :) ) will fix it.
llvm-svn: 44359
2007-11-27 13:23:08 +00:00
Owen Anderson
b0dd27ee91
Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
...
llvm-svn: 44348
2007-11-27 03:43:35 +00:00
Owen Anderson
7cad745d49
Fix a silly bug that Nicholas noticed.
...
llvm-svn: 44324
2007-11-26 03:27:38 +00:00
Owen Anderson
4f833c7610
Allow GVN to eliminate read-only function calls when it can detect that they are redundant.
...
llvm-svn: 44323
2007-11-26 02:26:36 +00:00
Nick Lewycky
cdb7e54ca7
Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
...
llvm-svn: 44319
2007-11-25 22:41:31 +00:00
Chris Lattner
69ec1ec86a
simplify some code.
...
llvm-svn: 44295
2007-11-23 22:36:49 +00:00
Chris Lattner
7514abe56e
splice some lines together, no functionality change.
...
llvm-svn: 44292
2007-11-23 22:34:59 +00:00
Duncan Sands
8a3e9d2bee
Ding dong, the DoesntAccessMemoryFns and
...
OnlyReadsMemoryFns tables are dead! We
get more, and more accurate, information
from gcc via the readnone and readonly
function attributes.
llvm-svn: 44288
2007-11-23 19:30:27 +00:00
Chris Lattner
a8fbde3f78
Fix a bug where we'd try to find a scev value for a bitcast operand,
...
even though the bitcast operand did not have integer type. This fixes
PR1814.
llvm-svn: 44286
2007-11-23 08:46:22 +00:00
Duncan Sands
38a5e82ef4
Teach alias analysis about readnone/readonly functions.
...
Based on a patch by Török Edwin.
llvm-svn: 44279
2007-11-22 21:43:27 +00:00
Nick Lewycky
3783b46f9e
Instead of calculating constant factors, calculate the number of trailing
...
bits. Patch from Wojciech Matyjewicz.
llvm-svn: 44268
2007-11-22 07:59:40 +00:00
Nick Lewycky
016547d226
Create nodes for inline asm so that we don't crash looking for the node later.
...
llvm-svn: 44267
2007-11-22 03:07:37 +00:00
Nick Lewycky
74a26e3750
Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
...
"setcc" -> "icmp op" in comments. No functionality change.
llvm-svn: 44249
2007-11-20 08:44:50 +00:00
Nick Lewycky
5b18bd3368
Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.
...
llvm-svn: 44248
2007-11-20 08:24:44 +00:00
Tanya Lattner
1db762ba63
Fix for PR1801
...
llvm-svn: 44193
2007-11-16 22:44:50 +00:00
Anton Korobeynikov
6a7ddfdb8f
Reverted r44163 per request
...
llvm-svn: 44177
2007-11-15 18:33:16 +00:00
Nick Lewycky
fbb24817cc
Fix handling of overflow in loop calculation by adding new UDiv SCEV. This SCEV
...
is disabled in the sense that it will refuse to create one from a UDiv
instruction, until the code is better tested.
llvm-svn: 44163
2007-11-15 06:30:50 +00:00
Owen Anderson
1b74a9a628
More templatization.
...
llvm-svn: 44158
2007-11-15 05:00:15 +00:00
Owen Anderson
9306de0727
Start the process of making MachineLoopInfo possible by templating Loop.
...
llvm-svn: 44097
2007-11-14 02:33:58 +00:00
Chris Lattner
0fc613b85d
Fix PR1774 and BasicAA/2007-11-05-SizeCrash.ll
...
llvm-svn: 43756
2007-11-06 05:58:42 +00:00
Duncan Sands
44b8721de8
Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
...
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment. This gives a primitive type for
which getTypeSize differed from getABITypeSize. For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).
This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition). Instead there is:
(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type. For a primitive type, this is the minimum number
of bits. For an i36 this is 36 bits. For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.
(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it). For an
i36 this is 40 bits, for an x86 long double it is 80 bits. This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes). There doesn't seem to be anything
corresponding to this in gcc.
(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment. For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS. This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes). This is
TYPE_SIZE in gcc.
Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize. This means that the size of an array
is the length times the getABITypeSize. It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize. Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case. So alloca's and mallocs should use getABITypeSize. Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.
Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.
In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases). I will get around to auditing these too at some point,
but I could do with some help.
Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize. I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers. If someone wants to pack these types more
tightly they can always use a packed struct.
llvm-svn: 43620
2007-11-01 20:53:16 +00:00
Dan Gohman
1961c28d46
Add explicit keywords.
...
llvm-svn: 43464
2007-10-29 19:52:04 +00:00
Owen Anderson
b7971bbdd7
Make a comment better.
...
llvm-svn: 43379
2007-10-26 03:47:14 +00:00
Hartmut Kaiser
1207cd6b1b
Silenced a VC++ warning.
...
llvm-svn: 43374
2007-10-25 23:49:14 +00:00
Owen Anderson
7827a3f366
Fix for PR1741.
...
llvm-svn: 43326
2007-10-25 02:36:18 +00:00
Owen Anderson
9c614117da
Make DomTree and PostDomTree thin wrappers around DomTreeBase, rather than inheriting from it.
...
llvm-svn: 43259
2007-10-23 20:58:37 +00:00
Dan Gohman
a37eaf2bf9
Move the SCEV object factors from being static members of the individual
...
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.
llvm-svn: 43224
2007-10-22 18:31:58 +00:00
Owen Anderson
4187801f85
Template DominatorTreeBase by node type. This is the next major step towards
...
having dominator information on MBB's.
llvm-svn: 43036
2007-10-16 19:59:25 +00:00
Gordon Henriksen
c3d661a0ee
Bindings for the verifier.
...
llvm-svn: 42707
2007-10-06 21:00:36 +00:00
Owen Anderson
8313e75ea7
Completely merge the implementation details of DomTree and PostDomTree.
...
Also, add a FIXME for a bug in PostDomTree calculation I noticed while writing this,
llvm-svn: 42593
2007-10-03 21:25:45 +00:00
Dan Gohman
c731c97fac
Use empty() member functions when that's what's being tested for instead
...
of comparing begin() and end().
llvm-svn: 42585
2007-10-03 19:26:29 +00:00
Owen Anderson
b60f254975
Factor some code from the DomTree and PostDomTree calculate methods up into
...
each one's runOnFunction method.
llvm-svn: 42563
2007-10-03 03:20:17 +00:00
Dale Johannesen
4d4e77af8e
Rewrite sqrt and powi to use anyfloat. By popular demand.
...
llvm-svn: 42537
2007-10-02 17:43:59 +00:00
Owen Anderson
46ade4eb9b
Template-ize more of the DomTree internal implementation details. Only the calculate() methods for DomTree and PostDomTree remain to be merged/template-ized.
...
llvm-svn: 42476
2007-09-30 04:17:16 +00:00
Chris Lattner
18a9273e61
Add a new DenseSet abstraction.
...
llvm-svn: 42474
2007-09-30 00:47:20 +00:00
Daniel Berlin
342181c51d
Switch to densemap rather than std::set
...
llvm-svn: 42462
2007-09-29 00:50:40 +00:00
Owen Anderson
d0d5c11d18
Remove unneeded #include.
...
llvm-svn: 42428
2007-09-28 01:25:07 +00:00
Owen Anderson
0fbef94cd0
Have PostDomTree use the newly templated DFSPass.
...
llvm-svn: 42427
2007-09-28 01:23:47 +00:00
Dale Johannesen
25a00a63eb
Add sqrt and powi intrinsics for long double.
...
llvm-svn: 42423
2007-09-28 01:08:20 +00:00
Daniel Berlin
a447de7065
Ignore redundant constraints
...
llvm-svn: 42397
2007-09-27 15:42:23 +00:00
Nick Lewycky
3934961878
Build the correct range for loops with unusual bounds. Fix from Jay Foad.
...
llvm-svn: 42394
2007-09-27 14:12:54 +00:00
Duncan Sands
384f4bd878
Add a newline to the end of this file.
...
llvm-svn: 42314
2007-09-25 20:08:48 +00:00
Bill Wendling
d40e795c19
Don't execute dump unless NDEBUG isn't defined.
...
llvm-svn: 42280
2007-09-24 22:43:48 +00:00
Daniel Berlin
c82c9f078a
Comment fixups
...
llvm-svn: 42279
2007-09-24 22:20:45 +00:00
Daniel Berlin
5d7136a1df
Implement offline variable substitution in order to reduce memory
...
and time usage.
Fixup operator == to make this work, and add a resize method to DenseMap
so we can resize our hashtable once we know how big it should be.
llvm-svn: 42269
2007-09-24 19:45:49 +00:00
Owen Anderson
4f7c390939
Merge significant portions of the DomTree and PostDomTree implementations.
...
The two remaining unmerged parts are DFSPass, and the Calculate().
llvm-svn: 42255
2007-09-24 02:29:29 +00:00
Owen Anderson
15efb43db7
Factor the calculation details for PostDomTree out of PostDominators.cpp and
...
into a separate header file.
Next step: merging PostDominatorCalculation.h with DominatorCalculation.h.
llvm-svn: 42251
2007-09-23 22:21:00 +00:00
Owen Anderson
46da2a6262
Add partial caching of non-local memory dependence queries. This provides a modest
...
speedup for GVN.
llvm-svn: 42185
2007-09-21 03:53:52 +00:00
Owen Anderson
c201cbc802
Add a flag to mark a dirty cache entry. This is not yet used, but will eventually
...
help non-local memdep caching.
llvm-svn: 42137
2007-09-19 16:13:57 +00:00
Devang Patel
ee35011d01
ooops...
...
llvm-svn: 42118
2007-09-18 23:58:14 +00:00
Daniel Berlin
90aaa1dcf7
Fix bug in andersen's related to test_and_set.
...
Add operator == and != to SparseBitVector.
Simplify code for test_and_set
llvm-svn: 42018
2007-09-16 23:59:53 +00:00
Daniel Berlin
ffce584d1c
Rewrite of andersen's to be about 100x faster, cleaner, and begin to support field sensitivity
...
llvm-svn: 42016
2007-09-16 21:45:02 +00:00
Dan Gohman
a7b26e6bb3
Change "tmp." to "tmp" for temporaries created by ScalarEvolutionExpander
...
for consistency with many other transforms.
llvm-svn: 41957
2007-09-14 20:11:40 +00:00
Owen Anderson
f9203ab36a
Fix a typo in memdep, which was causing PR1648.
...
llvm-svn: 41833
2007-09-11 04:31:00 +00:00
Owen Anderson
82e4fa1020
Remove an un-needed dependence query. This improves compile time marginally on 401.bzip2.
...
llvm-svn: 41792
2007-09-09 21:43:49 +00:00
Owen Anderson
e2f23a3abf
Add lengthof and endof templates that hide a lot of sizeof computations.
...
Patch by Sterling Stein!
llvm-svn: 41758
2007-09-07 04:06:50 +00:00
Dale Johannesen
bed9dc423c
Next round of APFloat changes.
...
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)
llvm-svn: 41747
2007-09-06 18:13:44 +00:00
Evan Cheng
19ce37a1cd
Missing break. Patch by Wojciech Matyjewicz.
...
llvm-svn: 41727
2007-09-05 21:36:14 +00:00
Devang Patel
f5e520d892
Use SmallVector.
...
llvm-svn: 41230
2007-08-21 16:54:51 +00:00
Devang Patel
a9e7c4f827
No need to hardcode SmallVector size.
...
llvm-svn: 41228
2007-08-21 16:39:43 +00:00
Devang Patel
b5933bbbd5
Use SmallVector instead of std::vector.
...
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Anton Korobeynikov
5849a625ff
- Use correct header for SCEV inside LoopPass.cpp
...
- Move SCEVExpander::expand() out-of-line workarounding possible toolchain bug
llvm-svn: 41197
2007-08-20 21:17:26 +00:00
Owen Anderson
5f208bea91
Cache non-local memory dependence analysis. This is a significant compile
...
time performance win in most cases.
llvm-svn: 41126
2007-08-16 21:27:05 +00:00
Chris Lattner
460e34afed
constant fold ptrtoint(inttoptr) with target data when available. This allows
...
us to fold the entry block of PR1602 to false instead of:
br i1 icmp eq (i32 and (i32 ptrtoint (void (%struct.S*)* inttoptr (i64
1 to void (%struct.S*)*) to i32), i32 1), i32 0), label %cond_next, label
%cond_true
llvm-svn: 41023
2007-08-11 23:49:01 +00:00
Devang Patel
d305c404be
Do not overuse std::string. Pass around char * directly.
...
llvm-svn: 41001
2007-08-10 18:29:32 +00:00
Owen Anderson
9b1cc8cac0
Make NonLocal and None const in the right way. :-)
...
llvm-svn: 40961
2007-08-09 04:42:44 +00:00
Owen Anderson
2b21c3c7a8
Add more comments to memdep.
...
llvm-svn: 40953
2007-08-08 22:26:03 +00:00
Owen Anderson
fa788358d5
Make memdep fit in 80 cols.
...
llvm-svn: 40950
2007-08-08 22:01:54 +00:00
Owen Anderson
b84d3b1c92
Change the None and NonLocal markers in memdep to be const.
...
llvm-svn: 40946
2007-08-08 21:39:39 +00:00
Chris Lattner
7574ef3ac4
Handle functions with no name better.
...
llvm-svn: 40926
2007-08-08 16:07:23 +00:00
Chris Lattner
785f9986bd
significantly speed up constant folding of calls (and thus all clients that use
...
ConstantFoldInstruction on calls) by avoiding Value::getName(). getName() constructs
and returns an std::string, which does heap allocation stuff. This slightly speeds up
instcombine.
llvm-svn: 40924
2007-08-08 06:55:43 +00:00
Chris Lattner
c63d4c2e4e
reimplement dfs number computation to be significantly faster. This speeds up
...
natural loop canonicalization (which does many cfg xforms) by 4.3x, for
example. This also fixes a bug in postdom dfnumber computation.
llvm-svn: 40920
2007-08-08 05:51:24 +00:00
Owen Anderson
68c6732d2c
Clean up a bunch of caching stuff in memdep. This reduces the time to run GVN
...
on 403.gcc from ~15s to ~10s.
llvm-svn: 40884
2007-08-07 00:33:45 +00:00
Owen Anderson
4898513d96
Improve the accuracy of memdep for determining the dependencies of loads.
...
This brings GVN to parity with GCSE+LoadVN.
llvm-svn: 40882
2007-08-06 23:26:03 +00:00
Chandler Carruth
bebc3bb2e3
This resolves a regression of BasicAA which failed to find any memory information for overloaded intrinsics (PR1600). This resolves that issue, and improves the matching scheme to use a BitVector rather than a binary search.
...
llvm-svn: 40872
2007-08-06 20:57:16 +00:00
Nick Lewycky
96606cec20
Let scalar-evolution analyze loops with an unsigned comparison for the exit
...
condition. Fixes 1597.
llvm-svn: 40867
2007-08-06 19:21:00 +00:00
Nick Lewycky
b9819f3a8b
Don't assume it's safe to transform a loop just because it's dominated by any
...
comparison. Fixes bug 1598.
llvm-svn: 40866
2007-08-06 18:33:46 +00:00
Chris Lattner
6493fc79fe
Upgrade BasicAliasAnalysis::getModRefBehavior to not call Value::getName,
...
which dynamically allocates the string result. This speeds up dse on the
testcase from PR1432 from 0.3781s to 0.1804s (2.1x).
llvm-svn: 40838
2007-08-05 07:50:06 +00:00
Chris Lattner
d2eb0c9653
Fix an iterator invalidation bug I induced.
...
llvm-svn: 40830
2007-08-05 00:24:30 +00:00
Chris Lattner
0e8f85f87e
Switch some std::sets to SmallPtrSet. This speeds up
...
domtree by 10% and postdomtree by 17%
llvm-svn: 40829
2007-08-05 00:15:57 +00:00
Chris Lattner
77e05fe20d
Switch the internal "Info" map from an std::map to a DenseMap. This
...
speeds up idom by about 45% and postidom by about 33%.
Some extra precautions must be taken not to invalidate densemap iterators.
llvm-svn: 40827
2007-08-05 00:02:00 +00:00
Chris Lattner
bd0fe01daf
switch the DomTreeNodes and IDoms maps in idom/postidom to a
...
DenseMap instead of an std::map. This speeds up postdomtree
by about 25% and domtree by about 23%. It also speeds up clients,
for example, domfrontier by 11%, mem2reg by 4% and ADCE by 6%.
llvm-svn: 40826
2007-08-04 23:48:07 +00:00
Chandler Carruth
7132e00de7
This is the patch to provide clean intrinsic function overloading support in LLVM. It cleans up the intrinsic definitions and generally smooths the process for more complicated intrinsic writing. It will be used by the upcoming atomic intrinsics as well as vector and float intrinsics in the future.
...
This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.
llvm-svn: 40807
2007-08-04 01:51:18 +00:00
Owen Anderson
0ac1fc8ac1
Fix a bug that was causing several miscompilations on SPEC.
...
llvm-svn: 40746
2007-08-02 17:56:05 +00:00
Christopher Lamb
531f260ac0
Implement review feedback.
...
llvm-svn: 40745
2007-08-02 17:52:00 +00:00
Christopher Lamb
1a80201426
Teach BasicAA about noalias parameter attributes, but do it correctly this time.
...
llvm-svn: 40711
2007-08-02 01:18:14 +00:00
Owen Anderson
c321e5e272
Make non-local memdep not be recursive, and fix a bug on 403.gcc that this exposed.
...
llvm-svn: 40692
2007-08-01 22:01:54 +00:00
Dan Gohman
34d442f274
More explicit keywords.
...
llvm-svn: 40673
2007-08-01 15:32:29 +00:00
David Greene
87801e8773
Fix GLIBCXX_DEBUG error owing to dereference of end iterator. There's
...
no guarantee that an instruction returned by getDependency exists in
the maps.
llvm-svn: 40647
2007-07-31 20:01:27 +00:00
Christopher Lamb
283152404d
Revert overly aggressive interpretation of noalias
...
llvm-svn: 40635
2007-07-31 16:18:07 +00:00
Devang Patel
cc2b233b62
Introduce Simple Analysis interface for loop passes.
...
Right now, this interface provides hooks for only to operations, 1) clone basic block 2) delete value.
llvm-svn: 40625
2007-07-31 08:00:57 +00:00
Christopher Lamb
b08423b36e
Teach BasicAA about noalias function parameters. Passes all of DejaGNU and test-suite.
...
llvm-svn: 40624
2007-07-31 07:04:51 +00:00
Owen Anderson
212d5c27f6
Use more caching when computing non-local dependence. This makes bzip2 not
...
use up the entire 32-bit address space.
llvm-svn: 40596
2007-07-30 17:29:24 +00:00
Owen Anderson
0f692f27a3
Fix a bug introduced in my last commit.
...
llvm-svn: 40542
2007-07-26 18:57:04 +00:00
Owen Anderson
dbf23ccaa0
Fix a couple more bugs in the phi construction by pulling in code that does
...
almost the same things from LCSSA.
llvm-svn: 40540
2007-07-26 18:26:51 +00:00
Owen Anderson
9b796348bd
Fix a bug in non-local memdep that was causing an infinite loop on 175.vpr.
...
llvm-svn: 40495
2007-07-25 21:26:36 +00:00
Owen Anderson
5e5599b7ce
Add basic support for performing whole-function RLE.
...
Note: This has not yet been thoroughly tested. Use at your own risk.
llvm-svn: 40489
2007-07-25 19:57:03 +00:00
Owen Anderson
d998be79cc
Add initial support for non-local memory dependence analysis.
...
NOTE: This has only been cursorily tested. Expected improvements soon.
llvm-svn: 40476
2007-07-24 21:52:37 +00:00
Devang Patel
13b25df0e9
Unreachable block is not a root node in post dominator tree.
...
llvm-svn: 40458
2007-07-24 01:02:25 +00:00
Owen Anderson
edb926bfe3
When removing instructions from the analysis, be sure to check the confirmed
...
flag when determining what to do with dependencies.
llvm-svn: 40079
2007-07-20 06:16:07 +00:00
Devang Patel
a273d1cd3a
Verify loop info.
...
llvm-svn: 40062
2007-07-19 18:02:32 +00:00
Duncan Sands
60f28bff4c
Replace mysterious code causing a g++-4.2 warning
...
with hopefully correct code that pleases g++-4.2.
llvm-svn: 40051
2007-07-19 09:42:01 +00:00
Owen Anderson
7fcaaadf1c
Add support for walking up memory def chains, which enables finding many more
...
dead stores on 400.perlbench.
llvm-svn: 39929
2007-07-16 21:52:50 +00:00
Dan Gohman
72efc04d8e
Use ConstantFoldFP for folding all unary floating-point operations which may
...
have an error, and refector out the code for binary operators into
ConstantFoldBinaryFP and use it for all binary floating-point operations
which may have an error. These functions still rely exclusively on errno
to detect errors though.
llvm-svn: 39923
2007-07-16 15:26:22 +00:00
Dan Gohman
06c60b6032
Fix comments about vectors to use the current wording.
...
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Nick Lewycky
5246026c8c
Handle decrementing loops properly. Fixes PR1533.
...
Always pass the constant as the second parameter to HowManyLessThans.
Remove obsolete "isSigned" parameter.
llvm-svn: 39893
2007-07-16 02:08:00 +00:00
Owen Anderson
1e1bace52b
Let MemoryDependenceAnalysis take care of updating AliasAnalysis.
...
llvm-svn: 39769
2007-07-12 00:06:21 +00:00
Owen Anderson
c432490b4c
Calculate the size of a array allocation correctly.
...
llvm-svn: 38511
2007-07-10 20:48:38 +00:00
Owen Anderson
faf9e42479
Fix a crasher when finding the dependency of a call.
...
llvm-svn: 38510
2007-07-10 20:39:07 +00:00
Owen Anderson
1279eaf776
Make this pass registration static as well.
...
llvm-svn: 38509
2007-07-10 20:21:08 +00:00
Owen Anderson
1fa6132e85
Handle vaarg instructions correctly.
...
llvm-svn: 38504
2007-07-10 18:43:15 +00:00
Owen Anderson
94a21dd1e0
Volatile loads and stores depend on each other.
...
llvm-svn: 38502
2007-07-10 18:11:42 +00:00
Owen Anderson
9c88457abe
Add support for finding the dependencies of call and invoke instructions.
...
llvm-svn: 38497
2007-07-10 17:59:22 +00:00
Owen Anderson
2552a12e65
Fix the build, and fix the handling of pointer sizes.
...
llvm-svn: 38494
2007-07-10 17:25:03 +00:00
Owen Anderson
47352db672
Fix a bunch of things from Chris' feedback
...
llvm-svn: 38493
2007-07-10 17:08:11 +00:00
Dan Gohman
0a76e7f678
Move the APInt form of SCEVUnknown::getIntegerSCEV to SCEVConstant::get, and
...
use SCEVConstant::get instead of SCEVUnknown::get when constructing a SCEV
for a ConstantInt.
llvm-svn: 38457
2007-07-09 15:25:17 +00:00
Owen Anderson
c0daf5fe53
A first stab at memory dependence analysis. This is an interface on top of
...
alias analysis, adding caching and lazy computation of queries. This will
be used in planned improvements to memory access optimizations.
llvm-svn: 37958
2007-07-06 23:14:35 +00:00
Dan Gohman
1eb8ed47f5
Add explicit keywords.
...
llvm-svn: 37839
2007-07-02 14:53:37 +00:00
Devang Patel
88197332e7
Add loop info verification mechanism.
...
llvm-svn: 37822
2007-06-29 23:13:42 +00:00
Devang Patel
703de8fea8
CallGraphSCCPass manager may require other passes.
...
Use schedulePass() to accomodate these requirement instead of directly
assigning a manager to new CallGraph PassManager.
llvm-svn: 37695
2007-06-21 22:29:02 +00:00
Dan Gohman
32f53bbd85
Rename ScalarEvolution::deleteInstructionFromRecords to
...
deleteValueFromRecords and loosen the types to all it to accept
Value* instead of just Instruction*, since this is what
ScalarEvolution uses internally anyway. This allows more flexibility
for future uses.
llvm-svn: 37657
2007-06-19 14:28:31 +00:00
Dan Gohman
eed125f315
In SCEVAddExpr::get, skip over any cast operands before looking for nested
...
add operands after constant operands. The recent change to recognize
sign-extend expressions caused this to be exposed more often.
llvm-svn: 37628
2007-06-18 19:30:09 +00:00
Anton Korobeynikov
02b0997b28
Make BasicAliasAnalysis correctly register itself. Patch by Devang
...
llvm-svn: 37627
2007-06-18 17:13:29 +00:00
Dan Gohman
00cb117b07
Fold a binary operator with constant operands when expanding code for a SCEV.
...
llvm-svn: 37602
2007-06-15 19:21:55 +00:00
Dan Gohman
cb9e09ad57
Add a SCEV class and supporting code for sign-extend expressions.
...
This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.
llvm-svn: 37591
2007-06-15 14:38:12 +00:00
Devang Patel
a6ff5bf9ba
Break DominatorTree from ETNode.
...
Remove unused PostETForest.
llvm-svn: 37551
2007-06-12 00:54:38 +00:00
Devang Patel
aee309e353
Use DominatorTree instead of ETForest.
...
llvm-svn: 37507
2007-06-08 00:17:13 +00:00
Devang Patel
31257adce9
Use DominatorTree instead of ETForest.
...
llvm-svn: 37505
2007-06-07 23:53:38 +00:00
Devang Patel
af41e4a192
Maintain ETNode as part of DomTreeNode.
...
This adds redundancy for now.
llvm-svn: 37492
2007-06-07 17:47:21 +00:00
Nick Lewycky
df543f4b84
Optimize this test. Firstly, only Instructions may use other Instructions.
...
Secondly, checking whether removal succeeded tells you whether it was in
the map to begin with.
llvm-svn: 37469
2007-06-06 11:26:20 +00:00
Nick Lewycky
3e84212897
Fix PR1487 and Transforms/IndVar/2007-06-06-DeleteDanglesPtr.ll
...
llvm-svn: 37459
2007-06-06 04:12:20 +00:00
Devang Patel
3e6519e9fa
Fix PR 1497
...
Use separate pass id for CFGOnlyPrinter.
llvm-svn: 37439
2007-06-05 20:24:36 +00:00
Devang Patel
bdd1aaef10
s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
...
llvm-svn: 37407
2007-06-04 00:32:22 +00:00
Devang Patel
0e8aa7b69a
s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
...
llvm-svn: 37403
2007-06-03 06:26:14 +00:00
Chris Lattner
688b2807df
when merging two alias sets together, be sure to propagate the volatility of
...
the inner set. This fixes PR1435 and Transforms/LICM/2007-05-22-VolatileSink.ll
llvm-svn: 37305
2007-05-23 06:36:35 +00:00
Dan Gohman
90d97ac1e6
Add passes -view-cfg and -view-cfg-only that are like -print-cfg and
...
-print-cfg-only except they use the ViewCFG function, which displays the
CFG rendered with graphviz with gv.
llvm-svn: 37033
2007-05-14 14:25:08 +00:00
Nick Lewycky
e7da2d6ac3
Fix typo in comment.
...
llvm-svn: 36873
2007-05-06 13:37:16 +00:00
Devang Patel
8c78a0bff0
Drop 'const'
...
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
e95c6ad802
Use 'static const char' instead of 'static const int'.
...
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.
llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Lauro Ramos Venancio
41223586a2
Fix build error.
...
llvm-svn: 36648
2007-05-02 20:37:47 +00:00
Devang Patel
09f162ca6a
Do not use typeinfo to identify pass in pass manager.
...
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Zhou Sheng
aafe4e216e
Make use of ConstantInt::isZero instead of ConstantInt::isNullValue.
...
llvm-svn: 36261
2007-04-19 05:39:12 +00:00
Devang Patel
883ff07672
Cache DT[*SI] lookup.
...
llvm-svn: 36239
2007-04-18 01:19:55 +00:00
Devang Patel
5976db0103
Fix
...
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070416/047971.html
llvm-svn: 36236
2007-04-18 00:53:01 +00:00
Chris Lattner
135a077c93
Be more careful when inserting reused instructions. This fixes CodeGen/Generic/2007-04-17-lsr-crash.ll
...
llvm-svn: 36231
2007-04-17 23:43:50 +00:00
Chris Lattner
672db8eab5
Remove use of Instruction::getNext
...
llvm-svn: 36201
2007-04-17 17:52:45 +00:00
Anton Korobeynikov
fb80151c42
Removed tabs everywhere except autogenerated & external files. Add make
...
target for tabs checking.
llvm-svn: 36146
2007-04-16 18:10:23 +00:00
Reid Spencer
a3cfb8a683
Revert last patch. It was already fixed.
...
llvm-svn: 36102
2007-04-16 02:24:41 +00:00
Reid Spencer
8be22e4e04
For PR1336:
...
Fix a div-by-zero bug noticed by APInt. This fixes:
test/Transforms/IndVarsSimplify/exit_value_tests.llx
llvm-svn: 36099
2007-04-16 01:48:37 +00:00
Owen Anderson
f064c92298
Tabs -> Spaces
...
llvm-svn: 36094
2007-04-15 23:14:18 +00:00
Chris Lattner
cad61e81c1
Fix a nasty bug introduced when apint'ified. This fixes
...
Transforms/IndVarsSimplify/exit_value_tests.llx
llvm-svn: 36081
2007-04-15 19:52:49 +00:00
Owen Anderson
f35a1dbc7a
Remove ImmediateDominator analysis. The same information can be obtained from DomTree. A lot of code for
...
constructing ImmediateDominator is now folded into DomTree construction.
This is part of the ongoing work for PR217.
llvm-svn: 36063
2007-04-15 08:47:27 +00:00
Chris Lattner
e71f1447f7
CSE simple binary expressions when they are inserted. This makes LSR produce
...
less huge code that needs to be cleaned up by sdisel.
llvm-svn: 35959
2007-04-13 05:04:18 +00:00
Zhou Sheng
2852d99a48
Eliminate unnecessary APInt construction.
...
llvm-svn: 35740
2007-04-07 17:48:27 +00:00
Zhou Sheng
c0297896aa
Make APInt variables do the computation stuffs instead of
...
ConstantExpr::getXX if possible.
llvm-svn: 35738
2007-04-07 17:40:57 +00:00
Zhou Sheng
1459c73481
Eliminate unnecessary zext/trunc stuffs.
...
llvm-svn: 35737
2007-04-07 17:12:38 +00:00
Owen Anderson
8763ba1b88
Completely purge DomSet. This is the (hopefully) final patch for PR1171.
...
llvm-svn: 35731
2007-04-07 07:17:27 +00:00
Owen Anderson
1a290bbddf
Expunge DomSet from LoadValueNumbering. This is part of the continuing
...
work on PR1171.
llvm-svn: 35723
2007-04-07 04:43:07 +00:00
Chris Lattner
a3e0bb4ebb
Treat xor of signbit like an add.
...
llvm-svn: 35586
2007-04-02 05:41:38 +00:00
Reid Spencer
add6123405
The bit counting intrinsics return i32 not the operand type. This fixes
...
last night's regression in SingleSource/UnitTests/2005-05-11-Popcount-ffs-fls
llvm-svn: 35556
2007-04-01 18:42:20 +00:00
Reid Spencer
6bba6c8143
For PR1297:
...
Support overloaded intrinsics bswap, ctpop, cttz, ctlz.
llvm-svn: 35547
2007-04-01 07:35:23 +00:00
Dan Gohman
dcb291faa4
Change uses of Function::front to Function::getEntryBlock for readability.
...
llvm-svn: 35265
2007-03-22 16:38:57 +00:00
Devang Patel
2ac57e1f02
Now IndVarSimplify is a LoopPass.
...
llvm-svn: 35003
2007-03-07 06:39:01 +00:00
Devang Patel
901a27d892
Now LoopUnswitch is a LoopPass.
...
llvm-svn: 34992
2007-03-07 00:26:10 +00:00
Devang Patel
db0db9740b
Insert loop into LQ before visiting children.
...
llvm-svn: 34982
2007-03-06 19:50:49 +00:00
Devang Patel
4a8725cf2f
Use schedulePass() instead of assignPassManager() to add new LPPassManager.
...
This ensures that require analysis info is available.
llvm-svn: 34980
2007-03-06 19:11:25 +00:00