Commit Graph

24633 Commits

Author SHA1 Message Date
Chris Lattner
f4f5a77fdc Two changes:
1. Implement InstCombine/deadcode.ll by not adding instructions in unreachable
   blocks (due to constants in conditional branches/switches) to the worklist.
   This causes them to be deleted before instcombine starts up, leading to
   better optimization.

2. In the prepass over instructions, do trivial constprop/dce as we go.  This
   has the effect of improving the effectiveness of #1.  In addition, it
   *significantly* speeds up instcombine on test cases with large amounts of
   constant folding code (for example, that produced by code specialization
   or partial evaluation).  In one example, it speeds up instcombine from
   0.0589s to 0.0224s with a release build (a 2.6x speedup).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28215 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 19:00:36 +00:00
Chris Lattner
99266d81a2 New testcase, check that dead code doesn't pessimize instcombine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28214 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 18:56:04 +00:00
Chris Lattner
3e6a35076e Fix the PowerPC JIT-only failure on UnitTests/Vector/sumarray-dbl, which is
really a bad codegen bug that LLC happens to get lucky with. I must chat with
Nate for the proper fix.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28213 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 06:38:32 +00:00
Evan Cheng
90db0358bb Templatify RegReductionPriorityQueue
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28212 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 06:16:44 +00:00
Chris Lattner
b77780e11e Add alloca/malloc ctors that don't take array sizes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28211 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 04:38:35 +00:00
Chris Lattner
e46749cce0 Add an assertion for a common error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28210 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 04:32:43 +00:00
Evan Cheng
3eff89bf89 Watch out for the following case:
1. Use expects a chain output.
2. Node is expanded into multiple target ops.
3. One of the inner node produces a chain, the outer most one doesn't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28209 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 02:47:57 +00:00
Evan Cheng
045953c37a Fix a load folding bug. It is exposed by a multi- resulting instructions
def : Pat<> pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28208 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-10 00:05:46 +00:00
Nate Begeman
ec57fd91af Fix PR773
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28207 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 18:20:51 +00:00
Chris Lattner
631a19d894 This method doesn't need to be virtual, thanks to Reid for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28206 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 17:29:17 +00:00
Chris Lattner
c8d37c6e14 Fix a regression in my patch from last night that broke the llvmgcc4 build on
ppc


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28205 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 16:41:59 +00:00
Chris Lattner
219f1b535d Indent .data/.text in the .s file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28204 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 16:15:00 +00:00
Evan Cheng
506b94f8cd Another instruction scheduling test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28203 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 07:20:24 +00:00
Evan Cheng
b63b067925 Add pseudo dependency to force a def&use operand to be scheduled last (unless
the distance between the def and another use is much longer). This is under
option control for now "-sched-lower-defnuse".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28201 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 07:13:34 +00:00
Evan Cheng
60e8c71c9f Debugging info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28200 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 06:55:15 +00:00
Evan Cheng
8399c5cbe4 Remove a completed entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28199 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 06:54:05 +00:00
Evan Cheng
5255b39b21 Test case for PR770
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28198 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 06:48:12 +00:00
Evan Cheng
e73701df94 PR 770 - permit coallescing of registers in subset register classes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28197 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 06:37:48 +00:00
Evan Cheng
696736be8b Added sub- register classes information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28196 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 06:35:30 +00:00
Evan Cheng
8d58e6a9be Add sub-register class information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28195 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 06:34:26 +00:00
Chris Lattner
7faec9b93a Implement MASM sections correctly, without a "has masm sections flag" and a bunch of special case code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28194 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:33:48 +00:00
Chris Lattner
b6c76ec46e Implement MASM sections correctly, without a "has masm sections flag" and a
bunch of special case code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28193 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:33:28 +00:00
Chris Lattner
a7090ae7a3 Oh yeah, there are two of these now, unify both.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28192 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:24:50 +00:00
Chris Lattner
b81cb6133e Setting SwitchToSectionDirective properly in the MASM backend permits a bunch
of code to be unified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28191 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:23:12 +00:00
Chris Lattner
c9260a1556 MASM doesn't have one of these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28190 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:21:47 +00:00
Chris Lattner
23b9eac4cb Don't prefix section directives with a tab. Doing so causes blank lines to
be emitted to the .s file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28189 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:19:59 +00:00
Chris Lattner
13f161c518 Make the masm codepath work like the normal code path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28188 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:15:58 +00:00
Chris Lattner
e7027d5339 Preserve prior behavior
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28187 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:15:24 +00:00
Chris Lattner
4ca4bb1ed2 The MASM asmprinter has been fixed, these hacks are no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28186 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:13:34 +00:00
Chris Lattner
dad9c5a14f Fix the MASM asmprinter's lies. It does not want to emit code to .text/.data
it wants it emitted to _text/_data.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28185 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 05:12:53 +00:00
Chris Lattner
4632d7a570 Split SwitchSection into SwitchTo{Text|Data}Section methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28184 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 04:59:56 +00:00
Chris Lattner
f668ffc4c2 Split SwitchSection into the SwitchTo{Text|Data}Section functions, to better
support assemblers that distinguish the two.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28183 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 04:59:30 +00:00
Chris Lattner
4c15e33946 Some notes and thoughts to myself
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28182 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 04:58:46 +00:00
Chris Lattner
8d89e7bdbc Patch to make some xforms preserve each other. Patch contributed by
Domagoj Babic!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28181 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 04:13:41 +00:00
Reid Spencer
b5d75b8618 Use the -dumpversion option to llvm-gcc which gives us just the version #
and is unlikely to change in future releases. This also simplifies the
parsing of the full and major llvm-gcc version numbers in the script.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28180 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 00:31:01 +00:00
Chris Lattner
e7fd553b3b Move some methods out of line so that MutexGuard.h isn't needed in a public header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28179 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 22:00:52 +00:00
Chris Lattner
683d1bb712 Move methods out of line so that MutexGuard.h isn't required in the header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28178 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 22:00:26 +00:00
Chris Lattner
9fd868ae0a Another bad case I noticed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28177 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 21:39:45 +00:00
Chris Lattner
8ef67ac3c3 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28176 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 21:24:21 +00:00
Chris Lattner
4b37e87ab9 Make the case I just checked in stronger. Now we compile this:
short test2(short X, short x) {
  int Y = (short)(X+x);
  return Y >> 1;
}

