Commit Graph

4174 Commits

Author SHA1 Message Date
Dan Gohman
43ef3fbae1 Remember that the induction variable is always a PHINode and
use getIncomingValueForBlock instead of
LoopInfo::getCanonicalInductionVariableIncrement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 17:18:52 +00:00
Dan Gohman
1e381fcd55 Reorder the contents of various getAnalysisUsage functions, eliminating
a redundant loopsimplify run from the default -O2 sequence.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 17:58:45 +00:00
Gabor Greif
a6aac4c5bc eliminate CallInst::ArgOffset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108522 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-16 09:38:02 +00:00
Dan Gohman
a9db129730 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 20:24:58 +00:00
Dan Gohman
ef4308d6ba Use dbgs() instead of errs() in a DEBUG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108453 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 20:12:42 +00:00
Dan Gohman
c88c1a4581 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108424 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-15 15:14:45 +00:00
Duncan Sands
d0d3ccc827 Handle the case of a tail recursion in which the tail call is followed
by a return that returns a constant, while elsewhere in the function
another return instruction returns a different constant.  This is a
special case of accumulator recursion, so just generalize the existing
logic a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108241 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-13 15:41:41 +00:00
Gabor Greif
ee1f44fba3 cache results of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 14:10:24 +00:00
Gabor Greif
110b75aa75 cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 12:03:02 +00:00
Gabor Greif
639e9e47a2 recommit r108131 (hich has been backed out in r108135) with a fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 12:02:10 +00:00
Gabor Greif
e99e077522 back out r108131 (of TailDuplication.cpp) for now, it causes a buildbot failure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 11:32:39 +00:00
Gabor Greif
a8b9df7bd9 cache dereferenced iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108131 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 10:36:48 +00:00
Duncan Sands
3472766f9e Convert some tab stops into spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108130 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 08:16:59 +00:00
Chris Lattner
0a96144aac if jump threading is able to infer interesting values on both
the LHS and RHS of an and/or instruction, don't multiply add
known predecessor values.  This fixes the crash on testcase
from PR7498


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 00:47:34 +00:00
Duncan Sands
24080a9878 The accumulator tail recursion transform claims to work for any associative
operation, but the way it's implemented requires the operation to also be
commutative.  So add a check for commutativity (and tweak the corresponding
comments).  This makes no difference in practice since every associative
LLVM instruction is also commutative!  Here's an example to show the need
for commutativity: the accum_recursion.ll testcase calculates the factorial
function.  Before the transformation the result of a call is
  ((((1*1)*2)*3)...)*x
while afterwards it is
  (((1*x)*(x-1))...*2)*1
which clearly requires both associativity and commutativity of * to be equal
to the original.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108056 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-10 20:31:42 +00:00
Gabor Greif
7656018c22 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107976 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 15:40:10 +00:00
Gabor Greif
1d3ae029c4 cache result of operator* (found by inspection)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 14:48:08 +00:00
Gabor Greif
0814985887 cache result of operator*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107969 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-09 14:36:49 +00:00
Chris Lattner
0238f8c430 Fix the second half of PR7437: scalarrepl wasn't preserving
address spaces when SRoA'ing memcpy's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-08 00:27:05 +00:00
Nick Lewycky
10d2f4d01b Detabify this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107637 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06 03:53:43 +00:00
Dan Gohman
8c1ffae068 Don't claim to preserve AliasAnalysis. First, this is doesn't actually
have any effect, and second, deleting stores can potentially invalidate
an AliasAnalysis, and there's currently no notification for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107496 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-02 18:43:05 +00:00
Gabor Greif
8e1ebff9f1 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 12:42:43 +00:00
Gabor Greif
6e1f330c4c use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107273 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:19:23 +00:00
Gabor Greif
237e1da16a use getNumArgOperands instead of getNumOperands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:17:53 +00:00
Gabor Greif
6f14c8c7c1 use getArgOperand instead of getOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107271 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:16:16 +00:00
Gabor Greif
ad72e73136 use getArgOperand instead of getOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-30 09:15:28 +00:00
Gabor Greif
d6bf5cf641 employ CallInst::ArgOffset (for now)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107015 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 16:43:57 +00:00
Gabor Greif
19101c7585 use cached value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107000 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28 11:20:42 +00:00
Chris Lattner
1495247f51 minor cleanup to SROA: when lowering type unsafe accesses to
large integers, the first inserted value would always create
an 'or X, 0'.  Even though this is trivially zapped by
instcombine, don't bother creating this pointless instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-27 07:58:26 +00:00
Duncan Sands
d50e9e2566 Fix PR7328: when turning a tail recursion into a loop, need to preserve
the returned value after the tail call if it differs from other return
values.  The optimal thing to do would be to introduce a phi node for
the return value, but for the moment just fix the miscompile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-26 12:53:31 +00:00
Dan Gohman
3e3f15bb09 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106897 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 22:32:18 +00:00
Dale Johannesen
1784d160e4 The hasMemory argument is irrelevant to how the argument
for an "i" constraint should get lowered; PR 6309.  While
this argument was passed around a lot, this is the only
place it was used, so it goes away from a lot of other
places.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 21:55:36 +00:00
Gabor Greif
7f1d7f5779 use ArgOperand API; tighten type of handleFreeWithNonTrivialDependency to be able to use isFreeCall whithout a cast or new overload
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25 07:40:32 +00:00
Dan Gohman
2ea09e0546 A few minor micro-optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106764 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:57:52 +00:00
Dan Gohman
d42819a07b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:51:25 +00:00
Dan Gohman
473e63512a Fix copy+pasto issues in isMulSExtable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106759 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 16:45:11 +00:00
Gabor Greif
3ccbb22eaf use ArgOperand API; introduce downcasted pointers into scope to facilitate this
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 12:03:56 +00:00
Gabor Greif
aee5dc1939 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 10:42:46 +00:00
Gabor Greif
d883a9d1ed use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106730 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 10:17:17 +00:00
Gabor Greif
0a14be0693 use callsite to obtain all arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106729 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 10:04:07 +00:00
Gabor Greif
407014f9a5 use getNumArgOperands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:48:48 +00:00
Gabor Greif
de9f5452d3 use ArgOperand API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:44:01 +00:00
Devang Patel
e9916a302f Use ValueMap instead of DenseMap.
The ValueMapper used by various cloning utility maps MDNodes also.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106706 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-24 00:33:28 +00:00
Dan Gohman
caf71ab473 Fix OptimizeMax to handle an odd case where one of the max operands
is another max which folds. This fixes PR7454.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106594 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 23:07:13 +00:00
Dan Gohman
fe60104ac9 Use pre-increment instead of post-increment when the result is not used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22 15:08:57 +00:00
Dan Gohman
403a8cdda5 Use A.append(...) instead of A.insert(A.end(), ...) when A is a
SmallVector, and other SmallVector simplifications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106452 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-21 19:47:52 +00:00
Dan Gohman
74e5ef096e Add a TODO comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106397 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-19 21:30:18 +00:00
Dan Gohman
1e3121c80a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-19 21:29:59 +00:00
Dan Gohman
b6211710ac Don't include things in anonymous namespaces that don't need it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-19 21:21:39 +00:00
Dan Gohman
a52838285b Disable indvars on loops when LoopSimplify form is not available.
This fixes PR7333.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-18 01:35:11 +00:00