1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

455 Commits

Author SHA1 Message Date
Owen Anderson
f8addbb0a1 Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Dan Gohman
de662ad8b0 Don't merge uses when they are targetting fixup sites with
different widths. In a use with a narrower fixup, formulae
may be wider than the fixup, in which case the high bits
aren't necessarily meaningful, so it isn't safe to reuse
them for uses with wider fixups.

This fixes PR7618, though the testcase is too large for a
reasonable regression test, since it heavily dependes on
hitting LSR's heuristics in a certain way.

llvm-svn: 108455
2010-07-15 20:24:58 +00:00
Dan Gohman
3c5c24ac18 Use dbgs() instead of errs() in a DEBUG.
llvm-svn: 108453
2010-07-15 20:12:42 +00:00
Dan Gohman
d75ba463e0 Watch out for a constant offset cancelling out a base register, forming
a zero. This situation arrises in Fortran code with induction variables
that start at 1 instead of 0. This fixes PR7651.

llvm-svn: 108424
2010-07-15 15:14:45 +00:00
Gabor Greif
abeab11279 use getArgOperand instead of getOperand
llvm-svn: 107270
2010-06-30 09:15:28 +00:00
Dan Gohman
bf52a2b872 In GenerateReassociations, don't bother thinking about individual
SCEVUnknown values which are loop-variant, as LSR can't do anything
interesting with these values in any case. This fixes very slow compile
times on loops which have large numbers of such values.

llvm-svn: 106897
2010-06-25 22:32:18 +00:00
Dan Gohman
dc46a52b6a A few minor micro-optimizations.
llvm-svn: 106764
2010-06-24 16:57:52 +00:00
Dan Gohman
006947c4da Teach getExactSDiv to evaluate x/1 to x up front, as it's a common
enough special case, and it theoretically allows more folding because
it works even when x is unanalyzable.

llvm-svn: 106763
2010-06-24 16:51:25 +00:00
Dan Gohman
bb9ce7fbcd Fix copy+pasto issues in isMulSExtable.
llvm-svn: 106759
2010-06-24 16:45:11 +00:00
Dan Gohman
2ac2a33a1b Fix OptimizeMax to handle an odd case where one of the max operands
is another max which folds. This fixes PR7454.

llvm-svn: 106594
2010-06-22 23:07:13 +00:00
Dan Gohman
6a3c46ad49 Use A.append(...) instead of A.insert(A.end(), ...) when A is a
SmallVector, and other SmallVector simplifications.

llvm-svn: 106452
2010-06-21 19:47:52 +00:00
Dan Gohman
565876f980 Add a TODO comment.
llvm-svn: 106397
2010-06-19 21:30:18 +00:00
Dan Gohman
fcb0f1936b Include the use kind along with the expression in the key of the
use sharing map. The reconcileNewOffset logic already forces a
separate use if the kinds differ, so incorporating the kind in the
key means we can track more sharing opportunities.

More sharing means fewer total uses to track, which means smaller
problem sizes, which means the conservative throttles don't kick
in as often.

llvm-svn: 106396
2010-06-19 21:29:59 +00:00
Dan Gohman
5d3629eaa0 Don't include things in anonymous namespaces that don't need it.
llvm-svn: 106395
2010-06-19 21:21:39 +00:00
Dan Gohman
17ad6b5d21 Don't track users of undef values; they aren't interesting for
register pressure.

llvm-svn: 105501
2010-06-04 23:16:05 +00:00
Dan Gohman
3274120902 DominatorTree.getNode can return null for unreachable blocks.
llvm-svn: 104290
2010-05-20 22:46:54 +00:00
Dan Gohman
b841e5c433 Minor code cleanups.
llvm-svn: 104287
2010-05-20 22:25:20 +00:00
Dan Gohman
06b35689ec Make Solve check its own post-condition, to reduce clutter in the
top-level LSRInstance logic.

llvm-svn: 104278
2010-05-20 20:59:23 +00:00
Dan Gohman
2702e3105d Add comments.
llvm-svn: 104276
2010-05-20 20:52:00 +00:00
Dan Gohman
5f16e1b2cb More code cleanups. Use iterators instead of indices when indices
aren't needed.

