Dan Gohman
06ab08f795
Print an error message in Formula::print if the HasBaseReg flag
...
is inconsistent with the BaseRegs field. It's not print's job to
assert on an invalid condition, but it can make one more obvious.
llvm-svn: 104077
2010-05-18 22:35:55 +00:00
Dan Gohman
248c41d108
Rename RegUseTracker's RegUses member to RegUsesMap to avoid
...
confusion with LSRInstance's RegUses member.
llvm-svn: 104076
2010-05-18 22:33:00 +00:00
Douglas Gregor
6739a89117
Fixes for Microsoft Visual Studio 2010, from Steven Watanabe!
...
llvm-svn: 103457
2010-05-11 06:17:44 +00:00
Dan Gohman
d0800241d2
When pruning candidate formulae out of an LSRUse, update the
...
LSRUse's Regs set after all pruning is done, rather than trying
to do it on the fly, which can produce an incomplete result.
This fixes a case where heuristic pruning was stripping all
formulae from a use, which led the solver to enter an infinite
loop.
Also, add a few asserts to diagnose this kind of situation.
llvm-svn: 103328
2010-05-07 23:36:59 +00:00
Dan Gohman
1d2ded75e2
Use getConstant instead of getIntegerSCEV. The two are basically the
...
same, now that getConstant has overloads consistent with ConstantInt::get.
llvm-svn: 102965
2010-05-03 22:09:21 +00:00
Dan Gohman
534ba376f6
Generalize LSR's OptimizeMax to handle the new kinds of max expressions
...
that indvars may use, now that indvars is recognizing le and ge loops.
llvm-svn: 102235
2010-04-24 03:13:44 +00:00
Dan Gohman
997bbc54d6
Fix LSR to tolerate cases where ScalarEvolution initially
...
misses an opportunity to fold add operands, but folds them
after LSR has separated them out. This fixes rdar://7886751.
llvm-svn: 102157
2010-04-23 01:55:05 +00:00
Dan Gohman
e637ff5e9a
Remove the Expr member from IVUsers. Instead of remembering the expression,
...
just ask ScalarEvolution for it on demand. This helps IVUsers be more robust
in the case of expressions changing underneath it. This fixes PR6862.
llvm-svn: 101819
2010-04-19 21:48:58 +00:00
Dan Gohman
27c8e79839
Delete this code, which is no longer needed.
...
llvm-svn: 101033
2010-04-12 08:00:22 +00:00
Dan Gohman
607e02b33a
When determining a canonical insert position, don't climb deeper
...
into adjacent loops. Also, ensure that the insert position is
dominated by the loop latch of any loop in the post-inc set which
has a latch.
llvm-svn: 100906
2010-04-09 22:07:05 +00:00
Dan Gohman
42ec4eb351
When looking for loop-invariant users, look through no-op instructions,
...
so that an unfortunately placed bitcast doesn't pin a value in a
register.
llvm-svn: 100883
2010-04-09 19:12:34 +00:00
Dan Gohman
d2df643ddb
Refactor the code for computing the insertion point for an expression into
...
a separate function.
llvm-svn: 100845
2010-04-09 02:00:38 +00:00
Dan Gohman
9b5d0bb774
Avoid allocating a value of zero in a register if the initial formula
...
inputs happen to negate each other.
llvm-svn: 100828
2010-04-08 23:36:27 +00:00
Dan Gohman
4ce1fb1448
Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.
...
llvm-svn: 100824
2010-04-08 23:03:40 +00:00
Dan Gohman
4506539d84
When expanding expressions which are using post-inc mode for multiple loops,
...
ensure that the expansion is dominated by the increments of those loops.
llvm-svn: 100748
2010-04-08 05:57:57 +00:00
Dan Gohman
d006ab90dd
Generalize IVUsers to track arbitrary expressions rather than expressions
...
explicitly split into stride-and-offset pairs. Also, add the
ability to track multiple post-increment loops on the same expression.
This refines the concept of "normalizing" SCEV expressions used for
to post-increment uses, and introduces a dedicated utility routine for
normalizing and denormalizing expressions.
This fixes the expansion of expressions which are post-increment users
of more than one loop at a time. More broadly, this takes LSR another
step closer to being able to reason about more than one loop at a time.
llvm-svn: 100699
2010-04-07 22:27:08 +00:00
Dan Gohman
d42e09d91e
Ignore debug intrinsics in yet more places.
...
llvm-svn: 99580
2010-03-26 00:33:27 +00:00
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