Commit Graph

1526 Commits

Author SHA1 Message Date
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
Brian Gaeke 902dcf0729 These files don't need to include <iostream> since they include "Support/Debug.h".
llvm-svn: 15089
2004-07-21 20:50:33 +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 45b50d14c9 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 11ffd59e37 Implement Transforms/InstCombine/IntPtrCast.ll
llvm-svn: 15029
2004-07-20 05:21:00 +00:00
Chris Lattner ec67df0ed1 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 44d0b9502a Implement InstCombine/GEPIdxCanon.ll
llvm-svn: 15024
2004-07-20 01:48:15 +00:00
Chris Lattner 5823ac1c21 Implement SimplifyCFG/BrUnwind.ll
llvm-svn: 15022
2004-07-20 01:17:38 +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 e2774757fe Fix a performance regression from the CPR patch, simplify code
llvm-svn: 14974
2004-07-18 21:34:16 +00:00
Chris Lattner d47504d9db 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 f3edc49ae2 Minor cleanup, no functionality change
llvm-svn: 14972
2004-07-18 18:59:44 +00:00
Reid Spencer 3b4e83ec83 Remove an if statement that would never be reached.
llvm-svn: 14968
2004-07-18 08:41:47 +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 199aeb7f59 Avoid an unnecessary isa<Constant>.
llvm-svn: 14963
2004-07-18 08:31:18 +00:00
Chris Lattner 9238d78dc3 Remove useless statistic, fix some slightly broken logic
llvm-svn: 14958
2004-07-18 07:22:58 +00:00
Chris Lattner 2da5eee33c Fix a rather serious bug in previous checkin
llvm-svn: 14957
2004-07-18 06:56:58 +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
Reid Spencer 5f6815980b 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 83cae64faf bug 122:
- Excise dead CPR procesing.

llvm-svn: 14944
2004-07-18 00:23:51 +00:00
Reid Spencer e4de22874e 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 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 32c518e526 Progress on PR341
llvm-svn: 14840
2004-07-15 02:06:12 +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