Commit Graph

1555 Commits

Author SHA1 Message Date
Reid Spencer
42e83feba7 Initial checkin of a pass to lower packed operations to scalars operations.
This also registers the pass with opt with a -lower-packed command line
option.

Patch contributed by Brad Jones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15987 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-21 21:39:24 +00:00
Chris Lattner
4e4c444d5c If we are linking two global variables and they have the same size, do not
spew warnings, even if the types don't match.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15933 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-20 00:30:39 +00:00
Chris Lattner
77a2a9d9da Implement test/Regression/Transforms/GlobalConstifier/phi-select.llx
This allows more globals to be marked constant, particularly global arrays.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15735 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-14 20:57:17 +00:00
Chris Lattner
a670c684a6 If we are extracting a block that has multiple successors that are the same
block (common in a switch), make sure to remove extra edges in successor
blocks.  This fixes CodeExtractor/2004-08-12-BlockExtractPHI.ll and should
be pulled into LLVM 1.3 (though the regression test need not be, as that
would require pulling in the LoopExtract.cpp changes).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15717 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-13 03:27:07 +00:00
Chris Lattner
337772832b When we code extract some stuff, leave the codeRepl block in the place where
the extracted code was, instead of putting it at the end of the function


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15716 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-13 03:17:39 +00:00
Chris Lattner
8528672e7e "extract" the block extractor pass from bugpoint (haha)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15714 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-13 03:05:17 +00:00
Chris Lattner
eb6f18fe7c Add value mapper support for select constant exprs. This should fix a bug
Nate ran into when bugpointing siod.  This fix should go into LLVM 1.3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15712 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-13 02:43:19 +00:00
Chris Lattner
ee45f4cbe4 This patch makes the inliner refuse to inline functions that have alloca
instructions in the body of the function (not the entry block).  This fixes
test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c
and test/Programs/External/SPEC/CINT2000/176.gcc on zion.

This should obviously be pulled into 1.3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15684 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-12 05:45:09 +00:00
Chris Lattner
b519efbafe Fix code extraction of unwind blocks. This fixed bugs that bugpoint can
run into.  This should go into 1.3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15679 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-12 03:17:02 +00:00
Chris Lattner
a5de823844 Hrm, this pass didn't compile. This bugfix should go into 1.3!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15676 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-12 02:44:23 +00:00
Chris Lattner
5dbef2207e Fix InstCombine/2004-08-10-BoolSetCC.ll, a bug that is miscompiling
176.gcc.  Note that this is apparently not the only bug miscompiling gcc
though. :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15639 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-11 00:50:51 +00:00
Chris Lattner
b49f306bdf Fix InstCombine/2004-08-09-RemInfLoop.llx
This should go into the 1.3 branch


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15593 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-09 21:05:48 +00:00
Chris Lattner
54970c0328 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15570 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-08 03:29:50 +00:00
Chris Lattner
68392422e6 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15568 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-08 01:30:07 +00:00
Chris Lattner
5e2e27284b This DEBUG is buggy. comment it out because it's not worth fixing. This
should go into 1.3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15567 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-08 01:27:56 +00:00
Alkis Evlogimenos
15876bb28c Stop using getValues().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15487 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 08:44:43 +00:00
Chris Lattner
1484089bbf Fix a regression in InstCombine/xor.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15410 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-01 19:42:59 +00:00
Chris Lattner
1e5fdf8ba0 Expose this as a functionpass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15369 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-31 10:01:58 +00:00
Misha Brukman
cb6267bc60 Fix De Morgan's name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15343 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-30 12:50:08 +00:00
Chris Lattner
acd1f0fcb3 Start using the PatternMatcher a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15342 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-30 07:50:03 +00:00
Misha Brukman
78c038d0cc Fix #includes of i*.h => Instructions.h as per PR403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15337 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 17:30:57 +00:00
Misha Brukman
47b14a4a6a Fix #includes of i*.h => Instructions.h as per PR403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15334 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 17:30:56 +00:00
Misha Brukman
d8e1eea678 Fix #includes of i*.h => Instructions.h as per PR403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15328 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 17:05:13 +00:00
Alkis Evlogimenos
eb62bc77b6 Merge i*.h headers into Instructions.h as part of bug403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15325 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 12:17:34 +00:00
Robert Bocchino
71698285e8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15291 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 21:02:21 +00:00
Brian Gaeke
96d4bf7aee Make the create...() functions for some of these passes return a FunctionPass *.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15276 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 17:43:21 +00:00
Chris Lattner
eaa243039b Fix hoisting of void typed values, e.g. calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15263 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 07:38:32 +00:00
Chris Lattner
a000279a7d Implement DeadStoreElim/alloca.llx by observing that allocas are dead at the
end of the function (either return or unwind)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15232 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 06:14:11 +00:00
Chris Lattner
595ee7ec26 Throttle back indvar substitution from creating multiplies in loops. This is bad bad bad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15227 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 02:47:12 +00:00
Chris Lattner
70e9b59b0e * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15204 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 11:09:56 +00:00
Chris Lattner
a9e2f3d0ab Free instructions kill values too. This implements DeadStoreElim/free.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15199 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 07:58:38 +00:00
Chris Lattner
c47b6677ae obvious fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15162 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-24 07:51:27 +00:00
Chris Lattner
0fb56afab1 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 :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15101 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-22 08:00:28 +00:00
Chris Lattner
93c9587fbb 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15097 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-22 05:51:13 +00:00
Brian Gaeke
7848e68c16 These files don't need to include <iostream> since they include "Support/Debug.h".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15089 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 20:50:33 +00:00
Chris Lattner
f0cacc0ae7 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15085 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 20:14:10 +00:00
Chris Lattner
5eb919405c Make cast-cast code a bit more defensive
"simplify" a bit of code for comparison/and folding


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15082 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 19:50:44 +00:00
Chris Lattner
e8a7e593e6 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15063 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 04:27:24 +00:00
Chris Lattner
adfd32f8ee 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15030 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 05:45:24 +00:00
Chris Lattner
59a20773f8 Implement Transforms/InstCombine/IntPtrCast.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15029 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 05:21:00 +00:00
Chris Lattner
9ce300013d Ignore instructions that are in trivially dead functions. This allows us
to constify 14 globals instead of 4 in a trivial C++ testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15027 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 03:58:07 +00:00
Chris Lattner
67769e5efa Implement InstCombine/GEPIdxCanon.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15024 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 01:48:15 +00:00
Chris Lattner
af17b1df84 Implement SimplifyCFG/BrUnwind.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15022 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 01:17:38 +00:00
Chris Lattner
bee7e7644b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15018 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-20 00:59:32 +00:00
Chris Lattner
8919cccc3d Fix a performance regression from the CPR patch, simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14974 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 21:34:16 +00:00
Chris Lattner
96940cb522 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14973 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 19:56:20 +00:00
Chris Lattner
9db07b9307 Minor cleanup, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14972 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 18:59:44 +00:00
Reid Spencer
e95ff9afa0 Remove an if statement that would never be reached.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14968 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 08:41:47 +00:00
Reid Spencer
c88920df66 Delete a redundant if branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14967 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 08:34:52 +00:00
Reid Spencer
c3c2fdf5a8 Expand the coercion of constants to include the newly constant Globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14966 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 08:34:19 +00:00