Dan Gohman
47308d5da3
Reapply r112432, now that the real problem is addressed.
...
llvm-svn: 112667
2010-08-31 22:53:17 +00:00
Dan Gohman
f01a5eed1e
Reapply r112433, now that the real problem is addressed.
...
llvm-svn: 112666
2010-08-31 22:52:12 +00:00
Dan Gohman
aabfc52790
Revert r110916. This patch is buggy because the code inside the
...
inner loop doesn't update all the variables in the outer loop.
llvm-svn: 112665
2010-08-31 22:50:31 +00:00
Dan Gohman
90f29bcd90
Revert r112432. It appears to be exposing a problem in the emacs build.
...
llvm-svn: 112638
2010-08-31 20:58:44 +00:00
Dan Gohman
444c24a9f0
Speculatively revert r112433.
...
llvm-svn: 112608
2010-08-31 17:56:47 +00:00
Dan Gohman
d1da5cdfee
Restructure the {A,+,B}<L> * {C,+,D}<L> folding so that it folds
...
all applicable addrecs before recursing on getMulExpr, instead of
recursing on getMulExpr for each one.
llvm-svn: 112433
2010-08-29 15:16:58 +00:00
Dan Gohman
3e6fc18943
Batch up subtracts along with adds, when analyzing long chains of
...
operations.
llvm-svn: 112432
2010-08-29 15:10:06 +00:00
Dan Gohman
7712d2900d
Micro-optimize GroupByComplexity.
...
llvm-svn: 112431
2010-08-29 15:07:13 +00:00
Dan Gohman
0f2de01355
Hold AddRec->getLoop() in a variable, to make the Mul code more consistent
...
with the Add code.
llvm-svn: 112430
2010-08-29 14:55:19 +00:00
Dan Gohman
028c18158a
Rename a variable, for consistency.
...
llvm-svn: 112429
2010-08-29 14:53:34 +00:00
Dan Gohman
28a84d4ba1
Use iterators instead of indices.
...
llvm-svn: 112428
2010-08-29 14:52:02 +00:00
Dan Gohman
fe22f1d3cc
Fix an index calculation thinko.
...
llvm-svn: 112337
2010-08-28 00:39:27 +00:00
Dan Gohman
15871f23e3
When merging adjacent operands, scan ahead and merge all equal
...
adjacent operands at once, instead of just two at a time.
llvm-svn: 112299
2010-08-27 21:39:59 +00:00
Dan Gohman
c866bf4fec
Make the {A,+,B}<L> + {C,+,D}<L> --> Other + {A+C,+,B+D}<L>
...
transformation collect all the addrecs with the same loop
add combine them at once rather than starting everything over
at the first chance.
llvm-svn: 112290
2010-08-27 20:45:56 +00:00
Dan Gohman
9bad2fb378
Switch ScalarEvolution's main Value*->SCEV* map from std::map
...
to DenseMap.
llvm-svn: 112281
2010-08-27 18:55:03 +00:00
Dan Gohman
2706567c5c
Optimize SCEVComplexityCompare. Use a 3-way return instead of a 2-way
...
return to avoid needing two calls to test for equivalence, and sort
addrecs by their degree before examining their operands.
llvm-svn: 112267
2010-08-27 15:26:01 +00:00
Dan Gohman
797a1dbb1c
To create a copy of a SmallVector with an element removed from the
...
middle, copy the elements in two groups, rather than copying all the
elements and then doing an erase on the middle of the result. These
are SmallVectors, so we shouldn't expect to hit dynamic allocation
in the common case.
llvm-svn: 111151
2010-08-16 16:57:24 +00:00
Dan Gohman
0d0cc18af5
Tidy whitespace.
...
llvm-svn: 111147
2010-08-16 16:34:09 +00:00
Dan Gohman
c29eeaecec
Add a comment.
...
llvm-svn: 111145
2010-08-16 16:31:39 +00:00
Dan Gohman
7eac4961d7
Use const_iterator in a few places.
...
llvm-svn: 111144
2010-08-16 16:30:01 +00:00
Dan Gohman
74c61503b1
Use iterators instead of indices in a few more places.
...
llvm-svn: 111143
2010-08-16 16:27:53 +00:00
Dan Gohman
f29618236e
Micro-optimize SCEVConstant comparison.
...
llvm-svn: 111142
2010-08-16 16:25:35 +00:00
Dan Gohman
3688ea5c7d
Move SCEVNAryExpr's virtual member functions out of line, and convert
...
them to iterators.
llvm-svn: 111140
2010-08-16 16:21:27 +00:00
Dan Gohman
d6925bbe0d
Use iterators instead of indices in simple cases.
...
llvm-svn: 111138
2010-08-16 16:16:11 +00:00
Dan Gohman
b6c773ec2e
Avoid gratuitous inefficiency in ifndef NDEBUG code.
...
llvm-svn: 111137
2010-08-16 16:13:54 +00:00
Dan Gohman
e5fb1036e6
Make one getAddExpr call when analyzing a+b+c+d+e+... instead of one
...
for each add instruction. Ditto for Mul.
llvm-svn: 111136
2010-08-16 16:03:49 +00:00
Dan Gohman
b094b39111
Delete an unused function.
...
llvm-svn: 111135
2010-08-16 15:57:14 +00:00
Dan Gohman
0c436ab356
Various optimizations. Don't compare two loops' depths
...
when they are the same loop. Don't compare two instructions'
loop depths when they are in the same block.
llvm-svn: 111045
2010-08-13 21:24:58 +00:00
Dan Gohman
63c020a210
When testing whether one loop contains another, test this directly
...
rather than testing whether the loop contains the other's header.
llvm-svn: 111039
2010-08-13 20:23:25 +00:00
Dan Gohman
3324b9ec67
Add a const.
...
llvm-svn: 111038
2010-08-13 20:17:27 +00:00
Dan Gohman
cf32f2bde1
When creating a symmetric SCEV with a constant operand, put
...
the constant operand on the left, as that's where ScalarEvolution
will end up canonicalizing to.
llvm-svn: 111037
2010-08-13 20:17:14 +00:00
Dan Gohman
ec0120a123
An add recurrence is loop-invariant in any loop inside of its
...
associated loop. This avoids potentially expensive traversals
of the add recurrence's operands.
llvm-svn: 111034
2010-08-13 20:11:39 +00:00
Dan Gohman
2de47777f4
Optimize ScalarEvolution::getAddExpr's operand factoring code by
...
having it finish processing all of the muliply operands before
starting the whole getAddExpr process over again, instead of
immediately after the first simplification.
llvm-svn: 110916
2010-08-12 15:00:23 +00:00
Dan Gohman
157847f5d1
Hoist some loop-invariant code out of a hot loop.
...
llvm-svn: 110915
2010-08-12 14:52:55 +00:00
Dan Gohman
e67b287451
Optimize ScalarEvolution::getAddExpr's duplicate operand detection
...
by having it finish processing the whole operand list before
starting the whole getAddExpr process over again, instead of
immediately after the first duplicate is found.
llvm-svn: 110914
2010-08-12 14:46:54 +00:00
Dan Gohman
f7495f286a
When analyzing loop exit conditions combined with and and or, don't
...
make any assumptions about when the two conditions will agree on when
to permit the loop to exit. This fixes PR7845.
llvm-svn: 110758
2010-08-11 00:12:36 +00:00
Dan Gohman
e18c2d6f99
Rename and reorder the arguments to isImpliedCond, for consistency and clarity.
...
llvm-svn: 110750
2010-08-10 23:46:30 +00:00
Owen Anderson
a7aed18624
Reapply r110396, with fixes to appease the Linux buildbot gods.
...
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
bda59bd247
Revert r110396 to fix buildbots.
...
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
755aceb5d0
Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
...
ID member as the sole unique type identifier. Clean up APIs related to this change.
llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Dan Gohman
db764c6e3b
Fix a minor bug which resulted in intermediate calculations
...
using wider types than are necessary.
llvm-svn: 110241
2010-08-04 19:52:50 +00:00
Dan Gohman
7cac95778f
Make SCEVUnknown a CallbackVH, so that it can be notified directly
...
of Value deletions and RAUWs, instead of relying on ScalarEvolution's
Scalars map being notified, as that's complicated at best, and
insufficient in general.
This means SCEVUnknown needs a non-trivial destructor, so introduce
a mechanism to allow ScalarEvolution to locate all the SCEVUnknowns.
llvm-svn: 110086
2010-08-02 23:49:30 +00:00
Oscar Fuentes
40b31ad3ee
Prefix `next' iterator operation with `llvm::'.
...
Fixes potential ambiguity problems on VS 2010.
Patch by nobled!
llvm-svn: 110029
2010-08-02 06:00:15 +00:00
Eric Christopher
ef6d5933a6
Speculatively revert r109705 since it seems to be causing some build bot
...
angst.
llvm-svn: 109718
2010-07-29 01:25:38 +00:00
Dan Gohman
3d6ac44d96
Factor out some of the code for updating old SCEVUnknown values, and
...
extend it to handle the case where multiple RAUWs affect a single
SCEVUnknown.
Add a ScalarEvolution unittest to test for this situation.
llvm-svn: 109705
2010-07-29 00:17:55 +00:00
Dan Gohman
7a066723d0
Make SCEVCallbackVH::allUsesReplacedWith update the old SCEVUnknown
...
object, as it may still be referenced by SCEVs not cleaned up by the
use list traversal.
Also, in ScalarEvolution::forgetValue, only check for a SCEVUnknown
object for the original value, not for any value in the use list,
because other SCEVUnknown values aren't necessary obsolete at that
point.
llvm-svn: 109570
2010-07-28 01:09:07 +00:00
Dan Gohman
8aeb0fb5ca
Make SCEVCallbackVH::allUsesReplacedWith unconditionally delete
...
the old value.
llvm-svn: 109567
2010-07-28 00:28:25 +00:00
Dan Gohman
5ae3102459
Micro-optimize SCEVComplexityCompare.
...
llvm-svn: 109267
2010-07-23 21:20:52 +00:00
Dan Gohman
992db006d0
Add a const qualifier.
...
llvm-svn: 109266
2010-07-23 21:18:55 +00:00
Gabor Greif
dde79d8f1a
mass elimination of reliance on automatic iterator dereferencing
...
llvm-svn: 109103
2010-07-22 13:36:47 +00:00