Commit Graph

6451 Commits

Author SHA1 Message Date
Evan Cheng
6e5dfd4bf5 Instcombine constant folding can normalize gep with negative index to index with large offset. When instcombine objsize checking transformation sees these geps where the offset seemingly point out of bound, it should just return "i don't know" rather than asserting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96825 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 23:34:00 +00:00
Bob Wilson
74175c2ca1 Erase deleted instructions from GVN's ValueTable. This fixes assertion
failures from ValueTable::verifyRemoved() when using -debug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96805 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 21:39:41 +00:00
Dan Gohman
454d26dc43 Remove unused variables and parameters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96780 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 04:11:59 +00:00
Dan Gohman
278f958c61 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96774 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 03:59:54 +00:00
Dan Gohman
2444080ca4 This cast<Instruction> is unnecessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96771 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 02:07:36 +00:00
Dan Gohman
f09b71233b Rename getSDiv to getExactSDiv to reflect its behavior in cases where
the division would have a remainder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96693 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 19:35:48 +00:00
Dan Gohman
aae01f17a6 Check for overflow when scaling up an add or an addrec for
scaled reuse.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 19:32:49 +00:00
Dale Johannesen
45a2d7d44a recommit 96626, evidence that it broke things appears
to be spurious



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 07:14:22 +00:00
Dale Johannesen
efd9e95051 Revert 96626, which causes build failure on ppc Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96653 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 01:54:37 +00:00
Dan Gohman
1b7bf18def 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 00:05:23 +00:00
Dan Gohman
aa11defd1c Indvars needs to explicitly notify ScalarEvolution when it is replacing
a loop exit value, so that if a loop gets deleted, ScalarEvolution
isn't stick holding on to dangling SCEVAddRecExprs for that loop. This
fixes PR6339.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96626 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 23:26:33 +00:00
Dan Gohman
814f2b2d19 Hoist this loop-invariant logic out of the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96614 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 21:34:02 +00:00
Dan Gohman
378c0b35a7 Delete some unneeded casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96429 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 00:42:19 +00:00
Dan Gohman
968cb939e5 Don't attempt to divide INT_MIN by -1; consider such cases to
have overflowed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96428 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 00:41:53 +00:00
Bob Wilson
ae23daf63a Rename SuccessorNumber to GetSuccessorNumber.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 21:06:42 +00:00
Dan Gohman
3a02cbcd03 Refactor rewriting for PHI nodes into a separate function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 20:25:07 +00:00
Bob Wilson
484d4a30c0 Split critical edges as needed for load PRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96378 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 19:51:59 +00:00
Bob Wilson
adb6f22671 Refactor to share code to find the position of a basic block successor in the
terminator's list of successors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96377 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 19:49:17 +00:00
Dan Gohman
7fca2294da Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96372 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 19:42:34 +00:00
Duncan Sands
1df9859c40 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 11:11:14 +00:00
Dan Gohman
c2385a0741 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96308 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 01:42:53 +00:00
Chris Lattner
37914c8e83 fix PR6305 by handling BlockAddress in a helper function
called by jump threading.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96263 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 20:47:49 +00:00
Duncan Sands
b0bc6c361d Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-15 16:12:20 +00:00
Dan Gohman
441a38993e Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96179 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 18:51:39 +00:00
Dan Gohman
6020d85c41 Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96178 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 18:51:20 +00:00
Dan Gohman
ce947366ec 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96177 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 18:50:49 +00:00
Dan Gohman
590bfe8641 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96152 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 03:21:49 +00:00
Dan Gohman
2763dfdc70 Don't attempt aggressive post-inc uses if TargetLowering is not available,
because profitability can't be sufficiently approximated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96148 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-14 02:45:21 +00:00
John McCall
6d09ab8ba2 Make LSR not crash if invoked without target lowering info, e.g. if invoked
from opt.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 23:40:16 +00:00
Eric Christopher
77ffe3b31e Fix a problem where we had bitcasted operands that gave us
odd offsets since the bitcasted pointer size and the offset pointer
size are going to be different types for the GEP vs base object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96134 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 23:38:01 +00:00
Chris Lattner
c09687bb7e remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 19:07:06 +00:00
Chris Lattner
98d5c3141e Split some code out to a helper function (FindReusablePredBB)
and add a doxygen comment.

