Chris Lattner
a3c10c2012
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
62c40d3982
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
4e4b8b0ad2
Fix a serious code pessimization problem. If an inlined function has a single
...
return, clone the 'ret' BB code into the block AFTER the inlined call, not the
other way around.
llvm-svn: 15030
2004-07-20 05:45:24 +00:00
Chris Lattner
f8c20caf25
Implement Transforms/InstCombine/IntPtrCast.ll
...
llvm-svn: 15029
2004-07-20 05:21:00 +00:00
Chris Lattner
da83200d72
Ignore instructions that are in trivially dead functions. This allows us
...
to constify 14 globals instead of 4 in a trivial C++ testcase.
llvm-svn: 15027
2004-07-20 03:58:07 +00:00
Chris Lattner
f6eb30e9a8
Implement InstCombine/GEPIdxCanon.ll
...
llvm-svn: 15024
2004-07-20 01:48:15 +00:00
Chris Lattner
8277141f09
Implement SimplifyCFG/BrUnwind.ll
...
llvm-svn: 15022
2004-07-20 01:17:38 +00:00
Chris Lattner
d9c41a82a3
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
ffc1df7399
Fix a performance regression from the CPR patch, simplify code
...
llvm-svn: 14974
2004-07-18 21:34:16 +00:00
Chris Lattner
9de817e13e
Strip out and simplify some code. This also fixes the regression last
...
night compiling cfrac. It did not realize that code like this:
int G; int *H = &G;
takes the address of G.
llvm-svn: 14973
2004-07-18 19:56:20 +00:00
Chris Lattner
8c4d6aa7e8
Minor cleanup, no functionality change
...
llvm-svn: 14972
2004-07-18 18:59:44 +00:00
Reid Spencer
7b03169e0e
Remove an if statement that would never be reached.
...
llvm-svn: 14968
2004-07-18 08:41:47 +00:00
Reid Spencer
6d26720976
Delete a redundant if branch.
...
llvm-svn: 14967
2004-07-18 08:34:52 +00:00
Reid Spencer
3a18547fcb
Expand the coercion of constants to include the newly constant Globals.
...
llvm-svn: 14966
2004-07-18 08:34:19 +00:00
Reid Spencer
2b7bae6b4f
Delete a no-op loop.
...
llvm-svn: 14965
2004-07-18 08:32:43 +00:00
Reid Spencer
7236678c32
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
90795f0825
Avoid an unnecessary isa<Constant>.
...
llvm-svn: 14963
2004-07-18 08:31:18 +00:00
Chris Lattner
71f281984d
Remove useless statistic, fix some slightly broken logic
...
llvm-svn: 14958
2004-07-18 07:22:58 +00:00
Chris Lattner
99e46b2e81
Fix a rather serious bug in previous checkin
...
llvm-svn: 14957
2004-07-18 06:56:58 +00:00
Reid Spencer
7f33869f9b
bug 122:
...
- Replace ConstantPointerRef usage with GlobalValue usage
llvm-svn: 14953
2004-07-18 00:44:37 +00:00
Reid Spencer
14243817ec
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
51149979ce
bug 122:
...
- Minimize redundant isa<GlobalValue> usage
llvm-svn: 14948
2004-07-18 00:32:14 +00:00
Reid Spencer
2a8914b64b
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
66f4e3dc24
bug 122:
...
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
llvm-svn: 14946
2004-07-18 00:29:57 +00:00
Reid Spencer
2bfe4ec3cf
bug 122:
...
- Replace ConstantPointerRef usage with GlobalValue usage
- Rename methods to get ride of ConstantPointerRef usage
llvm-svn: 14945
2004-07-18 00:25:04 +00:00
Reid Spencer
55d436cc07
bug 122:
...
- Excise dead CPR procesing.
llvm-svn: 14944
2004-07-18 00:23:51 +00:00
Reid Spencer
56ec516cb4
bug 122:
...
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct test ordering for GlobalValue subclass
llvm-svn: 14943
2004-07-18 00:19:45 +00:00
Chris Lattner
952bbd726b
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
0193bbef1f
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
fde0e6bb95
Revert previous patch until I get a bug fixed
...
llvm-svn: 14853
2004-07-15 05:36:31 +00:00
Chris Lattner
9896dfb8e7
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
2db1894038
Progress on PR341
...
llvm-svn: 14840
2004-07-15 02:06:12 +00:00
Chris Lattner
0f61d55197
Fixes working towards PR341
...
llvm-svn: 14839
2004-07-15 01:50:47 +00:00
Chris Lattner
de4449ef34
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
fca5fee9d5
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
ed776e0c06
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
f9c3f6178a
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
ef192b1a19
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
560992669f
Implement rem.ll:test3
...
llvm-svn: 14640
2004-07-06 07:38:18 +00:00
Chris Lattner
97ebe25e6c
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
4d6c479f08
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
50ec3f9325
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
aafe5aea0d
Implement add.ll:test22, a common case in MSIL files
...
llvm-svn: 14587
2004-07-03 00:26:11 +00:00
Chris Lattner
1120899069
Do not call getTypeSize on a type that has no size
...
llvm-svn: 14584
2004-07-02 22:55:47 +00:00
Brian Gaeke
96e0f832f8
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
dbf4f13e85
Make this pass use a more specific debug message than "Processing:".
...
llvm-svn: 14541
2004-07-01 19:27:10 +00:00
Vikram S. Adve
5ad9c7dd34
Restoring this file.
...
llvm-svn: 14478
2004-06-29 14:20:27 +00:00
Chris Lattner
7d0108c315
Remove unused file
...
llvm-svn: 14460
2004-06-28 00:46:58 +00:00
Chris Lattner
975c95e99a
These passes are long dead/obsolete. They never worked in the first place
...
and are a maintenence burden. Nuke nuke nuke
llvm-svn: 14457
2004-06-28 00:44:18 +00:00
Chris Lattner
8cfa7ad533
Implement InstCombine/add.ll:test21
...
llvm-svn: 14443
2004-06-27 22:51:36 +00:00