Chris Lattner
7b25bcdf52
* Substantially simplify how free instructions are handled (potentially fixing
...
a bug in DSE).
* Delete dead operand uses iteratively instead of recursively, using a
SetVector.
* Defer deletion of dead operand uses until the end of processing, which means
we don't have to bother with updating the AliasSetTracker. This speeds up
DSE substantially.
llvm-svn: 15204
2004-07-25 11:09:56 +00:00
Chris Lattner
4c1c1ac7e4
Free instructions kill values too. This implements DeadStoreElim/free.llx
...
llvm-svn: 15199
2004-07-25 07:58:38 +00:00
Chris Lattner
bad6478b00
obvious fix
...
llvm-svn: 15162
2004-07-24 07:51:27 +00:00
Chris Lattner
3844c300de
This is a trivial dead store elimination pass. It very very simple and
...
can be improved in many ways. But: stop laughing, even with -basicaa it
deletes 15% of the stores in 252.eon :)
llvm-svn: 15101
2004-07-22 08:00:28 +00:00
Chris Lattner
51f7c9e56d
Update GC intrinsics to take a pointer to the object as well as a pointer
...
to the field being updated. Patch contributed by Tobias Nurmiranta
llvm-svn: 15097
2004-07-22 05:51:13 +00:00
Chris Lattner
d8f5e2ccac
* Further cleanup.
...
* Test for whether bits are shifted out during the optzn.
If so, the fold is illegal, though it can be handled explicitly for setne/seteq
This fixes the miscompilation of 254.gap last night, which was a latent bug
exposed by other optimizer improvements.
llvm-svn: 15085
2004-07-21 20:14:10 +00:00
Chris Lattner
1638de4499
Make cast-cast code a bit more defensive
...
"simplify" a bit of code for comparison/and folding
llvm-svn: 15082
2004-07-21 19:50:44 +00:00
Chris Lattner
4fbad968f8
Remove special casing of pointers and treat them generically as integers of
...
the appopriate size. This gives us the ability to eliminate int -> ptr -> int
llvm-svn: 15063
2004-07-21 04:27:24 +00:00
Chris Lattner
11ffd59e37
Implement Transforms/InstCombine/IntPtrCast.ll
...
llvm-svn: 15029
2004-07-20 05:21:00 +00:00
Chris Lattner
44d0b9502a
Implement InstCombine/GEPIdxCanon.ll
...
llvm-svn: 15024
2004-07-20 01:48:15 +00:00
Chris Lattner
4e2dbc6b4a
Rewrite cast->cast elimination code completely based on the information we
...
actually care about. Someday when the cast instruction is gone, we can do
better here, but this will do for now. This implements
instcombine/cast.ll:test17/18 as well.
llvm-svn: 15018
2004-07-20 00:59:32 +00:00
Chris Lattner
f3edc49ae2
Minor cleanup, no functionality change
...
llvm-svn: 14972
2004-07-18 18:59:44 +00:00
Reid Spencer
f0a5bcaae4
Delete a redundant if branch.
...
llvm-svn: 14967
2004-07-18 08:34:52 +00:00
Reid Spencer
c44cb6bd9f
Expand the coercion of constants to include the newly constant Globals.
...
llvm-svn: 14966
2004-07-18 08:34:19 +00:00
Reid Spencer
539429d9b5
Delete a no-op loop.
...
llvm-svn: 14965
2004-07-18 08:32:43 +00:00
Reid Spencer
6c2b627e23
Expand the scope to include global values because they are now constants
...
too.
llvm-svn: 14964
2004-07-18 08:32:10 +00:00
Reid Spencer
cb3fb5d4f5
bug 122:
...
- Replace ConstantPointerRef usage with GlobalValue usage
llvm-svn: 14953
2004-07-18 00:44:37 +00:00
Reid Spencer
874368790f
bug 122:
...
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
llvm-svn: 14950
2004-07-18 00:38:32 +00:00
Reid Spencer
ef784f01dd
bug 122:
...
- Minimize redundant isa<GlobalValue> usage
llvm-svn: 14948
2004-07-18 00:32:14 +00:00
Reid Spencer
c5afc9512b
bug 122:
...
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass
llvm-svn: 14947
2004-07-18 00:31:05 +00:00
Reid Spencer
9e855c6832
bug 122:
...
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
llvm-svn: 14946
2004-07-18 00:29:57 +00:00
Chris Lattner
d79334df33
This patch was contributed by Daniel Berlin!
...
Speed up SCCP substantially by processing overdefined values quickly. This
patch speeds up SCCP by about 30-40% on large testcases.
llvm-svn: 14861
2004-07-15 23:36:43 +00:00
Chris Lattner
f2c018c0c1
Fix PR404 try #2
...
This version takes about 1s longer than the previous one (down to 2.35s),
but on the positive side, it actually works :)
llvm-svn: 14856
2004-07-15 08:20:22 +00:00
Chris Lattner
daa12135da
Revert previous patch until I get a bug fixed
...
llvm-svn: 14853
2004-07-15 05:36:31 +00:00
Chris Lattner
70177e402d
Fix PR404: Loop simplify is really slow on 252.eon
...
This eliminates an N*N*logN algorithm from the loop simplify pass, replacing
it with a much simpler and faster alternative. In a debug build, this reduces
gccas time on eon from 85s to 42s.
llvm-svn: 14851
2004-07-15 04:27:04 +00:00
Chris Lattner
9a63520b1a
Fixes working towards PR341
...
llvm-svn: 14839
2004-07-15 01:50:47 +00:00
Chris Lattner
ba7aef39fd
Now that we codegen the portable "sizeof" efficiently, we can use it for
...
malloc lowering. This means that lowerallocations doesn't need targetdata
anymore. yaay.
llvm-svn: 14835
2004-07-15 01:08:08 +00:00
Chris Lattner
35e24774eb
Factor some code to handle "load (constantexpr cast foo)" just like
...
"load (cast foo)". This allows us to compile C++ code like this:
class Bclass {
public: virtual int operator()() { return 666; }
};
class Dclass: public Bclass {
public: virtual int operator()() { return 667; }
} ;
int main(int argc, char** argv) {
Dclass x;
return x();
}
Into this:
int %main(int %argc, sbyte** %argv) {
entry:
call void %__main( )
ret int 667
}
Instead of this:
int %main(int %argc, sbyte** %argv) {
entry:
%x = alloca "struct.std::bad_typeid" ; <"struct.std::bad_typeid"*> [#uses=3]
call void %__main( )
%tmp.1.i.i = getelementptr "struct.std::bad_typeid"* %x, uint 0, uint 0, uint 0 ; <int (...)***> [#uses=1]
store int (...)** getelementptr ([3 x int (...)*]* %vtable for Bclass, int 0, long 2), int (...)*** %tmp.1.i.i
%tmp.3.i = getelementptr "struct.std::bad_typeid"* %x, int 0, uint 0, uint 0 ; <int (...)***> [#uses=1]
store int (...)** getelementptr ([3 x int (...)*]* %vtable for Dclass, int 0, long 2), int (...)*** %tmp.3.i
%tmp.5 = load int ("struct.std::bad_typeid"*)** cast (int (...)** getelementptr ([3 x int (...)*]* %vtable for Dclass, int 0, long 2) to int
("struct.std::bad_typeid"*)**) ; <int ("struct.std::bad_typeid"*)*> [#uses=1]
%tmp.6 = call int %tmp.5( "struct.std::bad_typeid"* %x ) ; <int> [#uses=1]
ret int %tmp.6
ret int 0
}
In order words, we now resolve the virtual function call.
llvm-svn: 14783
2004-07-13 01:49:43 +00:00
Chris Lattner
9eb9ccd9f6
Check to make sure types are sized before calling getTypeSize on them.
...
llvm-svn: 14649
2004-07-06 19:28:42 +00:00
Brian Gaeke
a501be556f
It doesn't matter what the 2nd operand is; if the GEP has 2 operands and
...
the first is a zero, we should leave it alone.
llvm-svn: 14648
2004-07-06 19:24:47 +00:00
Brian Gaeke
0e0fe8a2e9
Add helper function.
...
Don't touch GEPs for which DecomposeArrayRef is not going to do anything
special (e.g., < 2 indices, or 2 indices and the last one is a constant.)
llvm-svn: 14647
2004-07-06 18:15:39 +00:00
Chris Lattner
23b47b6af9
Implement rem.ll:test3
...
llvm-svn: 14640
2004-07-06 07:38:18 +00:00
Chris Lattner
98c6bdf251
Fix a minor bug where we would go into infinite loops on some constants
...
llvm-svn: 14638
2004-07-06 07:11:42 +00:00
Chris Lattner
7fd5f0745a
Implement InstCombine/sub.ll:test15: X % -Y === X % Y
...
Also, remove X % -1 = 0, because it's not true for unsigneds, and the
signed case is superceeded by this new handling.
llvm-svn: 14637
2004-07-06 07:01:22 +00:00
Reid Spencer
eb04d9bcb4
Add #include <iostream> since Value.h does not #include it any more.
...
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Chris Lattner
4c9c20af28
Implement add.ll:test22, a common case in MSIL files
...
llvm-svn: 14587
2004-07-03 00:26:11 +00:00
Chris Lattner
49df6cefa5
Do not call getTypeSize on a type that has no size
...
llvm-svn: 14584
2004-07-02 22:55:47 +00:00
Brian Gaeke
e1a136fb4b
Get rid of a dead variable, and fix a typo in a comment.
...
llvm-svn: 14560
2004-07-02 05:30:01 +00:00
Brian Gaeke
163c87fc32
Make this pass use a more specific debug message than "Processing:".
...
llvm-svn: 14541
2004-07-01 19:27:10 +00:00
Chris Lattner
6e07936ed2
Implement InstCombine/add.ll:test21
...
llvm-svn: 14443
2004-06-27 22:51:36 +00:00
Chris Lattner
7f4222237d
New constant expression lowering pass to simplify your instruction selection needs.
...
Contributed by Vladimir Prus!
llvm-svn: 14399
2004-06-25 07:48:09 +00:00
Chris Lattner
7a002d6010
Two fixes. First, stop using the ugly shouldSubstituteIndVar method.
...
Second, disable substitution of quadratic addrec expressions to avoid putting
multiplies in loops!
llvm-svn: 14358
2004-06-24 06:49:18 +00:00
Chris Lattner
c9e06336ab
Make use of BinaryOperator::create* methods to shrinkify code.
...
llvm-svn: 14262
2004-06-20 05:04:01 +00:00
Chris Lattner
42ad646104
Now that dominator tree children are built in determinstic order, this horrible code
...
can go away
llvm-svn: 14254
2004-06-19 20:23:35 +00:00
Chris Lattner
4027500e1c
Fix a nasty bug, noticed by Reid
...
llvm-svn: 14249
2004-06-19 18:15:50 +00:00
Chris Lattner
ec2d34cc19
Fix one source of nondeterminism in the -licm pass: the hoist pass
...
was processing blocks in whatever order they happened to end up in the
dominator tree data structure. Force an ordering.
llvm-svn: 14248
2004-06-19 08:56:43 +00:00
Chris Lattner
b5f8eb8315
Do not loop over uses as we delete them. This causes iterators to be
...
invalidated out from under us. This bug goes back to revision 1.1: scary.
llvm-svn: 14242
2004-06-19 02:02:22 +00:00
Chris Lattner
023a483c76
Implement Transforms/InstCombine/and.ll:test17, a common case that
...
occurs due to unordered comparison macros in math.h
llvm-svn: 14221
2004-06-18 06:07:51 +00:00
Chris Lattner
97bfcea262
Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
...
Delete two functions that are now methods on the Type class
llvm-svn: 14200
2004-06-17 18:16:02 +00:00
Brian Gaeke
661963c63f
Fix typo in DEBUG printout.
...
llvm-svn: 14196
2004-06-17 07:26:52 +00:00