Commit Graph

1718 Commits

Author SHA1 Message Date
Chris Lattner
6f9e571529 Alkis noticed that this variable is dead. Thanks!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18369 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 04:01:44 +00:00
Chris Lattner
37dc938bbe If we have something like this:
if (x) {
    code
    ...
  } else {
    code
    ...
  }

Turn it into:

  code
  if (x) {
    ...
  } else {
    ...
  }

This reduces code size and in some common cases allows us to completely
eliminate the conditional.  This turns several if/then/else blocks in loops
into straightline code in 179.art, turning the loops into single basic blocks
(good for modsched even!).

Maybe now brg will leave me alone ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18366 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 00:29:14 +00:00
Chris Lattner
8a9193927a Allow hoisting loads of globals and alloca's in conditionals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18363 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-29 21:26:12 +00:00
Reid Spencer
6731d5c494 Fix for PR454:
* Make sure we handle signed to unsigned conversion correctly
* Move this visitSetCondInst case to its own method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18312 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-28 21:31:15 +00:00
Chris Lattner
8305a64dce Make DSE potentially more aggressive by being more specific about alloca sizes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18309 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-28 20:44:37 +00:00
Chris Lattner
646641e02c Implement Regression/Transforms/InstCombine/getelementptr_cast.ll, which
occurs many times in crafty


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18273 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-27 17:55:46 +00:00
Chris Lattner
f3e1d6977e Provide size information when checking to see if we can LICM a load, this
allows us to hoist more loads in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18265 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-26 21:20:09 +00:00
Chris Lattner
b9df9b4c88 Do not count debugger intrinsics in size estimation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18110 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 17:23:57 +00:00
Chris Lattner
8db93f18cc Ignore debugger intrinsics when doing inlining size computations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18109 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 17:21:44 +00:00
Chris Lattner
64613ea8c8 Do not consider debug intrinsics in the size computations for loop unrolling.
Patch contributed by Michael McCracken!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18108 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 17:18:36 +00:00
Misha Brukman
e74c73cf46 Allow constructor parameter to override aggregating args; fix spacing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18028 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 02:20:27 +00:00
Chris Lattner
7b73a663bc Fix the exposed prototype for the lower packed pass, thanks to
Morten Ofstad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17996 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 16:49:34 +00:00
Chris Lattner
4a389b697c CPR is dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17992 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 16:24:57 +00:00
Chris Lattner
954f66a8cd Delete stoppoints that occur for the same source line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17970 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-18 21:41:39 +00:00
Chris Lattner
56de0363e3 Check in hook that I forgot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17956 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-18 17:24:20 +00:00
Chris Lattner
73559b1f4c Do not delete dead invoke instructions!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17897 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 16:32:28 +00:00
Reid Spencer
96326f9d31 Remove unused variable for compilation by VC++.
Patch contributed by Morten Ofstad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17830 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 17:29:41 +00:00
Chris Lattner
14051812ff Minor cleanups. There is no reason for SCCP to derive from instvisitor anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17825 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 07:15:04 +00:00
Chris Lattner
b77d5d8d50 Count more accurately
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17824 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 07:02:42 +00:00
Chris Lattner
50e60c7026 Quiet warnings on the persephone tester
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17821 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 05:54:07 +00:00
Chris Lattner
7e529e4b3c Two minor improvements:
1. Speedup getValueState by having it not consider Arguments.  It's better
    to just add them before we start SCCP'ing.
 2. SCCP can delete the contents of dead blocks.  No really, it's ok!  This
    reduces the size of the IR for subsequent passes, even though
    simplifycfg would do the same job.  In practice, simplifycfg does not
    run until much later than sccp in gccas


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17820 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 05:45:33 +00:00
Chris Lattner
ef36dfd31a rename InstValue to LatticeValue, as it holds for more than instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17818 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 05:03:30 +00:00
Chris Lattner
82bec2cff0 Substantially refactor the SCCP class into an SCCP pass and an SCCPSolver
class.  The only changes are minor:

 * Do not try to SCCP instructions that return void in the rewrite loop.
   This is silly and fool hardy, wasting a map lookup and adding an entry
   to the map which is never used.
 * If we decide something has an undefined value, rewrite it to undef,
   potentially leading to further simplications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17816 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 04:44:20 +00:00
Chris Lattner
bd38edfe23 If a global is just loaded and restored, realize that it is not changing
value.  This allows us to turn more globals into constants and eliminate them.
This patch implements GlobalOpt/load-store-global.llx.

Note that this patch speeds up 255.vortex from:

Output/255.vortex.out-cbe.time:program 7.640000
Output/255.vortex.out-llc.time:program 9.810000

to:

Output/255.vortex.out-cbe.time:program 7.250000
Output/255.vortex.out-llc.time:program 9.490000

Which isn't bad at all!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17746 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 20:50:30 +00:00
Chris Lattner
b58934484b This optimization makes MANY phi nodes that all have the same incoming value.
If this happens, detect it early instead of relying on instcombine to notice
it later.  This can be a big speedup, because PHI nodes can have many
incoming values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17741 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 19:29:34 +00:00
Chris Lattner
bac32866a7 Implement instcombine/phi.ll:test6 - pulling operations through PHI nodes.
This exposes subsequent optimization possiblities and reduces code size.
This triggers 1423 times in spec.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17740 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 19:13:23 +00:00
Chris Lattner
711b3402aa Transform this:
%X = alloca ...
  %Y = alloca ...
    X == Y