llvm-svn: 104273
2010-05-20 20:33:18 +00:00
Dan Gohman
aa116e0758 Fix OptimizeShadowIV to set Changed. Change OptimizeLoopTermCond to set
Changed directly instead of using a return value.

Rename FilterOutUndesirableDedicatedRegisters's Changed variable to
distinguish it from LSRInstance's Changed member.

llvm-svn: 104269
2010-05-20 20:05:31 +00:00
Dan Gohman
ad77b290d0 Add some comments.
llvm-svn: 104268
2010-05-20 20:00:41 +00:00
Dan Gohman
b08c4f5ab9 Simplify this code. Don't do a DomTreeNode lookup for each visited block.
llvm-svn: 104267
2010-05-20 20:00:25 +00:00
Dan Gohman
86f6190fc2 Minor code cleanups.
llvm-svn: 104263
2010-05-20 19:44:23 +00:00
Dan Gohman
89f64e13fe When canonicalizing icmp operand order to put the loop invariant
operand on the left, the interesting operand is on the right. This
fixes a bug where LSR was failing to recognize ICmpZero uses,
which led it to be unable to reverse the induction variable in the
attached testcase.

Delete test/CodeGen/X86/stack-color-with-reg-2.ll, because its test
is extremely fragile and hard to meaningfully update.

llvm-svn: 104262
2010-05-20 19:26:52 +00:00
Dan Gohman
75ee6c3611 Set Changed to true when canonicalizing ICmp operand order; even though
it isn't a very interesting change, it's a change nonetheless.

llvm-svn: 104260
2010-05-20 19:16:03 +00:00
Dan Gohman
af66103d32 Rename a variable to avoid shadowing.
llvm-svn: 104234
2010-05-20 16:41:11 +00:00
Dan Gohman
db5be4dfc7 Minor code simplification.
llvm-svn: 104232
2010-05-20 16:23:28 +00:00
Dan Gohman
139527105c Move the code for deleting BaseRegs and LSRUses into helper functions,
and fix a bug that valgrind noticed where the code would std::swap an
element with itself.

llvm-svn: 104225
2010-05-20 15:17:54 +00:00
Dan Gohman
772b731ca5 Teach LSR how to cope better with unrolled loops on targets where
the addressing modes don't make this trivially easy. This allows
it to avoid falling into the less precise heuristics in more
cases.

llvm-svn: 104186
2010-05-19 23:43:12 +00:00
Dan Gohman
cdb7b1c110 Add a comment.
llvm-svn: 104089
2010-05-18 23:55:57 +00:00
Dan Gohman
d81303e044 Fix the predicate which checks for non-sensical formulae which have
constants in registers which partially cancel out their immediate fields.

llvm-svn: 104088
2010-05-18 23:48:08 +00:00
Dan Gohman
3a470a6b6c Factor out the code for recomputing an LSRUse's Regs set after some
of its formulae have been removed into a helper function, and also
teach it how to update the RegUseTracker.

llvm-svn: 104087
2010-05-18 23:42:37 +00:00
Dan Gohman
a58ace4036 Factor out code for estimating search space complexity into a helper
function.

llvm-svn: 104082
2010-05-18 22:51:59 +00:00
Dan Gohman
60d6263fde Add some more debug output.
llvm-svn: 104080
2010-05-18 22:41:32 +00:00
Dan Gohman
22ae418189 Factor out the code for deleting a formula from an LSRUse into
a helper function.

llvm-svn: 104079
2010-05-18 22:39:15 +00:00
Dan Gohman
9c986cbbe9 Make some debug output more informative.
llvm-svn: 104078
2010-05-18 22:37:37 +00:00
Dan Gohman
2a14bbdf13 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
649a99b8e8 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
2f2491405a Fixes for Microsoft Visual Studio 2010, from Steven Watanabe!
llvm-svn: 103457
2010-05-11 06:17:44 +00:00
Dan Gohman
4ca74b9c6c 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
2f27d59870 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
42337e0ee9 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
38949c2f1f 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
e52396cb52 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
2f18a9f7d0 Delete this code, which is no longer needed.
llvm-svn: 101033
2010-04-12 08:00:22 +00:00
Dan Gohman
67e02ffd79 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
2ea51b7464 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
5ff28f586e 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
c33ea94108 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