Chris Lattner [Tue, 9 Aug 2005 23:09:05 +0000 (23:09 +0000)]
Fix spelling, fix some broken canonicalizations by my last patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22734
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 23:08:53 +0000 (23:08 +0000)]
I can't believe I caught this before Misha! :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22733
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 22:30:57 +0000 (22:30 +0000)]
add a optimization note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22732
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 20:40:02 +0000 (20:40 +0000)]
add cc nodes to the AllNodes list so they show up in Graphviz output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22731
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 20:24:16 +0000 (20:24 +0000)]
Add testcases for new rlwinm cases handled, patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22730
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 20:21:10 +0000 (20:21 +0000)]
Update the targets to the new SETCC/CondCodeSDNode interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22729
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 20:20:18 +0000 (20:20 +0000)]
Eliminate the SetCCSDNode in favor of a CondCodeSDNode class. This pulls the
CC out of the SetCC operation, making SETCC a standard ternary operation and
CC's a standard DAG leaf. This will make it possible for other node to use
CC's as operands in the future...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22728
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 18:29:55 +0000 (18:29 +0000)]
Minor cleanup patch, no functionality changes. Written by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22727
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 18:08:41 +0000 (18:08 +0000)]
Fix CodeGen/Generic/div-neg-power-2.ll, a regression from last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22726
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 18:07:45 +0000 (18:07 +0000)]
new reg test for a failure last night on ppc/darwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22725
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 01:13:47 +0000 (01:13 +0000)]
SCEVAddExpr::get() of an empty list is invalid.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22724
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 00:19:44 +0000 (00:19 +0000)]
This is now implemented
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22723
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 00:18:09 +0000 (00:18 +0000)]
Implement: LoopStrengthReduce/share_ivs.ll
Two changes:
* Only insert one PHI node for each stride. Other values are live in
values. This cannot introduce higher register pressure than the
previous approach, and can take advantage of reg+reg addressing modes.
* Factor common base values out of uses before moving values from the
base to the immediate fields. This improves codegen by starting the
stride-specific PHI node out at a common place for each IV use.
As an example, we used to generate this for a loop in swim:
.LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_2: ; no_exit.7.i
lfd f0, 0(r8)
stfd f0, 0(r3)
lfd f0, 0(r6)
stfd f0, 0(r7)
lfd f0, 0(r2)
stfd f0, 0(r5)
addi r9, r9, 1
addi r2, r2, 8
addi r5, r5, 8
addi r6, r6, 8
addi r7, r7, 8
addi r8, r8, 8
addi r3, r3, 8
cmpw cr0, r9, r4
bgt .LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_1
now we emit:
.LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_2: ; no_exit.7.i
lfdx f0, r8, r2
stfdx f0, r9, r2
lfdx f0, r5, r2
stfdx f0, r7, r2
lfdx f0, r3, r2
stfdx f0, r6, r2
addi r10, r10, 1
addi r2, r2, 8
cmpw cr0, r10, r4
bgt .LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_1
As another more dramatic example, we used to emit this:
.LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_2: ; no_exit.1.i19
lfd f0, 8(r21)
lfd f4, 8(r3)
lfd f5, 8(r27)
lfd f6, 8(r22)
lfd f7, 8(r5)
lfd f8, 8(r6)
lfd f9, 8(r30)
lfd f10, 8(r11)
lfd f11, 8(r12)
fsub f10, f10, f11
fadd f5, f4, f5
fmul f5, f5, f1
fadd f6, f6, f7
fadd f6, f6, f8
fadd f6, f6, f9
fmadd f0, f5, f6, f0
fnmsub f0, f10, f2, f0
stfd f0, 8(r4)
lfd f0, 8(r25)
lfd f5, 8(r26)
lfd f6, 8(r23)
lfd f9, 8(r28)
lfd f10, 8(r10)
lfd f12, 8(r9)
lfd f13, 8(r29)
fsub f11, f13, f11
fadd f4, f4, f5
fmul f4, f4, f1
fadd f5, f6, f9
fadd f5, f5, f10
fadd f5, f5, f12
fnmsub f0, f4, f5, f0
fnmsub f0, f11, f3, f0
stfd f0, 8(r24)
lfd f0, 8(r8)
fsub f4, f7, f8
fsub f5, f12, f10
fnmsub f0, f5, f2, f0
fnmsub f0, f4, f3, f0
stfd f0, 8(r2)
addi r20, r20, 1
addi r2, r2, 8
addi r8, r8, 8
addi r10, r10, 8
addi r12, r12, 8
addi r6, r6, 8
addi r29, r29, 8
addi r28, r28, 8
addi r26, r26, 8
addi r25, r25, 8
addi r24, r24, 8
addi r5, r5, 8
addi r23, r23, 8
addi r22, r22, 8
addi r3, r3, 8
addi r9, r9, 8
addi r11, r11, 8
addi r30, r30, 8
addi r27, r27, 8
addi r21, r21, 8
addi r4, r4, 8
cmpw cr0, r20, r7
bgt .LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_1
we now emit:
.LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_2: ; no_exit.1.i19
lfdx f0, r21, r20
lfdx f4, r3, r20
lfdx f5, r27, r20
lfdx f6, r22, r20
lfdx f7, r5, r20
lfdx f8, r6, r20
lfdx f9, r30, r20
lfdx f10, r11, r20
lfdx f11, r12, r20
fsub f10, f10, f11
fadd f5, f4, f5
fmul f5, f5, f1
fadd f6, f6, f7
fadd f6, f6, f8
fadd f6, f6, f9
fmadd f0, f5, f6, f0
fnmsub f0, f10, f2, f0
stfdx f0, r4, r20
lfdx f0, r25, r20
lfdx f5, r26, r20
lfdx f6, r23, r20
lfdx f9, r28, r20
lfdx f10, r10, r20
lfdx f12, r9, r20
lfdx f13, r29, r20
fsub f11, f13, f11
fadd f4, f4, f5
fmul f4, f4, f1
fadd f5, f6, f9
fadd f5, f5, f10
fadd f5, f5, f12
fnmsub f0, f4, f5, f0
fnmsub f0, f11, f3, f0
stfdx f0, r24, r20
lfdx f0, r8, r20
fsub f4, f7, f8
fsub f5, f12, f10
fnmsub f0, f5, f2, f0
fnmsub f0, f4, f3, f0
stfdx f0, r2, r20
addi r19, r19, 1
addi r20, r20, 8
cmpw cr0, r19, r7
bgt .LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22722
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 22:56:21 +0000 (22:56 +0000)]
Suck the base value out of the UsersToProcess vector into the BasedUser
class to simplify the code. Fuse two loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22721
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 22:32:34 +0000 (22:32 +0000)]
Split MoveLoopVariantsToImediateField out from MoveImmediateValues. The
first is a correctness thing, and the later is an optzn thing. This also
is needed to support a future change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22720
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 8 Aug 2005 22:22:56 +0000 (22:22 +0000)]
Factor out some common code, and be smarter about when to emit load hi/lo
code sequences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22719
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 22:13:49 +0000 (22:13 +0000)]
A testcase I don't want to break in the future
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22718
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:57:27 +0000 (21:57 +0000)]
Allow tools with "consume after" options (like lli) to take more positional
opts than they take directly. Thanks to John C for pointing this problem
out to me!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22717
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:34:13 +0000 (21:34 +0000)]
Remove getImmediateForOpcode, which is now dead.
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22716
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:33:23 +0000 (21:33 +0000)]
Add new immediate handling support for mul/div.
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22715
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:30:29 +0000 (21:30 +0000)]
Add support for OR/XOR/SUB immediates that are handled with the new immediate
way. This allows ORI/ORIS pairs, for example.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22714
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:24:57 +0000 (21:24 +0000)]
Modify the ISD::AND opcode case to use new immediate constant predicates.
Includes wider support for rotate and mask cases.
Patch by Jim Laskey.
I've requested that Jim add new regression tests the newly handled cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22712
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:21:03 +0000 (21:21 +0000)]
Modify the ISD::ADD opcode case to use new immediate constant predicates.
Includes support for 32-bit constants using addi/addis.
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22711
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:12:35 +0000 (21:12 +0000)]
Modify existing support functions to use new immediate constant predicates.
Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22710
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:10:27 +0000 (21:10 +0000)]
Add support predicates for future immediate constant changes.
Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22709
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:08:09 +0000 (21:08 +0000)]
Move IsRunOfOnes to a more logical place and rename to a proper predicate form
(lowercase isXXX).
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22708
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 8 Aug 2005 20:04:52 +0000 (20:04 +0000)]
Fix JIT encoding of ppc mfocrf instruction; the operands were reversed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22707
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 19:11:57 +0000 (19:11 +0000)]
Use the new 'moveBefore' method to simplify some code. Really, which is
easier to understand? :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22706
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 17:25:38 +0000 (17:25 +0000)]
Reject command lines that have too many positional arguments passed (e.g.,
'opt x y'). This fixes PR493.
Patch contributed by Owen Anderson!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22705
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 06:25:50 +0000 (06:25 +0000)]
Not all constants are legal immediates in load/store instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22704
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 06:23:47 +0000 (06:23 +0000)]
new testcase, not implemented yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22703
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:47:49 +0000 (05:47 +0000)]
Implement LoopStrengthReduce/share_code_in_preheader.ll by having one
rewriter for all code inserted into the preheader, which is never flushed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22702
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:46:51 +0000 (05:46 +0000)]
It is better to not depend on CSE to share multiplies due to IV insertion.
This testcase checks that only one mul is present in the output code, as it
should be.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22701
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:29:51 +0000 (05:29 +0000)]
These are both implemented by a recent LSR patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22700
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:28:22 +0000 (05:28 +0000)]
Implement a simple optimization for the termination condition of the loop.
The termination condition actually wants to use the post-incremented value
of the loop, not a new indvar with an unusual base.
On PPC, for example, this allows us to compile
LoopStrengthReduce/exit_compare_live_range.ll to:
_foo:
li r2, 0
.LBB_foo_1: ; no_exit
li r5, 0
stw r5, 0(r3)
addi r2, r2, 1
cmpw cr0, r2, r4
bne .LBB_foo_1 ; no_exit
blr
instead of:
_foo:
li r2, 1 ;; IV starts at 1, not 0
.LBB_foo_1: ; no_exit
li r5, 0
stw r5, 0(r3)
addi r5, r2, 1
cmpw cr0, r2, r4
or r2, r5, r5 ;; Reg-reg copy, extra live range
bne .LBB_foo_1 ; no_exit
blr
This implements LoopStrengthReduce/exit_compare_live_range.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22699
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:21:50 +0000 (05:21 +0000)]
add new helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22698
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:21:33 +0000 (05:21 +0000)]
add a new helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22697
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 04:26:32 +0000 (04:26 +0000)]
Handle 64-bit constant exprs on 64-bit targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22696
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 20:02:04 +0000 (20:02 +0000)]
All stats are "Number of ..."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22694
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 07:03:10 +0000 (07:03 +0000)]
Add some simple folds that occur in bitfield cases. Fix a minor bug in
isHighOnes, where it would consider 0 to have high ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22693
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 07:00:52 +0000 (07:00 +0000)]
Fix typoCVS: ----------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22692
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 05:00:44 +0000 (05:00 +0000)]
add a small simplification that can be exposed after promotion/expansion
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22691
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 04:27:41 +0000 (04:27 +0000)]
* 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22690
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 04:25:39 +0000 (04:25 +0000)]
New testcases for PR615
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22689
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 22:05:03 +0000 (22:05 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22688
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 21:54:27 +0000 (21:54 +0000)]
adjust to change in getSubtarget() api
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22687
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 21:53:21 +0000 (21:53 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22686
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 21:25:13 +0000 (21:25 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22685
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 19:48:29 +0000 (19:48 +0000)]
teach TestRunner about prcontext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22683
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 19:47:39 +0000 (19:47 +0000)]
two simple testcases loopreduce should handle but does not yet currently
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22682
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 19:18:32 +0000 (19:18 +0000)]
add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22681
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 18:10:27 +0000 (18:10 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22680
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 16:55:31 +0000 (16:55 +0000)]
Fix a use-of-dangling-pointer bug, from the introduction of SrcValue's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22679
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 16:23:57 +0000 (16:23 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22678
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 16:17:22 +0000 (16:17 +0000)]
don't crash when running the PPC backend on non-ppc hosts without specifying
a subtarget.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22677
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 15:37:31 +0000 (15:37 +0000)]
PHINode::hasConstantValue should never return the PHI itself, even if the
PHI is its only operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22676
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 15:34:10 +0000 (15:34 +0000)]
Fix an iterator invalidation problem when we decide a phi has a constant value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22675
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 01:30:11 +0000 (01:30 +0000)]
Make sure to clean CastedPointers after casts are potentially deleted.
This fixes LSR crashes on 301.apsi, 191.fma3d, and 189.lucas
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22673
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 01:04:30 +0000 (01:04 +0000)]
now that hasConstantValue defaults to only returning values that dominate
the PHI node, this ugly code can vanish.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22672
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 01:03:27 +0000 (01:03 +0000)]
Invoke instructions do not dominate all successors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22671
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 01:02:04 +0000 (01:02 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22670
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 01:00:58 +0000 (01:00 +0000)]
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22669
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 00:59:55 +0000 (00:59 +0000)]
new testcase that condprop should handle. The PHI node becomes useless
after threading the branch, because both operands are the same value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22668
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 00:57:45 +0000 (00:57 +0000)]
This code can handle non-dominating instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22667
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 5 Aug 2005 00:49:06 +0000 (00:49 +0000)]
Mark hasConstantValue as a const method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22666
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 4 Aug 2005 23:50:43 +0000 (23:50 +0000)]
Add an extra parameter that Chris requested
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22665
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 4 Aug 2005 23:24:19 +0000 (23:24 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22664
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 22:49:32 +0000 (22:49 +0000)]
add a testcase nate requested
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22663
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 22:34:05 +0000 (22:34 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22662
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 4 Aug 2005 21:43:28 +0000 (21:43 +0000)]
Fix a fixme in LegalizeDAG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22661
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 4 Aug 2005 21:04:09 +0000 (21:04 +0000)]
Hack to naturally align doubles in the constant pool. Remove this once we
know what The Right Thing To Do is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22660
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 4 Aug 2005 20:49:48 +0000 (20:49 +0000)]
Use the new subtarget support to automatically choose the correct ABI
and asm printer for PowerPC if one is not specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22659
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 20:03:32 +0000 (20:03 +0000)]
* 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22657
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 19:56:35 +0000 (19:56 +0000)]
This should not run lli, that is for llvm-test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22656
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 19:55:39 +0000 (19:55 +0000)]
None of these tests should require a working lli, they are codegen tests,
not execution tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22655
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 19:26:19 +0000 (19:26 +0000)]
Fix a case that caused this to crash on 178.galgel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22653
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 19:08:16 +0000 (19:08 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22652
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 19:08:07 +0000 (19:08 +0000)]
This testcase now passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22651
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 4 Aug 2005 18:13:56 +0000 (18:13 +0000)]
Remove some more dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22650
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 17:40:30 +0000 (17:40 +0000)]
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).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22649
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Thu, 4 Aug 2005 15:32:36 +0000 (15:32 +0000)]
No, IDEFs shouldn't be JITed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22648
91177308-0d34-0410-b5e6-
96231b3b80d8
Misha Brukman [Thu, 4 Aug 2005 14:22:41 +0000 (14:22 +0000)]
* Unbreak release build
* Add comments to #endif pragmas for readability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22647
91177308-0d34-0410-b5e6-
96231b3b80d8
Misha Brukman [Thu, 4 Aug 2005 14:16:48 +0000 (14:16 +0000)]
* Unbreak optimized build (noticed by Eric van Riet Paap)
* Comment #endif clauses for readability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22646
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 4 Aug 2005 07:12:09 +0000 (07:12 +0000)]
Add Subtarget support to PowerPC. Next up, using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22644
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 01:19:13 +0000 (01:19 +0000)]
refactor some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22643
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 01:18:48 +0000 (01:18 +0000)]
this is not implemented by lsr yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22642
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 00:40:47 +0000 (00:40 +0000)]
invert to if's to make the logic simpler
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22641
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 4 Aug 2005 00:14:11 +0000 (00:14 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22640
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 23:44:42 +0000 (23:44 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22639
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 23:30:08 +0000 (23:30 +0000)]
improve debug output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22638
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Wed, 3 Aug 2005 23:26:28 +0000 (23:26 +0000)]
Scalar SSE: load +0.0 -> xorps/xorpd
Scalar SSE: a < b ? c : 0.0 -> cmpss, andps
Scalar SSE: float -> i16 needs to be promoted
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22637
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 22:51:40 +0000 (22:51 +0000)]
this now passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22636
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 22:51:21 +0000 (22:51 +0000)]
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22635
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Wed, 3 Aug 2005 22:33:21 +0000 (22:33 +0000)]
Alpha ABI specifies stack is always 16 byte alligned, and gcc does it, so I will too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22634
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 22:21:05 +0000 (22:21 +0000)]
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 :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22633
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 21:36:09 +0000 (21:36 +0000)]
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 :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22632
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 21:01:46 +0000 (21:01 +0000)]
Fix this to test the BE we care about
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22631
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 20:53:19 +0000 (20:53 +0000)]
Fix an obvious bug in the Log2 stuff that broke SingleSource/UnitTests/2005-05-12-Int64ToFP
last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22630
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 20:31:37 +0000 (20:31 +0000)]
Fix PR611, codegen'ing SREM of FP operands to fmod or fmodf instead of
the sequence used for integer ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22629
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 3 Aug 2005 18:51:44 +0000 (18:51 +0000)]
The correct fix for PR612, which also fixes
Transforms/LowerInvoke/2005-08-03-InvokeWithPHIUse.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22628
91177308-0d34-0410-b5e6-
96231b3b80d8