Chris Lattner
855cfc4e90
Modify how immediates are removed from base expressions to deal with the fact
...
that the symbolic evaluator is not always able to use subtraction to remove
expressions. This makes the code faster, and fixes the last crash on 178.galgel.
Finally, add a statistic to see how many phi nodes are inserted.
On 178.galgel, we get the follow stats:
2562 loop-reduce - Number of PHIs inserted
3927 loop-reduce - Number of GEPs strength reduced
llvm-svn: 22662
2005-08-04 22:34:05 +00:00
Nate Begeman
348caa49b3
Fix a fixme in LegalizeDAG
...
llvm-svn: 22661
2005-08-04 21:43:28 +00:00
Nate Begeman
c76ffa6717
Hack to naturally align doubles in the constant pool. Remove this once we
...
know what The Right Thing To Do is.
llvm-svn: 22660
2005-08-04 21:04:09 +00:00
Nate Begeman
84d0a2806a
Use the new subtarget support to automatically choose the correct ABI
...
and asm printer for PowerPC if one is not specified.
llvm-svn: 22659
2005-08-04 20:49:48 +00:00
Chris Lattner
07466ea612
* Refactor some code into a new BasedUser::RewriteInstructionToUseNewBase
...
method.
* Fix a crash on 178.galgel, where we would insert expressions before PHI
nodes instead of into the PHI node predecessor blocks.
llvm-svn: 22657
2005-08-04 20:03:32 +00:00
Chris Lattner
c4beaec288
Fix a case that caused this to crash on 178.galgel
...
llvm-svn: 22653
2005-08-04 19:26:19 +00:00
Chris Lattner
5a0587224a
Teach LSR about loop-variant expressions, such as loops like this:
...
for (i = 0; i < N; ++i)
A[i][foo()] = 0;
here we still want to strength reduce the A[i] part, even though foo() is
l-v.
This also simplifies some of the 'CanReduce' logic.
This implements Transforms/LoopStrengthReduce/ops_after_indvar.ll
llvm-svn: 22652
2005-08-04 19:08:16 +00:00
Nate Begeman
0ab0a0f72d
Remove some more dead code.
...
llvm-svn: 22650
2005-08-04 18:13:56 +00:00
Chris Lattner
f63b85d9c2
Refactor this code substantially with the following improvements:
...
1. We only analyze instructions once, guaranteed
2. AnalyzeGetElementPtrUsers has been ripped apart and replaced with
something much simpler.
The next step is to handle expressions that are not all indvar+loop-invariant
values (e.g. handling indvar+loopvariant).
llvm-svn: 22649
2005-08-04 17:40:30 +00:00
Andrew Lenharth
bf363b1165
No, IDEFs shouldn't be JITed
...
llvm-svn: 22648
2005-08-04 15:32:36 +00:00
Misha Brukman
8b8272b648
* Unbreak release build
...
* Add comments to #endif pragmas for readability
llvm-svn: 22647
2005-08-04 14:22:41 +00:00
Misha Brukman
e094f6c611
* Unbreak optimized build (noticed by Eric van Riet Paap)
...
* Comment #endif clauses for readability
llvm-svn: 22646
2005-08-04 14:16:48 +00:00
Nate Begeman
09997f1012
Add Subtarget support to PowerPC. Next up, using it.
...
llvm-svn: 22644
2005-08-04 07:12:09 +00:00
Chris Lattner
ea82ef5db1
refactor some code
...
llvm-svn: 22643
2005-08-04 01:19:13 +00:00
Chris Lattner
09241be4c7
invert to if's to make the logic simpler
...
llvm-svn: 22641
2005-08-04 00:40:47 +00:00
Chris Lattner
df7961ec73
When processing outer loops and we find uses of an IV in inner loops, make
...
sure to handle the use, just don't recurse into it.
This permits us to generate this code for a simple nested loop case:
.LBB_foo_0: ; entry
stwu r1, -48(r1)
stw r29, 44(r1)
stw r30, 40(r1)
mflr r11
stw r11, 56(r1)
lis r2, ha16(L_A$non_lazy_ptr)
lwz r30, lo16(L_A$non_lazy_ptr)(r2)
li r29, 1
.LBB_foo_1: ; no_exit.0
bl L_bar$stub
li r2, 1
or r3, r30, r30
.LBB_foo_2: ; no_exit.1
lfd f0, 8(r3)
stfd f0, 0(r3)
addi r4, r2, 1
addi r3, r3, 8
cmpwi cr0, r2, 100
or r2, r4, r4
bne .LBB_foo_2 ; no_exit.1
.LBB_foo_3: ; loopexit.1
addi r30, r30, 800
addi r2, r29, 1
cmpwi cr0, r29, 100
or r29, r2, r2
bne .LBB_foo_1 ; no_exit.0
.LBB_foo_4: ; return
lwz r11, 56(r1)
mtlr r11
lwz r30, 40(r1)
lwz r29, 44(r1)
lwz r1, 0(r1)
blr
instead of this:
_foo:
.LBB_foo_0: ; entry
stwu r1, -48(r1)
stw r28, 44(r1) ;; uses an extra register.
stw r29, 40(r1)
stw r30, 36(r1)
mflr r11
stw r11, 56(r1)
li r30, 1
li r29, 0
or r28, r29, r29
.LBB_foo_1: ; no_exit.0
bl L_bar$stub
mulli r2, r28, 800 ;; unstrength-reduced multiply
lis r3, ha16(L_A$non_lazy_ptr) ;; loop invariant address computation
lwz r3, lo16(L_A$non_lazy_ptr)(r3)
add r2, r2, r3
mulli r4, r29, 800 ;; unstrength-reduced multiply
addi r3, r3, 8
add r3, r4, r3
li r4, 1
.LBB_foo_2: ; no_exit.1
lfd f0, 0(r3)
stfd f0, 0(r2)
addi r5, r4, 1
addi r2, r2, 8 ;; multiple stride 8 IV's
addi r3, r3, 8
cmpwi cr0, r4, 100
or r4, r5, r5
bne .LBB_foo_2 ; no_exit.1
.LBB_foo_3: ; loopexit.1
addi r28, r28, 1 ;;; Many IV's with stride 1
addi r29, r29, 1
addi r2, r30, 1
cmpwi cr0, r30, 100
or r30, r2, r2
bne .LBB_foo_1 ; no_exit.0
.LBB_foo_4: ; return
lwz r11, 56(r1)
mtlr r11
lwz r30, 36(r1)
lwz r29, 40(r1)
lwz r28, 44(r1)
lwz r1, 0(r1)
blr
llvm-svn: 22640
2005-08-04 00:14:11 +00:00
Chris Lattner
8b1b7c9e7d
Teach loop-reduce to see into nested loops, to pull out immediate values
...
pushed down by SCEV.
In a nested loop case, this allows us to emit this:
lis r3, ha16(L_A$non_lazy_ptr)
lwz r3, lo16(L_A$non_lazy_ptr)(r3)
add r2, r2, r3
li r3, 1
.LBB_foo_2: ; no_exit.1
lfd f0, 8(r2) ;; Uses offset of 8 instead of 0
stfd f0, 0(r2)
addi r4, r3, 1
addi r2, r2, 8
cmpwi cr0, r3, 100
or r3, r4, r4
bne .LBB_foo_2 ; no_exit.1
instead of this:
lis r3, ha16(L_A$non_lazy_ptr)
lwz r3, lo16(L_A$non_lazy_ptr)(r3)
add r2, r2, r3
addi r3, r3, 8
li r4, 1
.LBB_foo_2: ; no_exit.1
lfd f0, 0(r3)
stfd f0, 0(r2)
addi r5, r4, 1
addi r2, r2, 8
addi r3, r3, 8
cmpwi cr0, r4, 100
or r4, r5, r5
bne .LBB_foo_2 ; no_exit.1
llvm-svn: 22639
2005-08-03 23:44:42 +00:00
Chris Lattner
512f74d445
improve debug output
...
llvm-svn: 22638
2005-08-03 23:30:08 +00:00
Nate Begeman
6cd034da8e
Scalar SSE: load +0.0 -> xorps/xorpd
...
Scalar SSE: a < b ? c : 0.0 -> cmpss, andps
Scalar SSE: float -> i16 needs to be promoted
llvm-svn: 22637
2005-08-03 23:26:28 +00:00
Chris Lattner
1dcd811d36
Move from Stage 0 to Stage 1.
...
Only emit one PHI node for IV uses with identical bases and strides (after
moving foldable immediates to the load/store instruction).
This implements LoopStrengthReduce/dont_insert_redundant_ops.ll, allowing
us to generate this PPC code for test1:
or r30, r3, r3
.LBB_test1_1: ; Loop
li r2, 0
stw r2, 0(r30)
stw r2, 4(r30)
bl L_pred$stub
addi r30, r30, 8
cmplwi cr0, r3, 0
bne .LBB_test1_1 ; Loop
instead of this code:
or r30, r3, r3
or r29, r3, r3
.LBB_test1_1: ; Loop
li r2, 0
stw r2, 0(r29)
stw r2, 4(r30)
bl L_pred$stub
addi r30, r30, 8 ;; Two iv's with step of 8
addi r29, r29, 8
cmplwi cr0, r3, 0
bne .LBB_test1_1 ; Loop
llvm-svn: 22635
2005-08-03 22:51:21 +00:00
Andrew Lenharth
2865f0fe01
Alpha ABI specifies stack is always 16 byte alligned, and gcc does it, so I will too
...
llvm-svn: 22634
2005-08-03 22:33:21 +00:00
Chris Lattner
96367799a2
Rename IVUse to IVUsersOfOneStride, use a struct instead of a pair to
...
unify some parallel vectors and get field names more descriptive than
"first" and "second". This isn't lisp afterall :)
llvm-svn: 22633
2005-08-03 22:21:05 +00:00
Chris Lattner
230700ef26
Fix a nasty dangling pointer issue. The ScalarEvolution pass would keep a
...
map from instruction* to SCEVHandles. When we delete instructions, we have
to tell it about it. We would run into nasty cases where new instructions
were reallocated at old instruction addresses and get the old map values.
Bad bad bad :(
llvm-svn: 22632
2005-08-03 21:36:09 +00:00
Chris Lattner
d124203207
Fix PR611, codegen'ing SREM of FP operands to fmod or fmodf instead of
...
the sequence used for integer ops
llvm-svn: 22629
2005-08-03 20:31:37 +00:00
Chris Lattner
eee2daf85d
The correct fix for PR612, which also fixes
...
Transforms/LowerInvoke/2005-08-03-InvokeWithPHIUse.ll
llvm-svn: 22628
2005-08-03 18:51:44 +00:00
Chris Lattner
edac412122
When inserting code, make sure not to insert it before PHI nodes. This
...
fixes PR612 and Transforms/LowerInvoke/2005-08-03-InvokeWithPHI.ll
llvm-svn: 22626
2005-08-03 18:34:29 +00:00
Chris Lattner
3672ceb70b
Fix Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll, a problem that
...
occurred while bugpointing another testcase
llvm-svn: 22621
2005-08-03 17:59:45 +00:00
Chris Lattner
62b0ecdfb8
add support for Graphviz when viewing CFGs
...
llvm-svn: 22620
2005-08-03 17:55:05 +00:00
Misha Brukman
41a00bbfa6
Fix grammar: apostrophe-s ('s) is possessive, not plural; also iff vs. if.
...
llvm-svn: 22619
2005-08-03 17:29:52 +00:00
Chris Lattner
adfe9f12ef
minor capitalization thing, patch by Jim Laskey
...
llvm-svn: 22617
2005-08-03 16:52:22 +00:00
Chris Lattner
6e1d5a8b28
Finally, add the required constraint checks to fix Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll
...
the right way
llvm-svn: 22615
2005-08-03 00:59:12 +00:00
Chris Lattner
cbf4b650ba
Simplify some code, add the correct pred checks
...
llvm-svn: 22613
2005-08-03 00:38:27 +00:00
Chris Lattner
c59014baef
Refactor code out of PropagatePredecessorsForPHIs, turning it into a pure function with no side-effects
...
llvm-svn: 22612
2005-08-03 00:29:26 +00:00
Chris Lattner
0f4e0d19cc
use splice instead of remove/insert to avoid some symtab operations
...
llvm-svn: 22611
2005-08-03 00:23:42 +00:00
Chris Lattner
adbd086f50
move two functions up in the file, use SafeToMergeTerminators to eliminate
...
some duplicated code
llvm-svn: 22610
2005-08-03 00:19:45 +00:00
Chris Lattner
b9efb90e1a
Rip some code out of the main SimplifyCFG function into a subfunction and
...
call it from the only place it is live. No functionality changes.
llvm-svn: 22609
2005-08-03 00:11:16 +00:00
Chris Lattner
df31d75597
Disable this patch:
...
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050801/027345.html
This breaks real programs and only fixes an obscure regression testcase. A
real fix is in development.
llvm-svn: 22606
2005-08-02 23:31:38 +00:00
Chris Lattner
b5906d5783
Change a place to use an arbitrary value instead of null, when possible
...
llvm-svn: 22605
2005-08-02 23:29:23 +00:00
Chris Lattner
31a972dc23
one more hunk that got dropped
...
llvm-svn: 22596
2005-08-02 19:35:29 +00:00
Chris Lattner
75a8a64de4
This hunk accidentally got dropped. Patch by Jim Laskey
...
llvm-svn: 22595
2005-08-02 19:30:55 +00:00
Chris Lattner
cc8ae687e1
Update to use the new MathExtras.h support for log2 computation.
...
Patch contributed by Jim Laskey!
llvm-svn: 22594
2005-08-02 19:26:06 +00:00
Chris Lattner
d59fba1bce
Update to use the new MathExtras.h support for log2 computation.
...
Patch contributed by Jim Laskey!
llvm-svn: 22592
2005-08-02 19:16:58 +00:00
Chris Lattner
3a81e0795b
add a pass name to make debugging dumps nicer
...
llvm-svn: 22588
2005-08-02 19:07:49 +00:00
Misha Brukman
eb3ceda067
Fix grammar: it's == "it is".
...
llvm-svn: 22587
2005-08-02 16:04:59 +00:00
Chris Lattner
05431d5ca5
Like the comment says, do not insert cast instructions before phi nodes
...
llvm-svn: 22586
2005-08-02 03:31:14 +00:00
Jeff Cohen
06094b5e91
It's dangerous coding on Mondays.
...
llvm-svn: 22585
2005-08-02 03:26:32 +00:00
Chris Lattner
b8fd6a098e
This code was very close, but not quite right. It did not take into
...
consideration the case where a reference in an unreachable block could
occur. This fixes Transforms/SimplifyCFG/2005-08-01-PHIUpdateFail.ll,
something I ran into while bugpoint'ing another pass.
llvm-svn: 22584
2005-08-02 03:24:05 +00:00
Jeff Cohen
82a6b596d0
Implement SetInterruptFunction for Windows.
...
llvm-svn: 22582
2005-08-02 03:04:47 +00:00
Chris Lattner
4187b8bebe
add a comment, make a check more lenient
...
llvm-svn: 22581
2005-08-02 02:52:02 +00:00
Chris Lattner
38b0e93bd4
Simplify for loop, clear a per-loop map after processing each loop
...
llvm-svn: 22580
2005-08-02 02:44:31 +00:00