Reid Spencer
c48fe0fd4d
Undo the last patch until 253.perlbmk passes with these changes.
...
llvm-svn: 31977
2006-11-28 20:23:51 +00:00
Reid Spencer
8587322e79
Remove 4 FIXME's from the CAST patch now that the back end is correctly
...
producing code for "trunc to bool". This passes all tests on Linux.
llvm-svn: 31963
2006-11-28 07:23:01 +00:00
Chris Lattner
b391cbb939
Fix PR1014 and InstCombine/2006-11-27-XorBug.ll.
...
llvm-svn: 31941
2006-11-27 19:55:07 +00:00
Reid Spencer
992d9788b3
For PR950:
...
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.
llvm-svn: 31931
2006-11-27 01:05:10 +00:00
Bill Wendling
999f49061f
Remove #include <iostream> and use llvm_* streams instead.
...
llvm-svn: 31925
2006-11-26 10:17:54 +00:00
Bill Wendling
5c13d56f78
Replace #include <iostream> with llvm_* streams.
...
llvm-svn: 31924
2006-11-26 10:02:32 +00:00
Bill Wendling
1b3a86000a
Removed #include <iostream> and replaced with llvm_* streams.
...
llvm-svn: 31923
2006-11-26 09:46:52 +00:00
Bill Wendling
f2fadcee85
Removed #include <iostream> and used the llvm_cerr/DOUT streams instead.
...
llvm-svn: 31922
2006-11-26 09:17:06 +00:00
Nick Lewycky
cd25e651c2
Update to new predicate simplifier VRP design. Fixes PR966 and PR967.
...
Remove predicate simplifier from default gcc3 pipeline. New design is too
slow to enable by default.
Add new testcases for problems encountered in development.
llvm-svn: 31895
2006-11-22 23:49:16 +00:00
Chris Lattner
632c66b8ef
This xform is handled by FoldOpIntoPhi in visitCastInst in a more elegant way.
...
llvm-svn: 31889
2006-11-21 17:05:13 +00:00
Chris Lattner
cdb67482da
Do not convert massive blocks on phi nodes into select statements. Instead
...
only do these transformations if there are a small number of phi's.
This speeds up Ptrdist/ks from 2.35s to 2.19s on my mac pro.
llvm-svn: 31853
2006-11-18 19:19:36 +00:00
Chris Lattner
cc4df7e0ab
If an indvar with a variable stride is used by the exit condition, go ahead
...
and handle it like constant stride vars. This fixes some bad codegen in
variable stride cases. For example, it compiles this:
void foo(int k, int i) {
for (k=i+i; k <= 8192; k+=i)
flags2[k] = 0;
}
to:
LBB1_1: #bb.preheader
movl %eax, %ecx
addl %ecx, %ecx
movl L_flags2$non_lazy_ptr, %edx
LBB1_2: #bb
movb $0, (%edx,%ecx)
addl %eax, %ecx
cmpl $8192, %ecx
jle LBB1_2 #bb
LBB1_5: #return
ret
or (if the array is local and we are in dynamic-nonpic or static mode):
LBB3_2: #bb
movb $0, _flags2(%ecx)
addl %eax, %ecx
cmpl $8192, %ecx
jle LBB3_2 #bb
and:
lis r2, ha16(L_flags2$non_lazy_ptr)
lwz r2, lo16(L_flags2$non_lazy_ptr)(r2)
slwi r3, r4, 1
LBB1_2: ;bb
li r5, 0
add r6, r4, r3
stbx r5, r2, r3
cmpwi cr0, r6, 8192
bgt cr0, LBB1_5 ;return
instead of:
leal (%eax,%eax,2), %ecx
movl %eax, %edx
addl %edx, %edx
addl L_flags2$non_lazy_ptr, %edx
xorl %esi, %esi
LBB1_2: #bb
movb $0, (%edx,%esi)
movl %eax, %edi
addl %esi, %edi
addl %ecx, %esi
cmpl $8192, %esi
jg LBB1_5 #return
and:
lis r2, ha16(L_flags2$non_lazy_ptr)
lwz r2, lo16(L_flags2$non_lazy_ptr)(r2)
mulli r3, r4, 3
slwi r5, r4, 1
li r6, 0
add r2, r2, r5
LBB1_2: ;bb
li r5, 0
add r7, r3, r6
stbx r5, r2, r6
add r6, r4, r6
cmpwi cr0, r7, 8192
ble cr0, LBB1_2 ;bb
This speeds up Benchmarks/Shootout/sieve from 8.533s to 6.464s and
implements LoopStrengthReduce/var_stride_used_by_compare.ll
llvm-svn: 31809
2006-11-17 06:17:33 +00:00
Chris Lattner
0a2d29b345
Fix a gcc 4.2 warning.
...
llvm-svn: 31751
2006-11-15 04:53:24 +00:00
Chris Lattner
0114b0c20e
implement InstCombine/shift-simplify.ll by transforming:
...
(X >> Z) op (Y >> Z) -> (X op Y) >> Z
for all shifts and all ops={and/or/xor}.
llvm-svn: 31729
2006-11-14 07:46:50 +00:00
Chris Lattner
616335f272
implement InstCombine/and-compare.ll:test1. This compiles:
...
typedef struct { unsigned prefix : 4; unsigned code : 4; unsigned unsigned_p : 4; } tree_common;
int foo(tree_common *a, tree_common *b) { return a->code == b->code; }
into:
_foo:
movl 4(%esp), %eax
movl 8(%esp), %ecx
movl (%eax), %eax
xorl (%ecx), %eax
# TRUNCATE movb %al, %al
shrb $4, %al
testb %al, %al
sete %al
movzbl %al, %eax
ret
instead of:
_foo:
movl 8(%esp), %eax
movb (%eax), %al
shrb $4, %al
movl 4(%esp), %ecx
movb (%ecx), %cl
shrb $4, %cl
cmpb %al, %cl
sete %al
movzbl %al, %eax
ret
saving one cycle by eliminating a shift.
llvm-svn: 31727
2006-11-14 06:06:06 +00:00
Chris Lattner
65a873caa2
Fix InstCombine/2006-11-10-ashr-miscompile.ll a miscompilation introduced
...
by the shr -> [al]shr patch. This was reduced from 176.gcc.
llvm-svn: 31653
2006-11-10 23:38:52 +00:00
Chris Lattner
4e6c828296
second patch to fix PR992/993.
...
llvm-svn: 31610
2006-11-09 23:36:08 +00:00
Chris Lattner
23d3dac40a
Minimal patch to fix PR992/PR993
...
llvm-svn: 31608
2006-11-09 23:17:45 +00:00
Chris Lattner
cd3c5f59e2
Teach ShrinkDemandedConstant how to handle X+C. This implements:
...
add.ll:test33, add.ll:test34, shift-sra.ll:test2
llvm-svn: 31586
2006-11-09 05:12:27 +00:00
Chris Lattner
d1bcd014a8
reenable factoring of GEP expressions, being more precise about the
...
case that it bad to do.
llvm-svn: 31563
2006-11-08 19:42:28 +00:00
Chris Lattner
77e0e67f23
make this code more efficient by not creating a phi node we are just going to
...
delete in the first place. This also makes it simpler.
llvm-svn: 31562
2006-11-08 19:29:23 +00:00
Jim Laskey
28fec74f1b
Remove redundant <cmath>.
...
llvm-svn: 31561
2006-11-08 19:16:44 +00:00
Chris Lattner
f2cd0aeced
disable this factoring optzn for GEPs for now, this severely pessimizes some
...
loops.
llvm-svn: 31560
2006-11-08 18:49:31 +00:00
Reid Spencer
da1f5b882a
For PR950:
...
This patch converts the old SHR instruction into two instructions,
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.
llvm-svn: 31542
2006-11-08 06:47:33 +00:00
Chris Lattner
924b2b109f
scalarrepl should not split the two elements of the vsiidx array:
...
int func(vFloat v0, vFloat v1) {
int ii;
vSInt32 vsiidx[2];
vsiidx[0] = _mm_cvttps_epi32(v0);
vsiidx[1] = _mm_cvttps_epi32(v1);
ii = ((int *) vsiidx)[4];
return ii;
}
This fixes Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll
llvm-svn: 31524
2006-11-07 22:42:47 +00:00
Jeff Cohen
e1003da1a2
Unbreak VC++ build.
...
llvm-svn: 31464
2006-11-05 19:31:28 +00:00
Nick Lewycky
8b17d79f5e
Remove commented line from earlier debugging.
...
llvm-svn: 31460
2006-11-05 14:19:40 +00:00
Andrew Lenharth
c2f822392c
The wrong parameter was being tested to deturmine i32 vs i64
...
llvm-svn: 31431
2006-11-03 22:45:50 +00:00
Chris Lattner
8f8a1ed82e
remove dead code
...
llvm-svn: 31398
2006-11-03 01:34:58 +00:00
Reid Spencer
4bafa71dc1
For PR786:
...
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.
llvm-svn: 31380
2006-11-02 20:25:50 +00:00
Reid Spencer
1abf69e923
For PR950:
...
Replace the REM instruction with UREM, SREM and FREM.
llvm-svn: 31369
2006-11-02 01:53:59 +00:00
Devang Patel
ae6d81559a
There can be more than one PHINode at the start of the block.
...
llvm-svn: 31362
2006-11-01 23:04:45 +00:00
Devang Patel
3f3161cee2
Handle PHINode with only one incoming value.
...
This fixes http://llvm.org/bugs/show_bug.cgi?id=979
llvm-svn: 31358
2006-11-01 22:26:43 +00:00
Chris Lattner
953b8e6f7d
Fix GlobalOpt/2006-11-01-ShrinkGlobalPhiCrash.ll and McGill/chomp
...
llvm-svn: 31352
2006-11-01 18:03:33 +00:00
Chris Lattner
2cedfa5156
Factor gep instructions through phi nodes.
...
llvm-svn: 31346
2006-11-01 07:43:41 +00:00
Chris Lattner
61ea2af8fe
Turn a phi of many loads into a phi of the address and a single load of the
...
result. This can significantly shrink code and exposes identities more
aggressively.
llvm-svn: 31344
2006-11-01 07:13:54 +00:00
Chris Lattner
e43c3b1681
Fix a bug in the previous patch
...
llvm-svn: 31342
2006-11-01 04:55:47 +00:00
Chris Lattner
7211110992
Fold things like "phi [add (a,b), add(c,d)]" into two phi's and one add.
...
This triggers thousands of times on multisource.
llvm-svn: 31341
2006-11-01 04:51:18 +00:00
Chris Lattner
3b7a9fa472
generalize the fix for PR977 to also fix
...
Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll
llvm-svn: 31317
2006-10-31 18:56:48 +00:00
Chris Lattner
79daf6ae80
Fix PR977 and Transforms/LCSSA/2006-10-31-UnreachableBlock.ll
...
llvm-svn: 31315
2006-10-31 17:52:18 +00:00
Chris Lattner
cc8731fef4
Fix SimplifyCFG/2006-10-29-InvokeCrash.ll, a crash compiling QT.
...
llvm-svn: 31284
2006-10-29 21:21:20 +00:00
Chris Lattner
65f872288d
add option to isCriticalEdge
...
llvm-svn: 31258
2006-10-28 06:58:17 +00:00
Chris Lattner
a1da382ad3
break edges more intelligently
...
llvm-svn: 31257
2006-10-28 06:45:33 +00:00
Chris Lattner
85bc826ca6
Expose a smarter way to break critical edges.
...
llvm-svn: 31256
2006-10-28 06:44:56 +00:00
Chris Lattner
41216d38c5
SplitCriticalEdge checks to see if an edge is critical, don't check twice
...
llvm-svn: 31255
2006-10-28 06:38:14 +00:00
Chris Lattner
93414d06c4
prepare for a change I'm about to make
...
llvm-svn: 31248
2006-10-28 00:59:20 +00:00
Reid Spencer
4665cb220d
Simplify code a bit by changing instances of:
...
InsertNewInstBefore(new CastInst(Val, ValTy, Val->GetName()), I)
into:
InsertCastBefore(Val, ValTy, I)
llvm-svn: 31204
2006-10-26 19:19:06 +00:00
Reid Spencer
6833ffe8b8
For PR950:
...
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.
llvm-svn: 31195
2006-10-26 06:15:43 +00:00
Nick Lewycky
e7580b4a17
Fix 2006-10-25-AddSetCC. A relational operator (like setlt) can never
...
produce an EQ property.
llvm-svn: 31193
2006-10-26 02:35:18 +00:00
Nick Lewycky
be9829c45f
Resurrect r1.25.
...
Fix and comment the "or", "and" and "xor" transformations.
llvm-svn: 31189
2006-10-25 23:48:24 +00:00
Chris Lattner
f4a5fcbb3a
hide symbols properly
...
llvm-svn: 31184
2006-10-25 21:14:31 +00:00
Chris Lattner
0cf64c9469
Fix Transforms/ScalarRepl/2006-10-23-PointerUnionCrash.ll
...
llvm-svn: 31151
2006-10-24 06:26:32 +00:00
Chris Lattner
d13449ed3e
Revert back to r1.21, which was the last revision of predsimplify that
...
passes llvm-gcc bootstrap.
llvm-svn: 31146
2006-10-24 00:36:21 +00:00
Chris Lattner
91e628645b
Handle fallout from the recent branch-on-undef changes. This fixes
...
Prolangs-C/agrep and SCCP/2006-10-23-IPSCCP-Crash.ll
llvm-svn: 31132
2006-10-23 18:57:02 +00:00
Nick Lewycky
6830bee9b4
Remove the Backwards operation. Resolving now works at the time when a
...
property is added by running through the list of uses of the value and
adding resolved properties to the property set.
llvm-svn: 31126
2006-10-23 01:56:02 +00:00
Nick Lewycky
25e815f0a2
Fix similar missing optimization opportunity in XOR.
...
llvm-svn: 31123
2006-10-22 22:22:58 +00:00
Nick Lewycky
5eec4941d1
Whoops! Add missing NULL check.
...
llvm-svn: 31121
2006-10-22 21:38:24 +00:00
Nick Lewycky
b81c926e06
Handle "if ((x|y) != 0)" for ints like we do for bools. Fixes missed
...
optimization opportunity pointed out by Chris Lattner.
llvm-svn: 31118
2006-10-22 21:36:41 +00:00
Nick Lewycky
c680dabd94
AllocaInst can't return a null pointer. Fixes missed optimization
...
opportunity pointed out by Andrew Lewycky.
llvm-svn: 31115
2006-10-22 19:53:27 +00:00
Chris Lattner
51e762d4cb
Add a workaround for PR962, disabling the more aggressive form of this
...
transformation. This speeds up a C++ app 2.25x.
llvm-svn: 31113
2006-10-22 18:42:26 +00:00
Chris Lattner
50b3810d9a
3 Changes:
...
1. Better document what is going on here.
2. Only hack on one branch per iteration, making the results less conservative.
3. Handle the problematic case by marking edges executable instead of by
playing with value lattice states. This is far less pessimistic, and fixes
SCCP/ipsccp-gvar.ll.
llvm-svn: 31106
2006-10-22 05:59:17 +00:00
Chris Lattner
ef1a8ce64a
llvm-extract should remove module-level asm
...
llvm-svn: 31086
2006-10-20 21:35:41 +00:00
Chris Lattner
6ea0134893
Fix an ugly problem in SCCP. This fixes Benchmarks/Misc-C++/mandel-text.cpp
...
llvm-svn: 31073
2006-10-20 20:19:08 +00:00
Chris Lattner
38ed7d9e49
Fix miscompilation of MallocBench/espresso which code review pointed out
...
but apparently didn't make it into the final patch.
llvm-svn: 31070
2006-10-20 18:20:21 +00:00
Reid Spencer
d414793dbc
For PR950:
...
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.
llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Devang Patel
b030b91f4a
While creating mask, use 1ULL instead of 1.
...
llvm-svn: 31062
2006-10-20 01:16:56 +00:00
Chris Lattner
d9aa90ded4
Fix SimplifyCFG/2006-10-19-UncondDiv.ll by disabling a bad xform.
...
llvm-svn: 31061
2006-10-20 00:42:07 +00:00
Devang Patel
880a9d823f
It is OK to remove extra cast if operation is EQ/NE even though source
...
and destination sign may not match but other conditions are met.
llvm-svn: 31056
2006-10-19 20:59:13 +00:00
Devang Patel
88406a6e1e
Typo Typo.
...
llvm-svn: 31055
2006-10-19 19:21:36 +00:00
Devang Patel
277990c79f
Typo.
...
llvm-svn: 31054
2006-10-19 19:05:38 +00:00
Devang Patel
d9ade71cc7
Fix bug in PR454 resolution. Added new test case.
...
This fixes llvmAsmParser.cpp miscompile by llvm on PowerPC Darwin.
llvm-svn: 31053
2006-10-19 18:54:08 +00:00
Reid Spencer
c6aa794a41
Undo Chris' last patch, it caused a regression.
...
llvm-svn: 30991
2006-10-16 23:08:08 +00:00
Chris Lattner
fd983f91e7
fix a buggy check that accidentally disabled this xform
...
llvm-svn: 30967
2006-10-15 22:42:15 +00:00
Nick Lewycky
686cc9cacc
Replace custom dispatch code with two uses of InstVisitor. Improves
...
compile-time performance.
llvm-svn: 30896
2006-10-12 02:02:44 +00:00
Chris Lattner
9f980ec2a1
Implement SROA of unions with mixed pointers/integers in them. This implements
...
PR892 and Transforms/ScalarRepl/union-pointer.ll:test2
llvm-svn: 30825
2006-10-08 23:53:04 +00:00
Chris Lattner
f8afa75cef
Implement Transforms/ScalarRepl/union-pointer.ll:test
...
llvm-svn: 30823
2006-10-08 23:28:04 +00:00
Chris Lattner
513ba43053
add a new SimplifyDemandedVectorElts method, which works similarly to
...
SimplifyDemandedBits. The idea is that some operations can be simplified if
not all of the computed elements are needed. Some targets (like x86) have a
large number of intrinsics that operate on a single element, but pass other
elts through unmodified. If those other elements are not needed, the
intrinsics can be simplified to scalar operations, and insertelement ops can
be removed.
This turns (f.e.):
ushort %Convert_sse(float %f) {
%tmp = insertelement <4 x float> undef, float %f, uint 0 ; <<4 x float>> [#uses=1]
%tmp10 = insertelement <4 x float> %tmp, float 0.000000e+00, uint 1 ; <<4 x float>> [#uses=1]
%tmp11 = insertelement <4 x float> %tmp10, float 0.000000e+00, uint 2 ; <<4 x float>> [#uses=1]
%tmp12 = insertelement <4 x float> %tmp11, float 0.000000e+00, uint 3 ; <<4 x float>> [#uses=1]
%tmp28 = tail call <4 x float> %llvm.x86.sse.sub.ss( <4 x float> %tmp12, <4 x float> < float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1]
%tmp37 = tail call <4 x float> %llvm.x86.sse.mul.ss( <4 x float> %tmp28, <4 x float> < float 5.000000e-01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1]
%tmp48 = tail call <4 x float> %llvm.x86.sse.min.ss( <4 x float> %tmp37, <4 x float> < float 6.553500e+04, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00 > ) ; <<4 x float>> [#uses=1]
%tmp59 = tail call <4 x float> %llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> zeroinitializer ) ; <<4 x float>> [#uses=1]
%tmp = tail call int %llvm.x86.sse.cvttss2si( <4 x float> %tmp59 ) ; <int> [#uses=1]
%tmp69 = cast int %tmp to ushort ; <ushort> [#uses=1]
ret ushort %tmp69
}
into:
ushort %Convert_sse(float %f) {
entry:
%tmp28 = sub float %f, 1.000000e+00 ; <float> [#uses=1]
%tmp37 = mul float %tmp28, 5.000000e-01 ; <float> [#uses=1]
%tmp375 = insertelement <4 x float> undef, float %tmp37, uint 0 ; <<4 x float>> [#uses=1]
%tmp48 = tail call <4 x float> %llvm.x86.sse.min.ss( <4 x float> %tmp375, <4 x float> < float 6.553500e+04, float undef, float undef, float undef > ) ; <<4 x float>> [#uses=1]
%tmp59 = tail call <4 x float> %llvm.x86.sse.max.ss( <4 x float> %tmp48, <4 x float> < float 0.000000e+00, float undef, float undef, float undef > ) ; <<4 x float>> [#uses=1]
%tmp = tail call int %llvm.x86.sse.cvttss2si( <4 x float> %tmp59 ) ; <int> [#uses=1]
%tmp69 = cast int %tmp to ushort ; <ushort> [#uses=1]
ret ushort %tmp69
}
which improves codegen from:
_Convert_sse:
movss LCPI1_0, %xmm0
movss 4(%esp), %xmm1
subss %xmm0, %xmm1
movss LCPI1_1, %xmm0
mulss %xmm0, %xmm1
movss LCPI1_2, %xmm0
minss %xmm0, %xmm1
xorps %xmm0, %xmm0
maxss %xmm0, %xmm1
cvttss2si %xmm1, %eax
andl $65535, %eax
ret
to:
_Convert_sse:
movss 4(%esp), %xmm0
subss LCPI1_0, %xmm0
mulss LCPI1_1, %xmm0
movss LCPI1_2, %xmm1
minss %xmm1, %xmm0
xorps %xmm1, %xmm1
maxss %xmm1, %xmm0
cvttss2si %xmm0, %eax
andl $65535, %eax
ret
This is just a first step, it can be extended in many ways. Testcase here:
Transforms/InstCombine/vec_demanded_elts.ll
llvm-svn: 30752
2006-10-05 06:55:50 +00:00
Chris Lattner
c8225bc92a
This case isn't implemented yet. It seems unlikely to be needed, but if it
...
ever is, we want to get an assert instead of silent bad codegen.
llvm-svn: 30716
2006-10-04 04:58:58 +00:00
Nick Lewycky
f5ad6f5e2e
Simplify logic further.
...
Ensure that we copy KnownProperties before calling visitBasicBlock, else
we may leak properties into blocks where they don't belong.
llvm-svn: 30705
2006-10-03 17:36:01 +00:00
Nick Lewycky
89e4e147f3
Simplify, now that predsimplify depends on break-crit-edges.
...
Fix SwitchInst where dest-block is the same as one of the cases.
llvm-svn: 30700
2006-10-03 15:19:11 +00:00
Nick Lewycky
0da988d8a7
Move break-crit-edges before the predicate simplifier. Allows us to
...
optimize in more cases.
llvm-svn: 30699
2006-10-03 14:52:23 +00:00
Evan Cheng
816069dcbc
Revert previous patch. Still breaking things.
...
llvm-svn: 30698
2006-10-03 07:26:07 +00:00
Chris Lattner
bfbe137f4c
Fix PR932 and Analysis/Dominators/2006-10-02-BreakCritEdges.ll:
...
The critical edge block dominates the dest block if the destblock dominates
all edges other than the one incoming from the critical edge.
llvm-svn: 30696
2006-10-03 07:02:02 +00:00
Chris Lattner
ed1e28e373
Fix a bug from r1.391 of this file, where we checked the size instead of
...
the alignment when promoting allocations. This implements
InstCombine/cast.ll:test32
llvm-svn: 30682
2006-10-01 19:40:58 +00:00
Chris Lattner
e3f1023f80
Fix debug output
...
llvm-svn: 30680
2006-09-30 23:32:50 +00:00
Chris Lattner
fd5a6b3445
Implement SRA of heap allocations.
...
llvm-svn: 30679
2006-09-30 23:32:09 +00:00
Chris Lattner
2521ed8492
Add some ifdef'd out debug info
...
llvm-svn: 30676
2006-09-30 19:40:30 +00:00
Chris Lattner
168061f13d
Eliminate ConstantBool::True and ConstantBool::False. Instead, provide
...
ConstantBool::getTrue() and ConstantBool::getFalse().
llvm-svn: 30665
2006-09-28 23:35:22 +00:00
Owen Anderson
18284b15a8
Another attempt at making ArgPromotion smarter. This patch no longer breaks Burg.
...
llvm-svn: 30657
2006-09-28 23:02:22 +00:00
Chris Lattner
d9c79b9349
simplify code
...
llvm-svn: 30656
2006-09-28 22:58:25 +00:00
Chris Lattner
358e9432a1
set DEBUG_TYPE right
...
llvm-svn: 30623
2006-09-27 04:58:23 +00:00
Nick Lewycky
800fff3067
Style changes only. Remove dead code, fix a comment.
...
llvm-svn: 30588
2006-09-23 15:13:08 +00:00
Chris Lattner
c0f674b9fd
Be far more careful when splitting a loop header, either to form a preheader
...
or when splitting loops with a common header into multiple loops. In particular
the old code would always insert the preheader before the old loop header. This
is disasterous in cases where the loop hasn't been rotated. For example, it can
produce code like:
.. outside the loop...
jmp LBB1_2 #bb13.outer
LBB1_1: #bb1
movsd 8(%esp,%esi,8), %xmm1
mulsd (%edi), %xmm1
addsd %xmm0, %xmm1
addl $24, %edi
incl %esi
jmp LBB1_3 #bb13
LBB1_2: #bb13.outer
leal (%edx,%eax,8), %edi
pxor %xmm1, %xmm1
xorl %esi, %esi
LBB1_3: #bb13
movapd %xmm1, %xmm0
cmpl $4, %esi
jl LBB1_1 #bb1
Note that the loop body is actually LBB1_1 + LBB1_3, which means that the
loop now contains an uncond branch WITHIN it to jump around the inserted
loop header (LBB1_2). Doh.
This patch changes the preheader insertion code to insert it in the right
spot, producing this code:
... outside the loop, fall into the header ...
LBB1_1: #bb13.outer
leal (%edx,%eax,8), %esi
pxor %xmm0, %xmm0
xorl %edi, %edi
jmp LBB1_3 #bb13
LBB1_2: #bb1
movsd 8(%esp,%edi,8), %xmm0
mulsd (%esi), %xmm0
addsd %xmm1, %xmm0
addl $24, %esi
incl %edi
LBB1_3: #bb13
movapd %xmm0, %xmm1
cmpl $4, %edi
jl LBB1_2 #bb1
Totally crazy, no branch in the loop! :)
llvm-svn: 30587
2006-09-23 08:19:21 +00:00
Chris Lattner
56c1c10ca1
Teach UpdateDomInfoForRevectoredPreds to handle revectored preds that are not
...
reachable, making it general purpose enough for use by InsertPreheaderForLoop.
Eliminate custom dominfo updating code in InsertPreheaderForLoop, using
UpdateDomInfoForRevectoredPreds instead.
llvm-svn: 30586
2006-09-23 07:40:52 +00:00
Chris Lattner
e87cf1c708
Fix Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.ll
...
llvm-svn: 30555
2006-09-21 05:12:20 +00:00
Nick Lewycky
2aff202559
Don't rewrite ConstantExpr::get.
...
llvm-svn: 30552
2006-09-21 01:05:35 +00:00
Nick Lewycky
eb301d20a6
Once we're down to "setcc type constant1, constant2", at least come up
...
with the right answer.
llvm-svn: 30550
2006-09-20 23:02:24 +00:00
Nick Lewycky
99b3c50130
Use a total ordering to compare instructions.
...
Fixes infinite loop in resolve().
llvm-svn: 30540
2006-09-20 17:04:01 +00:00
Andrew Lenharth
cf0746ba2a
simplify
...
llvm-svn: 30535
2006-09-20 15:37:57 +00:00
Chris Lattner
6ddcf6bba8
We went through all that trouble to compute whether it was safe to transform
...
this comparison, but never checked it. Whoops, no wonder we miscompiled
177.mesa!
llvm-svn: 30511
2006-09-20 04:44:59 +00:00
Evan Cheng
a7347758f5
Back out Chris' last set of changes. This breaks 177.mesa and povray somehow.
...
llvm-svn: 30505
2006-09-20 01:39:40 +00:00
Evan Cheng
8652c13f13
80 col.
...
llvm-svn: 30504
2006-09-20 01:10:02 +00:00
Andrew Lenharth
0240d56eb6
If we have an add, do it in the pointer realm, not the int realm. This is critical in the linux kernel for pointer analysis correctness
...
llvm-svn: 30496
2006-09-19 18:24:51 +00:00
Chris Lattner
2d2d80a4c2
implement select.ll:test19-22
...
llvm-svn: 30482
2006-09-19 06:18:21 +00:00
Nick Lewycky
96939f2d94
Walk down the dominator tree instead of the control flow graph. That means
...
that we can't modify the CFG any more, at least not until it's possible
to update the dominator tree (PR217).
llvm-svn: 30469
2006-09-18 21:09:35 +00:00
Chris Lattner
1efde528d6
Fix an infinite loop building the CFE
...
llvm-svn: 30465
2006-09-18 18:27:05 +00:00
Chris Lattner
39218c2b0c
Implement a trivial optzn: of vastart is never called in a function that takes
...
... args, remove the '...'.
This is Transforms/DeadArgElim/dead_vaargs.ll
llvm-svn: 30459
2006-09-18 07:02:31 +00:00
Chris Lattner
9c8bffb5e8
Implement InstCombine/cast.ll:test31. This speeds up 462.libquantum by 26%.
...
llvm-svn: 30456
2006-09-18 05:27:43 +00:00
Chris Lattner
f7e8879212
Implement Transforms/InstCombine/shift-sra.ll:test0
...
llvm-svn: 30450
2006-09-18 04:31:40 +00:00
Chris Lattner
6ee34e89bc
Rewrite shift/and/compare sequences to promote better licm of the RHS.
...
Use isLogicalShift/isArithmeticShift to simplify code.
llvm-svn: 30448
2006-09-18 04:22:48 +00:00
Chris Lattner
a4689e489e
Fix Transforms/InstCombine/2006-09-15-CastToBool.ll and PR913
...
llvm-svn: 30405
2006-09-16 03:14:10 +00:00
Chris Lattner
ce8928eed5
revert previous two patches. They cause miscompilation of MultiSource/Applications/Burg
...
llvm-svn: 30397
2006-09-15 17:24:45 +00:00
Owen Anderson
d55cc3f6d8
Revert my previous work on ArgumentPromotion. Further investigation has revealed these
...
changes to be incorrect. They just weren't showing up in any of our current testcases.
llvm-svn: 30385
2006-09-15 05:22:51 +00:00
Anton Korobeynikov
6e19f80688
Adding dllimport, dllexport and external weak linkage types.
...
DLL* linkages got full (I hope) codegeneration support in C & both x86
assembler backends.
External weak linkage added for future use, we don't provide any
codegeneration, etc. support for it.
llvm-svn: 30374
2006-09-14 18:23:27 +00:00
Chris Lattner
60207ce1f7
Second half of the fix for Transforms/Inline/inline_cleanup.ll
...
This folds unconditional branches that are often produced by code
specialization.
llvm-svn: 30307
2006-09-13 21:27:00 +00:00
Nick Lewycky
d8a64a4b2a
Add some more consistency checks.
...
llvm-svn: 30305
2006-09-13 19:32:53 +00:00
Nick Lewycky
29d605880a
Fix unionSets so that it can merge correctly.
...
llvm-svn: 30304
2006-09-13 19:24:01 +00:00
Chris Lattner
e55d70cedc
Implement the first half of Transforms/Inline/inline_cleanup.ll
...
llvm-svn: 30303
2006-09-13 19:23:57 +00:00
Nick Lewycky
315cc49646
Erase dead instructions.
...
llvm-svn: 30298
2006-09-13 18:55:37 +00:00
Devang Patel
b0ace495df
Initialize DontInternalize.
...
llvm-svn: 30281
2006-09-13 01:02:26 +00:00
Chris Lattner
c35e7175c3
An sinkable instruction may exist with uses, if those uses are in dead blocks.
...
Handle this. This fixes PR908 and Transforms/LICM/2006-09-12-DeadUserOfSunkInstr.ll
llvm-svn: 30275
2006-09-12 19:17:09 +00:00
Chris Lattner
0cffa03571
Fix PR905 and InstCombine/2006-09-11-EmptyStructCrash.ll
...
llvm-svn: 30266
2006-09-11 21:43:16 +00:00
Nick Lewycky
f9acdaf05e
Skip the linear search if the answer is already known.
...
llvm-svn: 30251
2006-09-11 17:23:34 +00:00
Chris Lattner
2921612126
Allow tail duplication in more cases, relaxing the previous restriction a
...
bit. This fixes Regression/Transforms/TailDup/MergeTest.ll
llvm-svn: 30237
2006-09-10 18:17:58 +00:00
Nick Lewycky
3bfe103166
Replace EquivalenceClasses with a custom-built data structure. Many common
...
operations (like findProperties) should be faster, at the expense of
unionSets being slower in cases that are rare in practise.
Don't erase a dead Instruction. This fixes a memory corruption issue.
llvm-svn: 30235
2006-09-10 02:27:07 +00:00
Chris Lattner
91d21d85e8
Implement Transforms/InstCombine/hoist_instr.ll
...
llvm-svn: 30234
2006-09-09 22:02:56 +00:00
Chris Lattner
2122c2e124
Make inlining costs more accurate.
...
llvm-svn: 30231
2006-09-09 20:40:44 +00:00
Chris Lattner
6847781b3e
Turn div X, (Cond ? Y : 0) -> div X, Y
...
This implements select.ll::test18.
llvm-svn: 30230
2006-09-09 20:26:32 +00:00
Chris Lattner
6aebff10e8
Throttle back tail duplication to avoid creating really ugly sequences of code.
...
For Transforms/TailDup/if-tail-dup.ll, f.e., it produces:
_foo:
movl 8(%esp), %eax
movl 4(%esp), %ecx
testl $1, %ecx
je LBB1_2 #cond_next
LBB1_1: #cond_true
movl $1, (%eax)
LBB1_2: #cond_next
testl $2, %ecx
je LBB1_4 #cond_next10
LBB1_3: #cond_true6
movl $1, 4(%eax)
LBB1_4: #cond_next10
testl $4, %ecx
je LBB1_6 #cond_next18
LBB1_5: #cond_true14
movl $1, 8(%eax)
LBB1_6: #cond_next18
testl $8, %ecx
je LBB1_8 #return
LBB1_7: #cond_true22
movl $1, 12(%eax)
ret
LBB1_8: #return
ret
instead of:
_foo:
movl 4(%esp), %eax
testl $2, %eax
sete %cl
movl 8(%esp), %edx
testl $1, %eax
je LBB1_2 #cond_next
LBB1_1: #cond_true
movl $1, (%edx)
testb %cl, %cl
jne LBB1_4 #cond_next10
jmp LBB1_3 #cond_true6
LBB1_2: #cond_next
testb %cl, %cl
jne LBB1_4 #cond_next10
LBB1_3: #cond_true6
movl $1, 4(%edx)
testl $4, %eax
je LBB1_6 #cond_next18
jmp LBB1_5 #cond_true14
LBB1_4: #cond_next10
testl $4, %eax
je LBB1_6 #cond_next18
LBB1_5: #cond_true14
movl $1, 8(%edx)
testl $8, %eax
je LBB1_8 #return
jmp LBB1_7 #cond_true22
LBB1_6: #cond_next18
testl $8, %eax
je LBB1_8 #return
LBB1_7: #cond_true22
movl $1, 12(%edx)
ret
LBB1_8: #return
ret
llvm-svn: 30158
2006-09-07 21:30:15 +00:00
Chris Lattner
f17002a907
Fix Duraid's changes to work when TLI is null. This fixes the failing
...
lowerinvoke regtests.
llvm-svn: 30115
2006-09-05 17:48:07 +00:00
Duraid Madina
51396ffd3e
add setJumpBufSize() and setJumpBufAlignment() to target-lowering.
...
Call these from your backend to enjoy setjmp/longjmp goodness, see
lib/Target/IA64/IA64ISelLowering.cpp for an example
llvm-svn: 30095
2006-09-04 06:21:35 +00:00
Owen Anderson
0ea394ab0a
Make ArgumentPromotion handle recursive functions that pass pointers in their recursive calls.
...
llvm-svn: 30057
2006-09-02 21:19:44 +00:00
Nick Lewycky
26f5df3031
Improve handling of SelectInst.
...
Reorder operations to remove duplicated work.
Fix to leave floating-point types out of the optimization.
Add tests to predsimplify.ll for SwitchInst and SelectInst handling.
llvm-svn: 30055
2006-09-02 19:40:38 +00:00
Nick Lewycky
ebb3b930fd
Don't confuse canonicalize and lookup. Fixes predsimplify.reg4.ll. Also
...
corrects missing optimization opportunity removing cases from a switch.
llvm-svn: 30009
2006-09-01 03:26:35 +00:00
Nick Lewycky
e31a5a1b20
Properties where both Values weren't in the union (as being equal to
...
another Value) weren't being found by findProperties.
This fixes predsimplify.ll test6, a missed optimization opportunity.
llvm-svn: 29991
2006-08-31 00:39:16 +00:00
Nick Lewycky
4a44c62fab
Move to using the EquivalenceClass ADT. Removes SynSets.
...
If a branch's condition has become a ConstantBool, simplify it immediately.
Removing the edge saves work and exposes up more optimization opportunities
in the pass.
Add support for SelectInst.
llvm-svn: 29970
2006-08-30 02:46:48 +00:00
Devang Patel
a5bb9b49d3
Do not rely on std::sort and std::erase to get list of unique
...
exit blocks. The output is dependent on addresses of basic block.
Add and use Loop::getUniqueExitBlocks.
llvm-svn: 29966
2006-08-29 22:29:16 +00:00
Owen Anderson
bbfa479f14
Clean up a bit.
...
llvm-svn: 29950
2006-08-29 06:10:56 +00:00
Nick Lewycky
9535a84c33
Add PredicateSimplifier pass. Collapses equal variables into one form
...
and simplifies expressions. This implements the optimization described
in PR807.
llvm-svn: 29947
2006-08-28 22:44:55 +00:00
Owen Anderson
ee603f511f
Make LoopUnroll fold excessive BasicBlocks. This results in a significant speedup of
...
gccas on 252.eon
llvm-svn: 29936
2006-08-28 02:09:46 +00:00
Chris Lattner
8a59e8be23
simplify AnalysisGroup registration, eliminating one typeid call.
...
llvm-svn: 29932
2006-08-28 00:42:29 +00:00
Chris Lattner
a39dcb5377
eliminate RegisterOpt. It does the same thing as RegisterPass.
...
llvm-svn: 29925
2006-08-27 22:42:52 +00:00
Chris Lattner
33bd5dcfb7
s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|
...
llvm-svn: 29911
2006-08-27 12:54:02 +00:00
Owen Anderson
aac2dbf9dd
Fix a crash related to updating Phi nodes in the original header block. This was
...
causing a crash in 175.vpr
llvm-svn: 29887
2006-08-25 22:13:55 +00:00
Owen Anderson
e02cb4cda0
Add an assertion to check that we're really preserving LCSSA.
...
llvm-svn: 29886
2006-08-25 22:12:36 +00:00
Owen Anderson
b1d980f98a
Reapply the indvars patch, since nothing blew up last night.
...
llvm-svn: 29874
2006-08-25 17:41:25 +00:00
Owen Anderson
596b22375a
Revert my previous patch. Since there are some major changes that went in today,
...
I'm going to wait to put this in HEAD until tomorrow, so as not to clutter the nightly
tester.
llvm-svn: 29868
2006-08-25 03:45:57 +00:00
Owen Anderson
54c87a08ab
Specify that indvars actually preserve LCSSA. This has been done for a while, but I
...
forgot to put in the analysis usage.
llvm-svn: 29867
2006-08-25 03:32:13 +00:00
Owen Anderson
0aa48d0522
Implement unrolling of multiblock loops. This significantly improves the
...
utility of the LoopUnroll pass.
Also, add a testcase for multiblock-loop unrolling.
llvm-svn: 29859
2006-08-24 21:28:19 +00:00
Reid Spencer
1ae3d19c51
Fix a grammaro in a comment.
...
llvm-svn: 29765
2006-08-18 09:01:07 +00:00