Gabor Greif
c78d720f02
rename use_const_iterator to const_use_iterator for consistency's sake
...
llvm-svn: 99564
2010-03-25 23:06:16 +00:00
Dan Gohman
29707de4fe
Make SCEVExpander and LSR more aggressive about hoisting expressions out
...
of loops.
llvm-svn: 97642
2010-03-03 05:29:13 +00:00
Dan Gohman
52f5563973
Non-affine post-inc SCEV expansions have more code which must be
...
emitted after the increment. Make sure the insert position
reflects this. This fixes PR6453.
llvm-svn: 97537
2010-03-02 01:59:21 +00:00
Dan Gohman
8b0a419eb1
Spelling fixes.
...
llvm-svn: 97453
2010-03-01 17:49:51 +00:00
Dan Gohman
8c16b38262
Remove unused variables and parameters.
...
llvm-svn: 96780
2010-02-22 04:11:59 +00:00
Dan Gohman
4506fcb3c2
When emitting an instruction which depends on both a post-incremented
...
induction variable value and a loop-variant value, don't force the
insert position to be at the post-increment position, because it may
not be dominated by the loop-variant value. This fixes a
use-before-def problem noticed on PPC.
llvm-svn: 96774
2010-02-22 03:59:54 +00:00
Dan Gohman
4eebb94094
Rename getSDiv to getExactSDiv to reflect its behavior in cases where
...
the division would have a remainder.
llvm-svn: 96693
2010-02-19 19:35:48 +00:00
Dan Gohman
85af256779
Check for overflow when scaling up an add or an addrec for
...
scaled reuse.
llvm-svn: 96692
2010-02-19 19:32:49 +00:00
Dan Gohman
2446f57503
When determining the set of interesting reuse factors, consider
...
strides in foreign loops. This helps locate reuse opportunities
with existing induction variables in foreign loops and reduces
the need for inserting new ones. This fixes rdar://7657764.
llvm-svn: 96629
2010-02-19 00:05:23 +00:00
Dan Gohman
13ac3b2139
Delete some unneeded casts.
...
llvm-svn: 96429
2010-02-17 00:42:19 +00:00
Dan Gohman
5f10d6c52c
Don't attempt to divide INT_MIN by -1; consider such cases to
...
have overflowed.
llvm-svn: 96428
2010-02-17 00:41:53 +00:00
Dan Gohman
6deab96c81
Refactor rewriting for PHI nodes into a separate function.
...
llvm-svn: 96382
2010-02-16 20:25:07 +00:00
Dan Gohman
0849ed5e26
Fix whitespace.
...
llvm-svn: 96372
2010-02-16 19:42:34 +00:00
Duncan Sands
19d0b47b1f
There are two ways of checking for a given type, for example isa<PointerType>(T)
...
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.
llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Dan Gohman
521efe68ab
Split the main for-each-use loop again, this time for GenerateTruncates,
...
as it also peeks at which registers are being used by other uses. This
makes LSR less sensitive to use-list order.
llvm-svn: 96308
2010-02-16 01:42:53 +00:00
Dan Gohman
e4e51a63da
Fix whitespace.
...
llvm-svn: 96179
2010-02-14 18:51:39 +00:00
Dan Gohman
e7f74bb16c
Fix a comment.
...
llvm-svn: 96178
2010-02-14 18:51:20 +00:00
Dan Gohman
bb7d52213c
When complicated expressions are broken down into subexpressions
...
with multiplication by constants distributed through, occasionally
those subexpressions can include both x and -x. For now, if this
condition is discovered within LSR, just prune such cases away,
as they won't be profitable. This fixes a "zero allocated in a
base register" assertion failure.
llvm-svn: 96177
2010-02-14 18:50:49 +00:00
Dan Gohman
2d0f96d49a
Actually, this code doesn't have to be quite so conservative in
...
the no-TLI case. But it should still default to declining the
transformation.
llvm-svn: 96152
2010-02-14 03:21:49 +00:00
Dan Gohman
cb76a806f0
Don't attempt aggressive post-inc uses if TargetLowering is not available,
...
because profitability can't be sufficiently approximated.
llvm-svn: 96148
2010-02-14 02:45:21 +00:00
John McCall
0daaf13b97
Make LSR not crash if invoked without target lowering info, e.g. if invoked
...
from opt.
llvm-svn: 96135
2010-02-13 23:40:16 +00:00
Dan Gohman
5b18f039eb
Fix a pruning heuristic which implicitly assumed that SmallPtrSet is
...
deterministically sorted.
llvm-svn: 96071
2010-02-13 02:06:02 +00:00
Dan Gohman
2b75de97c0
Reapply 95979, a compile-time speedup, now that the bug it exposed is fixed.
...
llvm-svn: 96005
2010-02-12 19:35:25 +00:00
Dan Gohman
363f847ec6
Fix this code to avoid dereferencing an end() iterator in
...
offset distributions it doesn't expect.
llvm-svn: 96002
2010-02-12 19:20:37 +00:00
Daniel Dunbar
e0b2c69d3c
Revert "Reverse the order for collecting the parts of an addrec. The order", it
...
is breaking llvm-gcc bootstrap.
llvm-svn: 95988
2010-02-12 17:27:08 +00:00
Dan Gohman
0194f58047
Reverse the order for collecting the parts of an addrec. The order
...
doesn't matter, except that ScalarEvolution tends to need less time
to fold the results this way.
llvm-svn: 95979
2010-02-12 11:08:26 +00:00
Dan Gohman
45774ce0ad
Reapply the new LoopStrengthReduction code, with compile time and
...
bug fixes, and with improved heuristics for analyzing foreign-loop
addrecs.
This change also flattens IVUsers, eliminating the stride-oriented
groupings, which makes it easier to work with.
llvm-svn: 95975
2010-02-12 10:34:29 +00:00
Bill Wendling
48816a0b3f
Generic reformatting and comment fixing. No functionality change.
...
llvm-svn: 94771
2010-01-29 00:52:43 +00:00
Bill Wendling
8277838cf8
Add newline to debugging output, and fix some grammar-os in comment.
...
llvm-svn: 94765
2010-01-29 00:27:39 +00:00
Dan Gohman
045f81981a
Revert LoopStrengthReduce.cpp to pre-r94061 for now.
...
llvm-svn: 94123
2010-01-22 00:46:49 +00:00
Dan Gohman
b1ee154b6b
When inserting expressions for post-increment users which contain
...
loop-variant components, adds must be inserted after the increment.
Keep track of the increment position for this case, and insert
these adds in the correct location.
llvm-svn: 94110
2010-01-21 23:01:22 +00:00
Dan Gohman
cb8d577eb2
Include IVUsers information in LSR's debug output.
...
llvm-svn: 94108
2010-01-21 22:46:32 +00:00
Dan Gohman
29916e023d
Prune the search for candidate formulae if the number of register
...
operands exceeds the number of registers used in the initial
solution, as that wouldn't lead to a profitable solution anyway.
llvm-svn: 94107
2010-01-21 22:42:49 +00:00
Dan Gohman
c903499ff8
Add a comment.
...
llvm-svn: 94104
2010-01-21 21:31:09 +00:00
Dan Gohman
51ad99d2c5
Re-implement the main strength-reduction portion of LoopStrengthReduction.
...
This new version is much more aggressive about doing "full" reduction in
cases where it reduces register pressure, and also more aggressive about
rewriting induction variables to count down (or up) to zero when doing so
reduces register pressure.
It currently uses fairly simplistic algorithms for finding reuse
opportunities, but it introduces a new framework allows it to combine
multiple strategies at once to form hybrid solutions, instead of doing
all full-reduction or all base+index.
llvm-svn: 94061
2010-01-21 02:09:26 +00:00
Dan Gohman
b5358003fb
Set Changed properly after calling DeleteDeadPHIs.
...
llvm-svn: 92735
2010-01-05 16:31:45 +00:00
David Greene
2330f78075
Remove dump routine and the associated Debug.h from a header. Patch up
...
other files to compensate.
llvm-svn: 92075
2009-12-23 22:58:38 +00:00
Dan Gohman
18fa5686f6
Add Loop contains utility methods for testing whether a loop
...
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.
llvm-svn: 91654
2009-12-18 01:24:09 +00:00
Dan Gohman
fd7231f1fe
Minor code simplification.
...
llvm-svn: 91653
2009-12-18 01:20:44 +00:00
Dan Gohman
b1924e8a0f
Don't pass const pointers by reference.
...
llvm-svn: 91647
2009-12-18 00:38:08 +00:00
Dan Gohman
92c3696524
Reapply LoopStrengthReduce and IVUsers cleanups, excluding the part
...
of 91296 that caused trouble -- the Processed list needs to be
preserved for the livetime of the pass, as AddUsersIfInteresting
is called from other passes.
llvm-svn: 91641
2009-12-18 00:06:20 +00:00
Evan Cheng
090ac0865a
Revert 91280-91283, 91286-91289, 91291, 91293, 91295-91296. It apparently introduced a non-deterministic behavior in the optimizer somewhere.
...
llvm-svn: 91598
2009-12-17 09:39:49 +00:00
Dan Gohman
265ce318b8
Delete an unused function.
...
llvm-svn: 91432
2009-12-15 16:30:09 +00:00
Dan Gohman
fbeec7270c
Fix a thinko; isNotAlreadyContainedIn had a built-in negative, so the
...
condition was inverted when the code was converted to contains().
llvm-svn: 91295
2009-12-14 17:31:01 +00:00
Dan Gohman
416d5b7361
Remove unnecessary #includes.
...
llvm-svn: 91293
2009-12-14 17:19:06 +00:00
Dan Gohman
163fb26927
Instead of having a ScalarEvolution pointer member in BasedUser, just pass
...
the ScalarEvolution pointer into the functions which need it.
llvm-svn: 91289
2009-12-14 17:12:51 +00:00
Dan Gohman
8dbd4e3d16
Don't bother cleaning up if there's nothing to clean up.
...
llvm-svn: 91288
2009-12-14 17:10:44 +00:00
Dan Gohman
88c7e61c5b
Delete an unused variable.
...
llvm-svn: 91287
2009-12-14 17:08:09 +00:00
Dan Gohman
838f604543
LSR itself doesn't need LoopInfo.
...
llvm-svn: 91283
2009-12-14 17:02:34 +00:00
Dan Gohman
273e692952
LSR itself doesn't need DominatorTree.
...
llvm-svn: 91282
2009-12-14 16:57:08 +00:00