Commit Graph

1759 Commits

Author SHA1 Message Date
Chris Lattner
68a9d3eb38 Adjust to new interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18958 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 07:22:25 +00:00
Chris Lattner
0ce8580fcd Constant exprs are not efficiently negatable in practice. This disables
turning X - (constantexpr) into X + (-constantexpr) among other things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18935 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-14 20:08:06 +00:00
Brian Gaeke
9d97547680 Fix link error in PPC optimized build of 'opt'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18913 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 21:28:39 +00:00
Chris Lattner
de97b5788c Get rid of getSizeOf, using ConstantExpr::getSizeOf instead.
do not insert a prototype for malloc of: void* malloc(uint): on 64-bit u
targets this is not correct.  Instead of prototype it as void *malloc(...),
and pass the correct intptr_t through the "...".

Finally, fix Regression/CodeGen/SparcV9/2004-12-13-MallocCrash.ll, by not
forming constantexpr casts from pointer to uint.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18908 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 20:00:02 +00:00
Chris Lattner
6b8efcd697 Change indentation of a whole bunch of code, no real changes here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18843 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 23:49:37 +00:00
Chris Lattner
387bc13575 More substantial simplifications and speedups. This makes ADCE about 20% faster
in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18842 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 23:40:17 +00:00
Chris Lattner
46356794ab More minor microoptimizations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18841 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 22:44:30 +00:00
Chris Lattner
4e51ccdd38 Remove some more set operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18840 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 22:22:18 +00:00
Chris Lattner
188839a219 Reduce number of set operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18839 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 22:16:13 +00:00
Chris Lattner
857e8cdd65 Optimize div/rem + select combinations more.
In particular, implement div.ll:test10 and rem.ll:test4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18838 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 21:48:58 +00:00
Chris Lattner
38c2556d0c Properly implement copying of a global, fixing the 255.vortex & povray
failures from last night.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18832 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 19:34:41 +00:00
Chris Lattner
fb851ab281 Simplify code and do not invalidate iterators.
This fixes a crash compiling TimberWolfMC that was exposed due to recent
optimizer changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18831 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 18:23:20 +00:00
Chris Lattner
077f1a8292 Though the previous xform applies to literally dozens (hundreds?) of variables
in SPEC, the subsequent optimziations that we are after don't play with
with FP values, so disable this xform for them.  Really we just don't want
stuff like:

double G;   (always 0 or 412312.312)
  = G;

turning into:

bool G_b;
  = G_b ? 412312.312 : 0;

We'd rather just do the load.

-Chris


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18819 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 06:03:06 +00:00
Chris Lattner
96a86b2993 If a variable can only hold two values, and is not already a bool, shrink it
down to actually BE a bool.  This allows simple value range propagation
stuff work harder, deleting comparisons in bzip2 in some hot loops.

This implements GlobalOpt/integer-bool.ll, which is the essence of the
loop condition distilled into a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18817 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-12 05:53:50 +00:00
Chris Lattner
a177c67471 If one side of and/or is known to be 0/-1, it doesn't matter
if the other side is overdefined.

This allows us to fold conditions like:  if (X < Y || Y > Z) in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 23:15:19 +00:00
Chris Lattner
2ffa47b6bf Only cound if we actually made a change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18800 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 17:00:14 +00:00
Chris Lattner
284d1b8827 The split bb is really the exit of the old function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-11 16:59:54 +00:00
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