Chris Lattner
bbab417e32
Add some simple folds that occur in bitfield cases. Fix a minor bug in
...
isHighOnes, where it would consider 0 to have high ones.
llvm-svn: 22693
2005-08-07 07:03:10 +00:00
Chris Lattner
427319ff4b
Fix typoCVS: ----------------------------------------------------------------------
...
llvm-svn: 22692
2005-08-07 07:00:52 +00:00
Chris Lattner
fdb467b18d
add a small simplification that can be exposed after promotion/expansion
...
llvm-svn: 22691
2005-08-07 05:00:44 +00:00
Chris Lattner
5b499da0a7
* Use the new PHINode::hasConstantValue method to simplify some code
...
* Teach this code to move allocas out of the loop when tail call eliminating
a call marked 'tail'. This implements TailCallElim/move_alloca_for_tail_call.ll
* Do not perform this transformation if a call is marked 'tail' and if there
are allocas that we cannot move out of the loop in #2 . Doing so would increase
the stack usage of the function. This implements fixes
PR615 and TailCallElim/dont-tce-tail-marked-call.ll.
llvm-svn: 22690
2005-08-07 04:27:41 +00:00
Chris Lattner
d48157e204
New testcases for PR615
...
llvm-svn: 22689
2005-08-07 04:25:39 +00:00
Chris Lattner
93820f4ad7
Consolidate the GPOpt stuff to all use the Subtarget, instead of still
...
depending on the command line option. Now the command line option just
sets the subtarget as appropriate. G5 opts will now default to on on
G5-enabled nightly testers among other machines.
llvm-svn: 22688
2005-08-05 22:05:03 +00:00
Chris Lattner
07af090121
adjust to change in getSubtarget() api
...
llvm-svn: 22687
2005-08-05 21:54:27 +00:00
Chris Lattner
feb0442901
Since getSubtarget() always provides a const Subtarget, dont' require the user
...
to pass it in. Also, since it always returns a non-null pointer, make it
return a reference instead for easier use.
llvm-svn: 22686
2005-08-05 21:53:21 +00:00
Chris Lattner
79095d3416
Enable gp optimizations by default when available, even when a target triple
...
is available, since the target triple doesn't specify whether to use gpopts
or not.
llvm-svn: 22685
2005-08-05 21:25:13 +00:00
Chris Lattner
19959252ea
teach TestRunner about prcontext
...
llvm-svn: 22683
2005-08-05 19:48:29 +00:00
Chris Lattner
ac433422c5
two simple testcases loopreduce should handle but does not yet currently
...
llvm-svn: 22682
2005-08-05 19:47:39 +00:00
Chris Lattner
d82395fc04
add a note
...
llvm-svn: 22681
2005-08-05 19:18:32 +00:00
Chris Lattner
d3a8084e5b
Change FindEarliestCallSeqEnd (used by libcall insertion) to use a set to
...
avoid revisiting nodes more than once. This eliminates a source of
potentially exponential behavior. For a small function in 191.fma3d
(hexah_stress_divergence_), this speeds up isel from taking > 20mins to
taking 0.07s.
llvm-svn: 22680
2005-08-05 18:10:27 +00:00
Chris Lattner
c7a67abac2
Fix a use-of-dangling-pointer bug, from the introduction of SrcValue's.
...
llvm-svn: 22679
2005-08-05 16:55:31 +00:00
Chris Lattner
644edfb51e
Fix a latent bug in the libcall inserter that was exposed by Nate's patch
...
yesterday. This fixes whetstone and a bunch of programs in the External tests.
llvm-svn: 22678
2005-08-05 16:23:57 +00:00
Chris Lattner
852038daec
don't crash when running the PPC backend on non-ppc hosts without specifying
...
a subtarget.
llvm-svn: 22677
2005-08-05 16:17:22 +00:00
Chris Lattner
fbcacf822a
PHINode::hasConstantValue should never return the PHI itself, even if the
...
PHI is its only operand.
llvm-svn: 22676
2005-08-05 15:37:31 +00:00
Chris Lattner
b80ff334d8
Fix an iterator invalidation problem when we decide a phi has a constant value
...
llvm-svn: 22675
2005-08-05 15:34:10 +00:00
Chris Lattner
547cf56441
Make sure to clean CastedPointers after casts are potentially deleted.
...
This fixes LSR crashes on 301.apsi, 191.fma3d, and 189.lucas
llvm-svn: 22673
2005-08-05 01:30:11 +00:00
Chris Lattner
6fa790692f
now that hasConstantValue defaults to only returning values that dominate
...
the PHI node, this ugly code can vanish.
llvm-svn: 22672
2005-08-05 01:04:30 +00:00
Chris Lattner
f112b97227
Invoke instructions do not dominate all successors
...
llvm-svn: 22671
2005-08-05 01:03:27 +00:00
Chris Lattner
4a3dc26192
Now that hasConstantValue is more careful w.r.t. returning values that only
...
dominate the PHI node, this code can go away. This also makes passes more
aggressive, e.g. implementing Transforms/CondProp/phisimplify2.ll
llvm-svn: 22670
2005-08-05 01:02:04 +00:00
Chris Lattner
f9aa29ef5c
Use the bool argument to hasConstantValue to decide whether the client is
...
prepared to deal with return values that do not dominate the PHI. If we
cannot prove that the result dominates the PHI node, do not return it if
the client can't cope.
llvm-svn: 22669
2005-08-05 01:00:58 +00:00
Chris Lattner
fe680add54
new testcase that condprop should handle. The PHI node becomes useless
...
after threading the branch, because both operands are the same value.
llvm-svn: 22668
2005-08-05 00:59:55 +00:00
Chris Lattner
915053ba79
This code can handle non-dominating instructions
...
llvm-svn: 22667
2005-08-05 00:57:45 +00:00
Chris Lattner
752c3e7b35
Mark hasConstantValue as a const method
...
llvm-svn: 22666
2005-08-05 00:49:06 +00:00
Nate Begeman
7547f4085b
Add an extra parameter that Chris requested
...
llvm-svn: 22665
2005-08-04 23:50:43 +00:00
Nate Begeman
ef41400067
Fix a fixme in CondPropagate.cpp by moving a PhiNode optimization into
...
BasicBlock's removePredecessor routine. This requires shuffling around
the definition and implementation of hasContantValue from Utils.h,cpp into
Instructions.h,cpp
llvm-svn: 22664
2005-08-04 23:24:19 +00:00
Chris Lattner
f0b47e8fcc
add a testcase nate requested
...
llvm-svn: 22663
2005-08-04 22:49:32 +00:00
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
1800405b3d
This should not run lli, that is for llvm-test.
...
llvm-svn: 22656
2005-08-04 19:56:35 +00:00
Chris Lattner
bc93ac834b
None of these tests should require a working lli, they are codegen tests,
...
not execution tests.
llvm-svn: 22655
2005-08-04 19:55:39 +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
Chris Lattner
229765dee9
This testcase now passes
...
llvm-svn: 22651
2005-08-04 19:08:07 +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
4058094dce
this is not implemented by lsr yet
...
llvm-svn: 22642
2005-08-04 01:18:48 +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