into false.  This allows us to simplify some stuff in eon (and probably
many other C++ programs) where operator= was checking for self assignment.
Folding this allows us to SROA several additional structs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17735 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 07:33:16 +00:00
Chris Lattner
6739eae7ea Remove note to self
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17734 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 06:57:47 +00:00
Chris Lattner
a990d94330 If a function always returns a constant, replace all calls sites with that
constant value.  This makes the return value dead and allows for
simplification in the caller.

This implements IPConstantProp/return-constant.ll

This triggers several dozen times throughout SPEC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17730 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 06:10:11 +00:00
Chris Lattner
d878ecd904 Teach SROA how to promote an array index that is variable, if the dimension
of the array is just two.  This occurs 8 times in gcc, 6 times in crafty, and
12 times in 099.go.

This implements ScalarRepl/sroa_two.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17727 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 05:00:19 +00:00
Chris Lattner
f5990edc87 Rearrange some code, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17724 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 04:24:28 +00:00
Chris Lattner
4c989b6bd7 Remove debugging code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17719 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 23:32:53 +00:00
Chris Lattner
11a3d7b7dd Argument promotion transforms functions to unconditionally load their
argument pointers.  This is only valid to do if the function already
unconditionally loaded an argument or if the pointer passed in is known
to be valid.  Make sure to do the required checks.

This fixed ArgumentPromotion/control-flow.ll and the Burg program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17718 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 23:31:34 +00:00
Chris Lattner
50af16a97b Simplify handling of shifts to be the same as we do for adds. Add support
for (X * C1) + (X * C2) (where * can be mul or shl), allowing us to fold:

   Y+Y+Y+Y+Y+Y+Y+Y

into
         %tmp.8 = shl long %Y, ubyte 3           ; <long> [#uses=1]

instead of

        %tmp.4 = shl long %Y, ubyte 2           ; <long> [#uses=1]
        %tmp.12 = shl long %Y, ubyte 2          ; <long> [#uses=1]
        %tmp.8 = add long %tmp.4, %tmp.12               ; <long> [#uses=1]

This implements add.ll:test25

Also add support for (X*C1)-(X*C2) -> X*(C1-C2), implementing sub.ll:test18


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17704 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 19:50:12 +00:00
Chris Lattner
65aedc1a4e Fold:
(X + (X << C2)) --> X * ((1 << C2) + 1)
   ((X << C2) + X) --> X * ((1 << C2) + 1)

This means that we now canonicalize "Y+Y+Y" into:

        %tmp.2 = mul long %Y, 3         ; <long> [#uses=1]

instead of:

        %tmp.10 = shl long %Y, ubyte 1          ; <long> [#uses=1]
        %tmp.6 = add long %Y, %tmp.10               ; <long> [#uses=1]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17701 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 19:31:40 +00:00
Chris Lattner
0c3b390a54 Lazily create the abort message, so only translation units that use unwind
will actually get it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17700 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 19:07:32 +00:00
Chris Lattner
9ecc046184 Fix: CodeExtractor/2004-11-12-InvokeExtract.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17699 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-13 00:06:45 +00:00
Chris Lattner
68c311aac6 Fix a bug where the code extractor would get a bit confused handling invoke
instructions, setting DefBlock to a block it did not have dom info for.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17697 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 23:50:44 +00:00
Chris Lattner
44c94b9671 Simplify handling of constant initializers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17696 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-12 22:42:57 +00:00
Chris Lattner
d79c7b43f4 Actually, leave the check in. This prevents us from counting dead arguments
as IPCP opportunities.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17680 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-11 07:47:54 +00:00
Chris Lattner
3e062eacab Fix bug: IPConstantProp/deadarg.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17679 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-11 07:46:29 +00:00
Chris Lattner
ff1529b6cf Make IP Constant prop more aggressive about handling self recursive calls.
This implements IPConstantProp/recursion.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17666 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-10 19:43:59 +00:00
Chris Lattner
c890bfe1da Do not let dead constant expressions hanging off of functions prevent IPCP.
This allows to elimination of a bunch of global pool descriptor args from
programs being pool allocated (and is also generally useful!)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17657 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-09 20:47:30 +00:00
Chris Lattner
a8e475093a Change this back so that I get stable numbers to reflect the change from the
nightly testers


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17646 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-09 08:05:23 +00:00
Chris Lattner
52f20f8308 Fix bug: 2004-11-08-FreeUseCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17642 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-09 05:10:56 +00:00
Chris Lattner
ae18963a70 VERY large functions that are only called from one place are not really
exciting to inline.  Only inline medium or small sized functions with a
single call site.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17588 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-07 21:46:47 +00:00
Chris Lattner
00a4fe48ac This is V9 specific, move it there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17545 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-07 00:39:26 +00:00
Chris Lattner
183f2eb860 Remove dead vars
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17482 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-05 04:46:22 +00:00
Chris Lattner
f158092801 Fix some warnings on VC++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17481 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-05 04:45:43 +00:00
Chris Lattner
d308f8a87f * Rearrange code slightly
* Disable broken transforms for simplifying (setcc (cast X to larger), CI)
  where CC is not != or ==


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17422 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-02 03:50:32 +00:00