to:

_test2:
        add r2, r3, r4
        extsh r2, r2
        srawi r3, r2, 1
        blr

instead of:

_test2:
        add r2, r3, r4
        extsh r2, r2
        srwi r2, r2, 1
        extsh r3, r2
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28175 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 21:18:59 +00:00
Chris Lattner
eaeda56649 Implement and_sext.ll:test3, generating:
_test4:
        srawi r3, r3, 16
        blr

instead of:

_test4:
        srwi r2, r3, 16
        extsh r3, r2
        blr

for:

short test4(unsigned X) {
  return (X >> 16);
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28174 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 20:59:41 +00:00
Chris Lattner
9b9a3cfe54 new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28173 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 20:58:58 +00:00
Nate Begeman
7514620052 Yet more readme updating
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28172 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 20:54:02 +00:00
Chris Lattner
a850446a0b Compile this:
short test4(unsigned X) {
  return (X >> 16);
}

to:

_test4:
        movl 4(%esp), %eax
        sarl $16, %eax
        ret

instead of:

_test4:
        movl $-65536, %eax
        andl 4(%esp), %eax
        sarl $16, %eax
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28171 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 20:51:54 +00:00
Nate Begeman
fcf64a91d6 New note about something bad happening in target independent optimizers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28170 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 20:08:28 +00:00
Nate Begeman
d8624ed07f Proving once again that I am not as smart as the compiler
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28169 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 19:09:24 +00:00
Nate Begeman
4667f2cbad Fold more shifts into inserts, and update the README
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28168 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 17:38:32 +00:00
Chris Lattner
2cfd6746ae Fold shifts with undef operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28167 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 17:29:49 +00:00
Chris Lattner
1b7371331f When tracking demanded bits, if any bits from the sext of an SRA are demanded,
then so is the input sign bit.  This fixes mediabench/g721 on X86.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28166 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 17:22:53 +00:00
Nate Begeman
17c275ff2c Make emission of jump tables a bit less conservative; they are now required
to be only 31.25% dense, rather than 75% dense.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28165 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 16:51:36 +00:00