Cache the phi entry to avoid doing tons of 
PHINode::getBasicBlockIndex calls in the common case.

On my insane testcase from re2c, this speeds up CGP from
617.4s to 7.9s (78x).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96083 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 05:35:08 +00:00
Chris Lattner
6686c6bf68 Speed up codegen prepare from 3.58s to 0.488s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 05:01:14 +00:00
Chris Lattner
277cccc58f PHINode::getBasicBlockIndex is O(n) in the number of inputs
to a PHI, avoid it in the common case where the BB occurs
in the same index for multiple phis.  This speeds up CGP on
an insane testcase from 8.35 to 3.58s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96080 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 04:24:19 +00:00
Chris Lattner
2f36ea8b74 iterate over preds using PHI information when available instead of
using pred_begin/end.  It is much faster.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96079 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 04:15:26 +00:00
Chris Lattner
3f65b5e733 speed up CGP a bit by scanning predecessors through phi operands
instead of with pred_begin/end.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 04:04:42 +00:00
Dan Gohman
9214b82c54 Fix a pruning heuristic which implicitly assumed that SmallPtrSet is
deterministically sorted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96071 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 02:06:02 +00:00
Jakob Stoklund Olesen
f0907fe590 Enable the inlinehint attribute in the Inliner.
Functions explicitly marked inline will get an inlining threshold slightly
more aggressive than the default for -O3. This means than -O3 builds are
mostly unaffected while -Os builds will be a bit bigger and faster.

The difference depends entirely on how many 'inline's are sprinkled on the
source.

In the CINT2006 suite, only these tests are significantly affected under -Os:

               Size   Time
471.omnetpp   +1.63% -1.85%
473.astar     +4.01% -6.02%
483.xalancbmk +4.60%  0.00%

Note that 483.xalancbmk runs too quickly to give useful timing results.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96066 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13 01:51:53 +00:00
Dan Gohman
68d6da1f33 Reapply 95979, a compile-time speedup, now that the bug it exposed is fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96005 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 19:35:25 +00:00
Dan Gohman
cd045c08ca Fix this code to avoid dereferencing an end() iterator in
offset distributions it doesn't expect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96002 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 19:20:37 +00:00
Chris Lattner
c3b6ffc431 1. modernize the constantmerge pass, using densemap/smallvector.
2. don't bother trying to merge globals in non-default sections,
   doing so is quite dubious at best anyway.
3. fix a bug reported by Arnaud de Grandmaison where we'd try to
   merge two globals in different address spaces.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95995 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 18:17:23 +00:00
Daniel Dunbar
ae08625085 Revert "Reverse the order for collecting the parts of an addrec. The order", it
is breaking llvm-gcc bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95988 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 17:27:08 +00:00
Dan Gohman
f21a2f15aa 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 11:08:26 +00:00
Dan Gohman
572645cf84 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95975 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 10:34:29 +00:00
Eric Christopher
dfdddd8ed6 Make sure that ConstantExpr offsets also aren't off of extern
symbols.

Thanks to Duncan Sands for the testcase!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95877 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 17:44:04 +00:00
Chris Lattner
8c5ad3a5da Rename ValueRequiresCast to ShouldOptimizeCast, to better reflect
what it does.  Enhance it to return false to optimizing vector
sign extensions from vector comparisions, which is the idiom used
to get a splatted vector for a vector comparison.

Doing this breaks vector-casts.ll, add some compensating 
transformations to handle the important case they cover without
depending on this canonicalization.

This fixes rdar://7434900 a serious pessimization of vector compares.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 06:26:33 +00:00
Chris Lattner
98df4f9cf2 Make DSE only scan blocks that are reachable from the entry
block.  Other blocks may have pointer cycles that will crash
basicaa and other alias analyses.  In any case, there is no
point wasting cycles optimizing dead blocks.  This fixes 
rdar://7635088


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95852 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 05:11:54 +00:00
Chris Lattner
1e452650c6 Make jump threading honor x|undef -> true and x&undef -> false,
instead of considering x|undef -> x, which may not be true.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95850 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 04:40:44 +00:00
Eric Christopher
26d0e892e3 Add ConstantExpr handling to Intrinsic::objectsize lowering.
Update testcase accordingly now that we can optimize another
section.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 01:48:54 +00:00
Devang Patel
be905e26f6 Ignore dbg info intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 00:20:49 +00:00