Commit Graph

1543 Commits

Author SHA1 Message Date
Chris Lattner 4956a32c9e Fix another really nasty regression that Anshu pointed out. In cases where
dangling constant users were removed from a function, causing it to be dead,
we never removed the call graph edge from the external node to the function.

In most cases, this didn't cause a problem (by luck).  This should definitely
go into 1.3

llvm-svn: 15570
2004-08-08 03:29:50 +00:00
Chris Lattner 92b9906199 Two fixes:
1. Fix a REALLY nasty cyclic replacement issue that Anshu discovered, causing
   nondeterminstic crashes and memory corruption.
2. For performance, don't go inserting constantexpr casts of GV pointers.

This should definitely go into 1.3

llvm-svn: 15568
2004-08-08 01:30:07 +00:00
Chris Lattner 6a93462144 This DEBUG is buggy. comment it out because it's not worth fixing. This
should go into 1.3

llvm-svn: 15567
2004-08-08 01:27:56 +00:00
Alkis Evlogimenos 832437255d Stop using getValues().
llvm-svn: 15487
2004-08-04 08:44:43 +00:00
Chris Lattner 7aa2d4747a Fix a regression in InstCombine/xor.ll
llvm-svn: 15410
2004-08-01 19:42:59 +00:00
Chris Lattner 7471b96a05 Expose this as a functionpass
llvm-svn: 15369
2004-07-31 10:01:58 +00:00
Misha Brukman 9c003d8f65 Fix De Morgan's name.
llvm-svn: 15343
2004-07-30 12:50:08 +00:00
Chris Lattner d4252a7c64 Start using the PatternMatcher a bit.
llvm-svn: 15342
2004-07-30 07:50:03 +00:00
Misha Brukman f4a410f907 Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15337
2004-07-29 17:30:57 +00:00
Misha Brukman 63b38bd2ed Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15334
2004-07-29 17:30:56 +00:00
Misha Brukman 2b3387a6d9 Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15328
2004-07-29 17:05:13 +00:00
Alkis Evlogimenos fd7a2d4477 Merge i*.h headers into Instructions.h as part of bug403.
llvm-svn: 15325
2004-07-29 12:17:34 +00:00
Robert Bocchino 7b5b86cd0f This change fixed a bug in the function visitMul. The prior version
assumed that a constant on the RHS of a multiplication was either an
IntConstant or an FPConstant.  It checked for an IntConstant and then,
if it did not find one, did a hard cast to an FPConstant.  That code
would crash if the RHS were a ConstantExpr that was neither an
IntConstant nor an FPConstant.  This version replaces the hard cast
with a dyn_cast.  It performs the same way for IntConstants and
FPConstants but does nothing, instead of crashing, for constant
expressions.

The regression test for this change is 2004-07-27-ConstantExprMul.ll.

llvm-svn: 15291
2004-07-27 21:02:21 +00:00
Brian Gaeke 38b79e8fbc Make the create...() functions for some of these passes return a FunctionPass *.
llvm-svn: 15276
2004-07-27 17:43:21 +00:00
Chris Lattner 50eb771d37 Fix hoisting of void typed values, e.g. calls
llvm-svn: 15263
2004-07-27 07:38:32 +00:00
Chris Lattner f29807169a Implement DeadStoreElim/alloca.llx by observing that allocas are dead at the
end of the function (either return or unwind)

llvm-svn: 15232
2004-07-26 06:14:11 +00:00
Chris Lattner e5ad26dbb3 Throttle back indvar substitution from creating multiplies in loops. This is bad bad bad.
llvm-svn: 15227
2004-07-26 02:47:12 +00:00
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