Dale Johannesen
904ce8120d
Clarify that the scale factor from CheckForIVReuse
...
can be negative. Keep track of whether all uses of
an IV are outside the loop. Some cosmetics; no
functional change.
llvm-svn: 61109
2008-12-16 22:16:28 +00:00
Chris Lattner
56b20ffc5f
Fix a really subtle off-by-one bug that Duncan noticed with valgrind
...
on test/CodeGen/Generic/2007-06-06-CriticalEdgeLandingPad.
llvm-svn: 60739
2008-12-09 04:47:21 +00:00
Dale Johannesen
9efd2ce55b
Make LoopStrengthReduce smarter about hoisting things out of
...
loops when they can be subsumed into addressing modes.
Change X86 addressing mode check to realize that
some PIC references need an extra register.
(I believe this is correct for Linux, if not, I'm sure
someone will tell me.)
llvm-svn: 60608
2008-12-05 21:47:27 +00:00
Dale Johannesen
4e9e6ea604
Remove an unused field.
...
llvm-svn: 60508
2008-12-03 22:43:56 +00:00
Dale Johannesen
f7a588b909
Fix a misspelled function name.
...
llvm-svn: 60506
2008-12-03 20:56:12 +00:00
Dale Johannesen
d49ceff6ba
Fix a really wrong comment.
...
llvm-svn: 60494
2008-12-03 19:25:46 +00:00
Dale Johannesen
4d2ecb8f68
Minor rewrite per review feedback.
...
llvm-svn: 60442
2008-12-02 21:17:11 +00:00
Dale Johannesen
70060013d2
Make the code do what the comment says it does.
...
llvm-svn: 60431
2008-12-02 18:40:09 +00:00
Chris Lattner
ead1a61b47
some random comment improvements.
...
llvm-svn: 60395
2008-12-02 04:52:26 +00:00
Dale Johannesen
069a4eee55
Consider only references to an IV within the loop when
...
figuring out the base of the IV. This produces better
code in the example. (Addresses use (IV) instead of
(BASE,IV) - a significant improvement on low-register
machines like x86).
llvm-svn: 60374
2008-12-01 22:00:01 +00:00
Chris Lattner
2c2dd15a85
Introduce a new array_pod_sort function and switch LSR to use it
...
instead of std::sort. This shrinks the release-asserts LSR.o file
by 1100 bytes of code on my system.
We should start using array_pod_sort where possible.
llvm-svn: 60335
2008-12-01 06:49:59 +00:00
Chris Lattner
2aebea5735
Eliminate use of setvector for the DeadInsts set, just use a smallvector.
...
This is a lot cheaper and conceptually simpler.
llvm-svn: 60332
2008-12-01 06:27:41 +00:00
Chris Lattner
4da78e3774
DeleteTriviallyDeadInstructions is always passed the
...
DeadInsts ivar, just use it directly.
llvm-svn: 60330
2008-12-01 06:14:28 +00:00
Chris Lattner
a68a5a4784
simplify DeleteTriviallyDeadInstructions again, unlike my previous
...
buggy rewrite, this notifies ScalarEvolution of a pending instruction
about to be removed and then erases it, instead of erasing it then
notifying.
llvm-svn: 60329
2008-12-01 06:11:32 +00:00
Bill Wendling
469e3aa696
Temporarily revert r60195. It's causing an optimized bootstrap of llvm-gcc to fail.
...
llvm-svn: 60233
2008-11-29 03:43:04 +00:00
Chris Lattner
c077a2a535
Simplify LoopStrengthReduce::DeleteTriviallyDeadInstructions by
...
making it use RecursivelyDeleteTriviallyDeadInstructions to do
the heavy lifting.
llvm-svn: 60195
2008-11-27 23:23:35 +00:00
Chris Lattner
96e2dbe008
use continue to reduce indentation
...
llvm-svn: 60192
2008-11-27 23:00:20 +00:00
Daniel Dunbar
7f39e2d85a
Change create*Pass factory functions to return Pass* instead of
...
LoopPass*.
- Although less precise, this means they can be used in clients
without RTTI (who would otherwise need to include LoopPass.h, which
eventually includes things using dynamic_cast). This was the
simplest solution that presented itself, but I am happy to use a
better one if available.
llvm-svn: 58010
2008-10-22 23:32:42 +00:00
Dan Gohman
67d90de2b0
Call ScalarEvolution's deleteValueFromRecords before deleting an
...
instruction, not after. This fixes some uses of free'd memory.
llvm-svn: 56908
2008-10-01 02:02:03 +00:00
Dan Gohman
68e7735a38
Teach LSR to optimize away SMAX operations for tripcounts in common
...
cases. See the comment above OptimizeSMax for the full story, and
the testcase for an example. This cancels out a pessimization
commonly attributed to indvars, and will allow us to lift some of
the artificial throttles in indvars, rather than add new ones.
llvm-svn: 56230
2008-09-15 21:22:06 +00:00
Devang Patel
92c5367705
fix overflow check.
...
llvm-svn: 56011
2008-09-09 20:54:34 +00:00
Devang Patel
7518f250b9
Remove unused counter.
...
llvm-svn: 55924
2008-09-08 17:14:54 +00:00
Devang Patel
538a7f479a
Remove OptimizeIVType()
...
llvm-svn: 55913
2008-09-08 16:13:27 +00:00
Dan Gohman
a79db30d28
Tidy up several unbeseeming casts from pointer to intptr_t.
...
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Devang Patel
bcd39345de
Add additional check to ensure that iv is canonicalized.
...
llvm-svn: 55682
2008-09-03 00:29:13 +00:00
Devang Patel
b530f08122
Check iteration count.
...
llvm-svn: 55680
2008-09-03 00:10:56 +00:00
Devang Patel
81fed043c5
While removing PHI, use basicblock to identify incoming value.
...
llvm-svn: 55678
2008-09-03 00:02:42 +00:00
Devang Patel
43c5a52e07
If all IV uses are extending integer IV then change the type of IV itself, if possible.
...
llvm-svn: 55674
2008-09-02 22:18:08 +00:00
Devang Patel
d6adbb6a0f
Do not apply the transformation if the target does not support DestTy natively.
...
llvm-svn: 55433
2008-08-27 20:55:23 +00:00
Devang Patel
cf7ca5d0ba
Fix typos and whitespaces. Other cosmetic changes based on feedback.
...
llvm-svn: 55424
2008-08-27 17:50:18 +00:00
Devang Patel
4310d39844
If IV is used in a int-to-float cast inside the loop then try to eliminate the cast operation.
...
llvm-svn: 55374
2008-08-26 17:57:54 +00:00
Evan Cheng
5dabe042a6
Revert 54821. It's miscompiling 252.eon and 447.dealII
...
llvm-svn: 54878
2008-08-17 08:07:31 +00:00
Devang Patel
f2a03d5a4b
Reapply 54786. Add overflow and number of mantissa bits checks.
...
llvm-svn: 54821
2008-08-15 21:21:34 +00:00
Evan Cheng
86834d29f3
Revert 54786. It's not checking for overflows, etc.
...
llvm-svn: 54813
2008-08-15 08:12:11 +00:00
Devang Patel
054a833dd4
If IV is used in a int-to-float cast inside the loop then try to eliminate the cast opeation.
...
llvm-svn: 54786
2008-08-14 20:58:31 +00:00
Devang Patel
6369a798ba
Rename. s/FindIVForUser/FindIVUserForCond/g
...
llvm-svn: 54754
2008-08-13 20:31:11 +00:00
Devang Patel
97387e6615
Check sign to detect overflow before changing compare stride.
...
llvm-svn: 54710
2008-08-13 02:05:14 +00:00
Evan Cheng
907dc2bc37
Fix PR2355: bug in ChangeCompareStride. When the loop termination compare is the only use of its iv stride, the stride can be eliminated by moving it to another stride. If the scale is negative, swap the predicate instead of using a inverse predicate.
...
llvm-svn: 54415
2008-08-06 18:04:43 +00:00
Dan Gohman
7ad3cd8c9d
Fix a bug in LSR's dead-PHI cleanup. If a PHI has a def-use chain that
...
leads into a cycle involving a different PHI, LSR got stuck running
around that cycle looking for the original PHI. To avoid this, keep
track of visited PHIs and stop searching if we see one more than once.
This fixes PR2570.
llvm-svn: 53879
2008-07-21 21:45:02 +00:00
Dan Gohman
162668fa78
Fix uninitialized use of the Changed variable.
...
llvm-svn: 53564
2008-07-14 17:55:01 +00:00
Evan Cheng
03001cb820
Fix two serious LSR bugs.
...
1. LSR runOnLoop is always returning false regardless if any transformation is made.
2. AddUsersIfInteresting can create new instructions that are added to DeadInsts. But there is a later early exit which prevents them from being freed.
llvm-svn: 53193
2008-07-07 19:51:32 +00:00
Dan Gohman
ac563833ae
Fix spelling and grammar in a comment.
...
llvm-svn: 52648
2008-06-23 22:11:52 +00:00
Dan Gohman
5ca5e02480
Improve LSR's dead-phi detection to handle use-def cycles
...
with more than two nodes.
llvm-svn: 52617
2008-06-22 20:44:02 +00:00
Dan Gohman
be928e3b21
Move LSR's private isZero function to a public SCEV member
...
function, and make use of it in several places.
llvm-svn: 52463
2008-06-18 16:23:07 +00:00
Dan Gohman
ab0dccba6b
Refine the change in r52258 for avoiding use-before-def conditions
...
when changing the stride of a comparison so that it's slightly
more precise, by having it scan the instruction list to determine
if there is a use of the condition after the point where the
condition will be inserted.
llvm-svn: 52371
2008-06-16 22:34:15 +00:00
Evan Cheng
319e9a4f63
Switch over to SetVector to ensure same order of iterations do not vary across runs.
...
llvm-svn: 52361
2008-06-16 21:08:17 +00:00
Evan Cheng
a72cdcd1a2
Iterating over SmallPtrSet is not deterministic.
...
llvm-svn: 52339
2008-06-16 18:17:09 +00:00
Dan Gohman
9ad8c54aab
Protect ChangeCompareStride from situations in which it is possible
...
for it to generate use-before-def IR, such as in this testcase.
llvm-svn: 52258
2008-06-13 21:43:41 +00:00
Gabor Greif
0babc61631
op_iterator-ify some loops, fix 80col violations
...
llvm-svn: 52226
2008-06-11 21:38:51 +00:00
Evan Cheng
02912418f1
Remove x86.sse2.loadh.pd and x86.sse2.loadl.pd. These will be lowered into load and shuffle instructions.
...
llvm-svn: 51521
2008-05-24 00:07:06 +00:00