Chris Lattner
3d61b688a9
This optimization makes MANY phi nodes that all have the same incoming value.
...
If this happens, detect it early instead of relying on instcombine to notice
it later. This can be a big speedup, because PHI nodes can have many
incoming values.
llvm-svn: 17741
2004-11-14 19:29:34 +00:00
Chris Lattner
1e4cad9176
Implement instcombine/phi.ll:test6 - pulling operations through PHI nodes.
...
This exposes subsequent optimization possiblities and reduces code size.
This triggers 1423 times in spec.
llvm-svn: 17740
2004-11-14 19:13:23 +00:00
Chris Lattner
fdd41995d8
Transform this:
...
%X = alloca ...
%Y = alloca ...
X == Y
into false. This allows us to simplify some stuff in eon (and probably
many other C++ programs) where operator= was checking for self assignment.
Folding this allows us to SROA several additional structs.
llvm-svn: 17735
2004-11-14 07:33:16 +00:00
Chris Lattner
d0a0af0818
Teach SROA how to promote an array index that is variable, if the dimension
...
of the array is just two. This occurs 8 times in gcc, 6 times in crafty, and
12 times in 099.go.
This implements ScalarRepl/sroa_two.ll
llvm-svn: 17727
2004-11-14 05:00:19 +00:00
Chris Lattner
bc35272f86
Rearrange some code, no functionality changes.
...
llvm-svn: 17724
2004-11-14 04:24:28 +00:00
Chris Lattner
70e351fb1c
Simplify handling of shifts to be the same as we do for adds. Add support
...
for (X * C1) + (X * C2) (where * can be mul or shl), allowing us to fold:
Y+Y+Y+Y+Y+Y+Y+Y
into
%tmp.8 = shl long %Y, ubyte 3 ; <long> [#uses=1]
instead of
%tmp.4 = shl long %Y, ubyte 2 ; <long> [#uses=1]
%tmp.12 = shl long %Y, ubyte 2 ; <long> [#uses=1]
%tmp.8 = add long %tmp.4, %tmp.12 ; <long> [#uses=1]
This implements add.ll:test25
Also add support for (X*C1)-(X*C2) -> X*(C1-C2), implementing sub.ll:test18
llvm-svn: 17704
2004-11-13 19:50:12 +00:00
Chris Lattner
7a8d26a581
Fold:
...
(X + (X << C2)) --> X * ((1 << C2) + 1)
((X << C2) + X) --> X * ((1 << C2) + 1)
This means that we now canonicalize "Y+Y+Y" into:
%tmp.2 = mul long %Y, 3 ; <long> [#uses=1]
instead of:
%tmp.10 = shl long %Y, ubyte 1 ; <long> [#uses=1]
%tmp.6 = add long %Y, %tmp.10 ; <long> [#uses=1]
llvm-svn: 17701
2004-11-13 19:31:40 +00:00
Chris Lattner
d348f5b9fb
Lazily create the abort message, so only translation units that use unwind
...
will actually get it.
llvm-svn: 17700
2004-11-13 19:07:32 +00:00
Chris Lattner
922a1b4601
Simplify handling of constant initializers
...
llvm-svn: 17696
2004-11-12 22:42:57 +00:00
Chris Lattner
a060b55dea
This is V9 specific, move it there.
...
llvm-svn: 17545
2004-11-07 00:39:26 +00:00
Chris Lattner
064071600d
Fix some warnings on VC++
...
llvm-svn: 17481
2004-11-05 04:45:43 +00:00
Chris Lattner
33ed2c8984
* Rearrange code slightly
...
* Disable broken transforms for simplifying (setcc (cast X to larger), CI)
where CC is not != or ==
llvm-svn: 17422
2004-11-02 03:50:32 +00:00
Chris Lattner
b81520727e
Speed up the tail duplication pass on the testcase below from 68.2s to 1.23s:
...
#define CL0(a) case a: f(); goto c;
#define CL1(a) CL0(a##0) CL0(a##1) CL0(a##2) CL0(a##3) CL0(a##4) CL0(a##5) \
CL0(a##6) CL0(a##7) CL0(a##8) CL0(a##9)
#define CL2(a) CL1(a##0) CL1(a##1) CL1(a##2) CL1(a##3) CL1(a##4) CL1(a##5) \
CL1(a##6) CL1(a##7) CL1(a##8) CL1(a##9)
#define CL3(a) CL2(a##0) CL2(a##1) CL2(a##2) CL2(a##3) CL2(a##4) CL2(a##5) \
CL2(a##6) CL2(a##7) CL2(a##8) CL2(a##9)
#define CL4(a) CL3(a##0) CL3(a##1) CL3(a##2) CL3(a##3) CL3(a##4) CL3(a##5) \
CL3(a##6) CL3(a##7) CL3(a##8) CL3(a##9)
void f();
void a() {
int b;
c: switch (b) {
CL4(1)
}
}
This comes from GCC PR 15524
llvm-svn: 17390
2004-11-01 07:05:07 +00:00
Reid Spencer
d3f7233495
Change Library Names Not To Conflict With Others When Installed
...
llvm-svn: 17286
2004-10-27 23:18:45 +00:00
Chris Lattner
dd0094e4ed
Convert 'struct' to 'class' in various places to adhere to the coding standards
...
and work better with VC++. Patch contributed by Morten Ofstad!
llvm-svn: 17281
2004-10-27 16:14:51 +00:00
Chris Lattner
000424b69e
Hrm, this code was severely botched. As it turns out, this patch:
...
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041018/019708.html
exposed ANOTHER latent bug in this xform, which caused Prolangs-C/bison to fill
the zion nightly tester disk up and make the tester barf.
This is obviously not a good thing, so lets fix this bug shall we? :)
llvm-svn: 17276
2004-10-27 05:57:15 +00:00
Chris Lattner
abfae1c72e
Initialize with the correct constant type
...
llvm-svn: 17270
2004-10-27 03:55:24 +00:00
Chris Lattner
895f16ebfc
Fix compatibility with MSVC, patch by Morten Ofstad
...
llvm-svn: 17218
2004-10-25 18:45:16 +00:00
Chris Lattner
6321852143
Fix a bug Nate noticed, where we miscompiled a simple testcase
...
llvm-svn: 17157
2004-10-22 04:53:16 +00:00
Reid Spencer
e48ba34fd4
We won't use automake
...
llvm-svn: 17155
2004-10-22 03:35:04 +00:00
Chris Lattner
e555b5c5cb
Hrm, some people complain when the compiler cheerfully tells them what it's
...
doing... I guess they're right.
llvm-svn: 17142
2004-10-19 06:33:16 +00:00
Reid Spencer
ce514b1c2c
Initial automake generated Makefile template
...
llvm-svn: 17136
2004-10-18 23:55:41 +00:00
Nate Begeman
49e38c2185
Initial implementation of the strength reduction for GEP instructions in
...
loops. This optimization is not turned on by default yet, but may be run
with the opt tool's -loop-reduce flag. There are many FIXMEs listed in the
code that will make it far more applicable to a wide range of code, but you
have to start somewhere :)
This limited version currently triggers on the following tests in the
MultiSource directory:
pcompress2: 7 times
cfrac: 5 times
anagram: 2 times
ks: 6 times
yacr2: 2 times
llvm-svn: 17134
2004-10-18 21:08:22 +00:00
Reid Spencer
2b5cfe8be8
Correction to allow compilation with Visual C++.
...
Patch contributed by Morten Ofstad. Thanks Morten!
llvm-svn: 17123
2004-10-18 14:38:48 +00:00
Chris Lattner
3c1be63b41
Turn store -> null/undef into the LLVM unreachable instruction! This simple
...
change hacks off 10K of bytecode from perlbmk (.5%) even though the front-end
is not generating them yet and we are not optimizing the resultant code.
This isn't too bad.
llvm-svn: 17111
2004-10-18 03:00:50 +00:00
Chris Lattner
18333c64de
Turn things with obviously undefined semantics into 'store -> null'
...
llvm-svn: 17110
2004-10-18 02:59:09 +00:00
Chris Lattner
dbfa9a5e9c
My friend the invoke instruction does not dominate all basic blocks if it
...
occurs in the entry node of a function
llvm-svn: 17109
2004-10-18 01:48:31 +00:00
Chris Lattner
44a7cf480d
Getting ADCE to interact well with unreachable instructions seems like a nontrivial
...
exercise that I'm not interested in tackling right now. Just punt and treat them
like unwind's.
This 'fixes' test/Regression/Transforms/ADCE/unreachable-function.ll
llvm-svn: 17106
2004-10-17 23:45:06 +00:00
Chris Lattner
795ae57cde
Remove printout, realize that instructions in the entry block dominate all
...
other blocks.
llvm-svn: 17099
2004-10-17 21:31:34 +00:00
Chris Lattner
ef0888e493
hasConstantValue will soon return instructions that don't dominate the PHI node,
...
so prepare for this.
llvm-svn: 17095
2004-10-17 21:22:38 +00:00
Chris Lattner
68f14bc09c
Fix a type violation
...
llvm-svn: 17069
2004-10-16 23:28:04 +00:00
Chris Lattner
d12442c206
Kill the bogon that slipped into my buffer before I committed.
...
llvm-svn: 17067
2004-10-16 19:46:33 +00:00
Chris Lattner
b55574181d
Implement InstCombine/getelementptr.ll:test9, which is the source of many
...
ugly and giant constnat exprs in some programs.
llvm-svn: 17066
2004-10-16 19:44:59 +00:00
Chris Lattner
3ebca6fb19
Optimize instructions involving undef values. For example X+undef == undef.
...
llvm-svn: 17047
2004-10-16 18:11:37 +00:00
Chris Lattner
80f963c30b
Handle undef values as undefined on the constant lattice
...
ignore unreachable instructions
llvm-svn: 17044
2004-10-16 18:09:41 +00:00
Chris Lattner
c630ba08cf
Add note
...
llvm-svn: 17043
2004-10-16 18:09:25 +00:00
Reid Spencer
e6418ec30f
Update to reflect changes in Makefile rules.
...
llvm-svn: 16950
2004-10-13 11:46:52 +00:00
Chris Lattner
63f15158f4
Transform memmove -> memcpy when the source is obviously constant memory.
...
llvm-svn: 16932
2004-10-12 04:52:52 +00:00
Chris Lattner
b605c860fc
Fix a REALLY obscure bug in my previous checkin, which was splicing the END
...
marker from one ilist into the middle of another basic block!
llvm-svn: 16925
2004-10-12 01:02:29 +00:00
Chris Lattner
a6d0e41b72
Handle a common case more carefully. In particular, instead of transforming
...
pointer recurrences into expressions from this:
%P_addr.0.i.0 = phi sbyte* [ getelementptr ([8 x sbyte]* %.str_1, int 0, int 0), %entry ], [ %inc.0.i, %no_exit.i ]
%inc.0.i = getelementptr sbyte* %P_addr.0.i.0, int 1 ; <sbyte*> [#uses=2]
into this:
%inc.0.i = getelementptr sbyte* getelementptr ([8 x sbyte]* %.str_1, int 0, int 0), int %inc.0.i.rec
Actually create something nice, like this:
%inc.0.i = getelementptr [8 x sbyte]* %.str_1, int 0, int %inc.0.i.rec
llvm-svn: 16924
2004-10-11 23:06:50 +00:00
Chris Lattner
f9e79568c2
Reenable the transform, turning X/-10 < 1 into X > -10
...
llvm-svn: 16918
2004-10-11 19:40:04 +00:00
Reid Spencer
1b7459b29d
Initial version of automake Makefile.am file.
...
llvm-svn: 16893
2004-10-10 22:20:40 +00:00
Chris Lattner
f8a6e4402e
Use DEBUG instead of DebugFlag directly, as DebugFlag does not respect
...
-debug-only!
llvm-svn: 16868
2004-10-09 19:30:36 +00:00
Chris Lattner
c5085d212c
Implement sub.ll:test17, -X/C -> X/-C
...
llvm-svn: 16863
2004-10-09 02:50:40 +00:00
Chris Lattner
816a8a5e1e
Temporarily disable a buggy transformation until it can be fixed. This fixes
...
254.gap.
llvm-svn: 16853
2004-10-08 19:15:44 +00:00
Chris Lattner
5839d93b51
Instcombine (X & FF00) + xx00 -> (X+xx00) & FF00, implementing and.ll:test27
...
This comes up when doing adds to bitfield elements.
llvm-svn: 16836
2004-10-08 05:07:56 +00:00
Chris Lattner
87259c3ce9
Little patch to turn (shl (add X, 123), 4) -> (add (shl X, 4), 123 << 4)
...
This triggers in cases of bitfield additions, opening opportunities for
future improvements.
llvm-svn: 16834
2004-10-08 03:46:20 +00:00
Chris Lattner
ff8cbd01e7
Instcombine: -(X sdiv C) -> (X sdiv -C), tested by sub.ll:test16
...
llvm-svn: 16769
2004-10-06 15:08:25 +00:00
Chris Lattner
5f0c904ec0
Reduce code growth implied by the tail duplication pass by not duplicating
...
an instruction if it can be hoisted to a common dominator of the block.
This implements: test/Regression/Transforms/TailDup/MergeTest.ll
llvm-svn: 16758
2004-10-06 03:27:37 +00:00
Chris Lattner
8341306cba
Hrm, debugging printouts do not need to be in here
...
llvm-svn: 16598
2004-09-29 21:21:14 +00:00