Commit Graph

1742 Commits

Author SHA1 Message Date
Chris Lattner
dade2d22ba Two bug fixes:
1. Actually increment the Statistic for the GV elim optzn
 2. When resolving undef branches, only resolve branches in executable blocks,
    avoiding marking a bunch of completely dead blocks live.  This has a big
    impact on the quality of the generated code.

With this patch, we positively rip up vortex, compiling Ut_MoveBytes to a
single memcpy call. In vortex we get this:

     12 ipsccp           - Number of globals found to be constant
    986 ipsccp           - Number of arguments constant propagated
   1378 ipsccp           - Number of basic blocks unreachable
   8919 ipsccp           - Number of instructions removed


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18796 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 06:05:53 +00:00
Chris Lattner
864737bf9e Do not delete the entry block to a function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18795 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 05:32:19 +00:00
Chris Lattner
dd336d196e Implement Transforms/SCCP/ipsccp-gvar.ll, by tracking values stored to
non-address-taken global variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18790 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 05:15:59 +00:00
Chris Lattner
0417feba29 Fix a bug where we could delete dead invoke instructions with uses.
In functions where we fully constant prop the return value, replace all
ret instructions with 'ret undef'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18786 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 02:53:57 +00:00
Chris Lattner
5f9e8b4c3f Implement SCCP/ipsccp-conditional.ll, by totally deleting dead blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18781 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 22:29:08 +00:00
Chris Lattner
fc6ac50619 Fix SCCP/2004-12-10-UndefBranchBug.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18776 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 20:41:50 +00:00
Chris Lattner
7613437db9 Fix Regression/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll,
and the failure on make_dparser last night.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18766 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 17:42:31 +00:00
Chris Lattner
59acc7d4ef This is the initial implementation of IPSCCP, as requested by Brian.
This implements SCCP/ipsccp-basic.ll, rips apart Olden/mst (as described in
PR415), and does other nice things.

There is still more to come with this, but it's a start.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18752 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-10 08:02:06 +00:00
Chris Lattner
13eaf4f14d note to self: Do not check in debugging code!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18693 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-09 07:15:52 +00:00
Chris Lattner
96a52a6f6c Implement trivial sinking for load instructions. This causes us to sink 567 loads in spec
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18692 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-09 07:14:34 +00:00
Chris Lattner
ea1c45405d Do extremely simple sinking of instructions when they are only used in a
successor block.  This turns cases like this:

x = a op b
if (c) {
  use x
}

into:

if (c) {
  x = a op b
  use x
}

This triggers 3965 times in spec, and is tested by
Regression/Transforms/InstCombine/sink_instruction.ll

This appears to expose a bug in the X86 backend for 177.mesa, which I'm
looking in to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18677 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 23:43:58 +00:00
Alkis Evlogimenos
54a96a2ad6 Fix this regression and remove the XFAIL from this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18674 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 23:10:30 +00:00
Chris Lattner
2a0cd9c9b5 Fix Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18670 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 22:20:34 +00:00
Chris Lattner
17a213ad8b Add support for compilers without argument dependent name lookup, contributed
by Bjørn Wennberg


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18627 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 16:12:20 +00:00
Chris Lattner
f2fd400258 Remove unneeded class qualifier, contributed by Bjørn Wennberg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18625 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-08 16:05:02 +00:00
Reid Spencer
791a959e57 For PR387:\
Add doInitialization method to avoid overloaded virtuals


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18602 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-07 08:11:36 +00:00
Chris Lattner
dd0ecf6731 Implement stripping of debug symbols, making the --strip-debug options in
gccas/gccld more than just a noop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18456 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-03 16:22:08 +00:00
Chris Lattner
e3ad43c828 Initial reimplementation of the -strip pass, with a stub for implementing
-S


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18440 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 21:25:03 +00:00
Chris Lattner
6992afcdb9 This pass is moving to lib IPO
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18439 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 21:24:40 +00:00
Chris Lattner
fa07e4fc30 Implement a FIXME by checking to make sure that a malloc is not being used
in scary and unknown ways before we promote it.  This fixes the miscompilation
of 188.ammp that has been plauging us since a globalopt patch went in.

Thanks a ton to Tanya for helping me diagnose the problem!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18418 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 07:11:07 +00:00
Chris Lattner
bc965b97ad Fix a minor bug where we set a var to initialized on malloc, not on store.
This doesn't fix anything that I'm aware of, just noticed it by inspection


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18417 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-02 06:25:58 +00:00
Chris Lattner
6b205c3ef1 This pass is completely broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18387 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 17:09:06 +00:00
Chris Lattner
0f535c6fa8 Squelch warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18381 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 07:47:34 +00:00
Chris Lattner
5a85d9c664 Fix test/Regression/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.llx
This only fails on darwin or on X86 under valgrind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18377 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 07:01:15 +00:00
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