Chris Lattner
dd3ec92085
trivial simplification
...
llvm-svn: 20494
2005-03-06 21:35:38 +00:00
Chris Lattner
238f6df546
Fix a bug where we could corrupt a parent loop's header info if we unrolled
...
a nested loop. This fixes Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll
and PR532
llvm-svn: 20493
2005-03-06 20:57:32 +00:00
Chris Lattner
1b032f59e7
Make this MUCH faster by avoiding a linear search in the symbol table code.
...
llvm-svn: 20479
2005-03-06 05:42:36 +00:00
Jeff Cohen
4abcea3a69
Reformat comments to fix 80 columns.
...
llvm-svn: 20467
2005-03-05 22:45:40 +00:00
Jeff Cohen
be37fa07fd
Reuse induction variables created for strength-reduced GEPs by other similar GEPs.
...
llvm-svn: 20466
2005-03-05 22:40:34 +00:00
Chris Lattner
6d0a24c608
second argument to Value::setName is now gone.
...
llvm-svn: 20463
2005-03-05 19:05:20 +00:00
Chris Lattner
cfe2822cdf
Do not compute 1ULL << 64, which is undefined. This fixes Ptrdist/ks on the
...
sparc, and testcase Regression/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll
llvm-svn: 20445
2005-03-04 23:21:33 +00:00
Jeff Cohen
a2c59b7423
Add support for not strength reducing GEPs where the element size is a small
...
power of two. This emphatically includes the zeroeth power of two.
llvm-svn: 20429
2005-03-04 04:04:26 +00:00
Chris Lattner
ef1e989e4f
Add an optional argument to lower to a specific constant value instead of
...
to a "sizeof" expression.
llvm-svn: 20414
2005-03-03 01:03:43 +00:00
Jeff Cohen
8ea6f9e821
Fixed the following LSR bugs:
...
* Loop invariant code does not dominate the loop header, but rather
the end of the loop preheader.
* The base for a reduced GEP isn't a constant unless all of its
operands (preceding the induction variable) are constant.
* Allow induction variable elimination for the simple case after all.
Also made changes recommended by Chris for properly deleting
instructions.
llvm-svn: 20383
2005-03-01 03:46:11 +00:00
Jeff Cohen
dcaa48b5c4
Fix crash in LSR due to attempt to remove original induction variable. However,
...
for reasons explained in the comments, I also deactivated this code as it needs
more thought.
llvm-svn: 20367
2005-02-28 00:08:56 +00:00
Jeff Cohen
fd63d3af0d
PHI nodes were incorrectly placed when more than one GEP is reduced in a loop.
...
llvm-svn: 20360
2005-02-27 21:08:04 +00:00
Jeff Cohen
39751c3b7c
First pass at improved Loop Strength Reduction. Still not yet ready for prime time.
...
llvm-svn: 20358
2005-02-27 19:37:07 +00:00
Chris Lattner
7561ca1d15
Teach globalopt how memset/cpy/move affect memory, to allow better optimization.
...
llvm-svn: 20352
2005-02-27 18:58:52 +00:00
Chris Lattner
0ce80cd542
Fix spelling, patch contributed by Gabor Greif!
...
llvm-svn: 20343
2005-02-27 06:18:25 +00:00
Chris Lattner
cc6d75fddf
remove extraneous cast
...
llvm-svn: 20334
2005-02-26 18:33:28 +00:00
Chris Lattner
1cca959e5d
Implement Transforms/SimplifyCFG/switch_thread.ll
...
This does a simple form of "jump threading", which eliminates CFG edges that
are provably dead. This triggers 90 times in the external tests, and
eliminating CFG edges is always always a good thing! :)
llvm-svn: 20300
2005-02-24 06:17:52 +00:00
Chris Lattner
25169caa80
make this more efficient. Scan up to 16 nodes, not the whole list.
...
llvm-svn: 20289
2005-02-23 16:53:04 +00:00
Chris Lattner
52e931b37d
Remove use of bind_obj
...
llvm-svn: 20276
2005-02-22 23:22:58 +00:00
Chris Lattner
7b5d9e2217
Do not mark obviously unreachable blocks live when processing PHI nodes,
...
and handle incomplete control dependences correctly. This fixes:
Regression/Transforms/ADCE/dead-phi-edge.ll
-> a missed optimization
Regression/Transforms/ADCE/dead-phi-edge.ll
-> a compiler crash distilled from QT4
llvm-svn: 20227
2005-02-17 19:28:49 +00:00
Chris Lattner
31f3382b3b
Fix the second bug attached to PR504.
...
llvm-svn: 20181
2005-02-14 20:11:45 +00:00
Chris Lattner
e616fea3bc
Fix for testcase Transforms/IndVarsSimplify/2005-02-11-InvokeCrash.ll
...
and PR504.
llvm-svn: 20129
2005-02-12 03:26:49 +00:00
Alkis Evlogimenos
c4a44c6b3d
Localize globals if they are only used in main(). This replaces the
...
global with an alloca, which eventually gets promoted into a
register. This enables a lot of other optimizations later on.
llvm-svn: 20109
2005-02-10 18:36:30 +00:00
Alkis Evlogimenos
346bb20409
Fix crash on MallocInsts of unsized types.
...
llvm-svn: 19988
2005-02-02 04:43:37 +00:00
Chris Lattner
82b42c5d85
API change.
...
llvm-svn: 19959
2005-02-01 01:23:49 +00:00
Chris Lattner
d6a4492f81
Adjust to changes in APIs
...
llvm-svn: 19958
2005-02-01 01:23:31 +00:00
Chris Lattner
f98a7bffb3
Hacks to make this ugly ugly code work with the new use lists.
...
llvm-svn: 19957
2005-02-01 01:22:56 +00:00
Chris Lattner
72684fecf8
Implement InstCombine/cast.ll:test25, a case that occurs many times
...
in spec
llvm-svn: 19953
2005-01-31 05:51:45 +00:00
Chris Lattner
31f486c775
Implement the trivial cases in InstCombine/store.ll
...
llvm-svn: 19950
2005-01-31 05:36:43 +00:00
Chris Lattner
fe1b0b8b24
Implement Transforms/InstCombine/cast-load-gep.ll, which allows us to devirtualize
...
11 indirect calls in perlbmk.
llvm-svn: 19947
2005-01-31 04:50:46 +00:00
Chris Lattner
d8e20188c6
Adjust to changes in instruction interfaces.
...
llvm-svn: 19900
2005-01-29 00:39:08 +00:00
Chris Lattner
a3f06fa2dd
Switchinst takes a hint for the number of cases it will have.
...
llvm-svn: 19899
2005-01-29 00:38:45 +00:00
Chris Lattner
a35dfcedd3
switchinst ctor now takes a hint for the number of cases that it will have.
...
llvm-svn: 19898
2005-01-29 00:38:26 +00:00
Chris Lattner
84d3137da7
Adjust Valuehandle to hold its operand directly in it.
...
llvm-svn: 19897
2005-01-29 00:37:36 +00:00
Chris Lattner
cd517ff0c7
* add some DEBUG statements
...
* Properly compile this:
struct a {};
int test() {
struct a b[2];
if (&b[0] != &b[1])
abort ();
return 0;
}
to 'return 0', not abort().
llvm-svn: 19875
2005-01-28 19:32:01 +00:00
Alkis Evlogimenos
fbd921987f
Add a dependency to the trace library so that it gets pulled in
...
automatically.
llvm-svn: 19828
2005-01-25 16:23:57 +00:00
Chris Lattner
9e2c7facb2
Get rid of a several dozen more and instructions in specint.
...
llvm-svn: 19786
2005-01-23 20:26:55 +00:00
Chris Lattner
fc4429e7c1
Handle comparisons of gep instructions that have different typed indices
...
as long as they are the same size.
llvm-svn: 19734
2005-01-21 23:06:49 +00:00
Chris Lattner
411336fe04
Add two optimizations. The first folds (X+Y)-X -> Y
...
The second folds operations into selects, e.g. (select C, (X+Y), (Y+Z))
-> (Y+(select C, X, Z)
This occurs a few times across spec, e.g.
select add/sub
mesa: 83 0
povray: 5 2
gcc 4 2
parser 0 22
perlbmk 13 30
twolf 0 3
llvm-svn: 19706
2005-01-19 21:50:18 +00:00
Chris Lattner
a3cc1835ad
Fix 'raise' to work with packed types. Patch by Morten Ofstad.
...
llvm-svn: 19693
2005-01-19 16:16:35 +00:00
Chris Lattner
715364364b
Delete PHI nodes that are not dead but are locked in a cycle of single
...
useness.
llvm-svn: 19629
2005-01-17 05:10:15 +00:00
Chris Lattner
03f06f11aa
Move code out of indentation one level to make it easier to read.
...
Disable the xform for < > cases. It turns out that the following is being
miscompiled:
bool %test(sbyte %S) {
%T = cast sbyte %S to uint
%V = setgt uint %T, 255
ret bool %V
}
llvm-svn: 19628
2005-01-17 03:20:02 +00:00
Chris Lattner
51726c47fe
Fix some bugs in an xform added yesterday. This fixes Prolangs-C/allroots.
...
llvm-svn: 19553
2005-01-14 17:35:12 +00:00
Chris Lattner
7aa41cfa88
Fix a compile crash on spiff
...
llvm-svn: 19552
2005-01-14 17:17:59 +00:00
Chris Lattner
4fa89827e2
if two gep comparisons only differ by one index, compare that index directly.
...
This allows us to better optimize begin() -> end() comparisons in common cases.
llvm-svn: 19542
2005-01-14 00:20:05 +00:00
Chris Lattner
d35d210ea0
Do not overrun iterators. This fixes a 176.gcc crash
...
llvm-svn: 19541
2005-01-13 23:26:48 +00:00
Chris Lattner
a04c904c4c
Turn select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y))). This occurs in
...
the 'sim' program and probably elsewhere. In sim, it comes up for cases
like this:
#define round(x) ((x)>0.0 ? (x)+0.5 : (x)-0.5)
double G;
void T(double X) { G = round(X); }
(it uses the round macro a lot). This changes the LLVM code from:
%tmp.1 = setgt double %X, 0.000000e+00 ; <bool> [#uses=1]
%tmp.4 = add double %X, 5.000000e-01 ; <double> [#uses=1]
%tmp.6 = sub double %X, 5.000000e-01 ; <double> [#uses=1]
%mem_tmp.0 = select bool %tmp.1, double %tmp.4, double %tmp.6
store double %mem_tmp.0, double* %G
to:
%tmp.1 = setgt double %X, 0.000000e+00 ; <bool> [#uses=1]
%mem_tmp.0.p = select bool %tmp.1, double 5.000000e-01, double -5.000000e-01
%mem_tmp.0 = add double %mem_tmp.0.p, %X
store double %mem_tmp.0, double* %G
ret void
llvm-svn: 19537
2005-01-13 22:52:24 +00:00
Chris Lattner
81e8417614
Implement an optimization for == and != comparisons like this:
...
_Bool test2(int X, int Y) {
return &arr[X][Y] == arr;
}
instead of generating this:
bool %test2(int %X, int %Y) {
%tmp.3.idx = mul int %X, 160 ; <int> [#uses=1]
%tmp.3.idx1 = shl int %Y, ubyte 2 ; <int> [#uses=1]
%tmp.3.offs2 = sub int 0, %tmp.3.idx ; <int> [#uses=1]
%tmp.7 = seteq int %tmp.3.idx1, %tmp.3.offs2 ; <bool> [#uses=1]
ret bool %tmp.7
}
generate this:
bool %test2(int %X, int %Y) {
seteq int %X, 0 ; <bool>:0 [#uses=1]
seteq int %Y, 0 ; <bool>:1 [#uses=1]
%tmp.7 = and bool %0, %1 ; <bool> [#uses=1]
ret bool %tmp.7
}
This idiom occurs in C++ programs when iterating from begin() to end(),
in a vector or array. For example, we now compile this:
void test(int X, int Y) {
for (int *i = arr; i != arr+100; ++i)
foo(*i);
}
to this:
no_exit: ; preds = %entry, %no_exit
...
%exitcond = seteq uint %indvar.next, 100 ; <bool> [#uses=1]
br bool %exitcond, label %return, label %no_exit
instead of this:
no_exit: ; preds = %entry, %no_exit
...
%inc5 = getelementptr [100 x [40 x int]]* %arr, int 0, int 0, int %inc.rec ; <int*> [#uses=1]
%tmp.8 = seteq int* %inc5, getelementptr ([100 x [40 x int]]* %arr, int 0, int 100, int 0) ; <bool> [#uses=1]
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=1]
br bool %tmp.8, label %return, label %no_exit
llvm-svn: 19536
2005-01-13 22:25:21 +00:00
Chris Lattner
4cb9fa373b
Fix some bugs in code I didn't mean to check in.
...
llvm-svn: 19534
2005-01-13 20:40:58 +00:00
Chris Lattner
0798af33a5
Fix a crash compiling 129.compress
...
llvm-svn: 19533
2005-01-13 20:14:25 +00:00