oota-llvm.git
15 years agoSplit foldMemoryOperand into public non-virtual and protected virtual
Dan Gohman [Wed, 3 Dec 2008 18:43:12 +0000 (18:43 +0000)]
Split foldMemoryOperand into public non-virtual and protected virtual
parts, and add target-independent code to add/preserve
MachineMemOperands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60488 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRename isSimpleLoad to canFoldAsLoad, to better reflect its meaning.
Dan Gohman [Wed, 3 Dec 2008 18:15:48 +0000 (18:15 +0000)]
Rename isSimpleLoad to canFoldAsLoad, to better reflect its meaning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60487 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoExtend X86's addFrameReference to add a MachineMemOperand for
Dan Gohman [Wed, 3 Dec 2008 18:11:40 +0000 (18:11 +0000)]
Extend X86's addFrameReference to add a MachineMemOperand for
the frame reference. This will help post-RA scheduling determine
that spills to distinct stack slots are independent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60486 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix some tests. The grep for "il" was matching "file".
Rafael Espindola [Wed, 3 Dec 2008 17:14:56 +0000 (17:14 +0000)]
Fix some tests. The grep for "il" was matching "file".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60485 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUpdate a comment.
Dan Gohman [Wed, 3 Dec 2008 17:10:41 +0000 (17:10 +0000)]
Update a comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60484 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoOnly check that the result of the mapping was not
Duncan Sands [Wed, 3 Dec 2008 12:36:16 +0000 (12:36 +0000)]
Only check that the result of the mapping was not
a new node if the node was actually remapped.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60482 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix bug 3140.
Rafael Espindola [Wed, 3 Dec 2008 11:01:37 +0000 (11:01 +0000)]
Fix bug 3140.
Print a single parameter .file directive if we have an ELF target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60480 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for ISD::TRAP to the XCore backend
Richard Osborne [Wed, 3 Dec 2008 10:59:16 +0000 (10:59 +0000)]
Add support for ISD::TRAP to the XCore backend

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60479 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRefactor code. No functionality change.
Evan Cheng [Wed, 3 Dec 2008 08:38:43 +0000 (08:38 +0000)]
Refactor code. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60478 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCC should only be a ConstantSDNode at this point. Just use 'cast' instead of 'dyn_cast'.
Bill Wendling [Wed, 3 Dec 2008 08:32:02 +0000 (08:32 +0000)]
CC should only be a ConstantSDNode at this point. Just use 'cast' instead of 'dyn_cast'.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60477 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix test.
Evan Cheng [Wed, 3 Dec 2008 08:20:45 +0000 (08:20 +0000)]
Fix test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60476 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agotestcase for br undef folding.
Chris Lattner [Wed, 3 Dec 2008 07:48:27 +0000 (07:48 +0000)]
testcase for br undef folding.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60471 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTeach jump threading some more simple tricks:
Chris Lattner [Wed, 3 Dec 2008 07:48:08 +0000 (07:48 +0000)]
Teach jump threading some more simple tricks:

1) have it fold "br undef", which does occur with
   surprising frequency as jump threading iterates.
2) teach j-t to delete dead blocks.  This removes the successor
   edges, reducing the in-edges of other blocks, allowing
   recursive simplification.
3) Fold things like:
     br COND, BBX, BBY
  BBX:
     br COND, BBZ, BBW

   which also happens because jump threading iterates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60470 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agothird time is the charm.
Chris Lattner [Wed, 3 Dec 2008 07:45:15 +0000 (07:45 +0000)]
third time is the charm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60469 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix assertion.
Chris Lattner [Wed, 3 Dec 2008 07:43:05 +0000 (07:43 +0000)]
fix assertion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60468 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodon't spew tons of stuff to the output. This testcase is *not* for
Chris Lattner [Wed, 3 Dec 2008 06:41:50 +0000 (06:41 +0000)]
don't spew tons of stuff to the output.  This testcase is *not* for
loop deletion (it is for a ton of passes), which is very bad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60465 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRename DeleteBlockIfDead to DeleteDeadBlock and make it
Chris Lattner [Wed, 3 Dec 2008 06:40:52 +0000 (06:40 +0000)]
Rename DeleteBlockIfDead to DeleteDeadBlock and make it
unconditionally delete the block.  All likely clients will
do the checking anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60464 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFactor some code out of SimplifyCFG, forming a new
Chris Lattner [Wed, 3 Dec 2008 06:37:44 +0000 (06:37 +0000)]
Factor some code out of SimplifyCFG, forming a new
DeleteBlockIfDead method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60463 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMark x86's V_SET0 and V_SETALLONES with isSimpleLoad, and teach X86's
Dan Gohman [Wed, 3 Dec 2008 05:21:24 +0000 (05:21 +0000)]
Mark x86's V_SET0 and V_SETALLONES with isSimpleLoad, and teach X86's
foldMemoryOperand how to "fold" them, by converting them into constant-pool
loads. When they aren't folded, they use xorps/cmpeqd, but for example when
register pressure is high, they may now be folded as memory operands, which
reduces register pressure.

Also, mark V_SET0 isAsCheapAsAMove so that two-address-elimination will
remat it instead of copying zeros around (V_SETALLONES was already marked).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60461 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoChange label to 'carry' for unsigned adds.
Bill Wendling [Wed, 3 Dec 2008 02:43:12 +0000 (02:43 +0000)]
Change label to 'carry' for unsigned adds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60460 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a sanity-check to tablegen to catch the case where isSimpleLoad
Dan Gohman [Wed, 3 Dec 2008 02:30:17 +0000 (02:30 +0000)]
Add a sanity-check to tablegen to catch the case where isSimpleLoad
is set but mayLoad is not set. Fix all the problems this turned up.

Change code to not use isSimpleLoad instead of mayLoad unless it
really wants isSimpleLoad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60459 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix a missing #include.
Dan Gohman [Wed, 3 Dec 2008 02:10:00 +0000 (02:10 +0000)]
Fix a missing #include.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60458 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd an explicit keyword.
Dan Gohman [Wed, 3 Dec 2008 01:55:47 +0000 (01:55 +0000)]
Add an explicit keyword.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60457 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoReplace a #include with a forward-declaration.
Dan Gohman [Wed, 3 Dec 2008 01:53:18 +0000 (01:53 +0000)]
Replace a #include with a forward-declaration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60456 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix this comment to reflect that it applies to types other
Dan Gohman [Wed, 3 Dec 2008 01:39:44 +0000 (01:39 +0000)]
Fix this comment to reflect that it applies to types other
than just i32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60455 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix byval arguments in the fastcc calling convention. The fastcc convention
Dan Gohman [Wed, 3 Dec 2008 01:28:04 +0000 (01:28 +0000)]
Fix byval arguments in the fastcc calling convention. The fastcc convention
delegates to the regular x86-32 convention which handles byval, but only
after it handles a few cases, and it's necessary to handle byval before
handling those cases. This fixes PR3122 (and rdar://6400815), llvm-gcc
miscompiling LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60453 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd nounwind attributes to this test.
Dan Gohman [Wed, 3 Dec 2008 01:10:18 +0000 (01:10 +0000)]
Add nounwind attributes to this test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60451 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agotestcases for recent dag combiner changes
Dale Johannesen [Wed, 3 Dec 2008 00:52:41 +0000 (00:52 +0000)]
testcases for recent dag combiner changes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60449 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix isIntN to work with APInts > 64 bits. This method is only
Chris Lattner [Tue, 2 Dec 2008 23:33:29 +0000 (23:33 +0000)]
Fix isIntN to work with APInts > 64 bits.  This method is only
used by clang apparently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60446 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove a (what appears to be) overly strict assertion. Here is what happened:
Evan Cheng [Tue, 2 Dec 2008 21:57:09 +0000 (21:57 +0000)]
Remove a (what appears to be) overly strict assertion. Here is what happened:
1. ppcf128 select is expanded to f64 select's.
2. f64 select operand 0 is an i1 truncate, it's promoted to i32 zero_extend.
3. f64 select is updated. It's changed back to a "NewNode" and being re-analyzed.
4. f64 select operands are being processed. Operand 0 is a "NewNode". It's being expunged out of ReplacedValues map.
5. ExpungeNode tries to remap f64 select and notice it's a "NewNode" and assert.
Duncan, please take a look. Thanks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60443 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMinor rewrite per review feedback.
Dale Johannesen [Tue, 2 Dec 2008 21:17:11 +0000 (21:17 +0000)]
Minor rewrite per review feedback.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60442 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoNon-functional change: make custom lowering for truncate stylistically
Scott Michel [Tue, 2 Dec 2008 19:55:08 +0000 (19:55 +0000)]
Non-functional change: make custom lowering for truncate stylistically
consistent with the way it's generally done in other places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60439 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCellSPU:
Scott Michel [Tue, 2 Dec 2008 19:53:53 +0000 (19:53 +0000)]
CellSPU:
- Incorporate Tilmann Scheller's ISD::TRUNCATE custom lowering patch
- Update SPU calling convention info, even if it's not used yet (but can be
  at some point or another)
- Ensure that any-extended f32 loads are custom lowered, especially when
  they're promoted for use in printf.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60438 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix a typo in a comment.
Dan Gohman [Tue, 2 Dec 2008 19:27:20 +0000 (19:27 +0000)]
Fix a typo in a comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60434 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support for folding spills into preceding defs when doing pre-alloc splitting.
Owen Anderson [Tue, 2 Dec 2008 18:53:47 +0000 (18:53 +0000)]
Add support for folding spills into preceding defs when doing pre-alloc splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60433 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoOne more transformation.
Dale Johannesen [Tue, 2 Dec 2008 18:40:40 +0000 (18:40 +0000)]
One more transformation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60432 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake the code do what the comment says it does.
Dale Johannesen [Tue, 2 Dec 2008 18:40:09 +0000 (18:40 +0000)]
Make the code do what the comment says it does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60431 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoComment typeo fix, thanks Duncan!
Chris Lattner [Tue, 2 Dec 2008 18:33:11 +0000 (18:33 +0000)]
Comment typeo fix, thanks Duncan!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60429 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomake it possible to custom lower TRUNCATE (needed for the CellSPU target)
Tilmann Scheller [Tue, 2 Dec 2008 12:12:25 +0000 (12:12 +0000)]
make it possible to custom lower TRUNCATE (needed for the CellSPU target)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60409 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement PRE of loads in the GVN pass with a pretty cheap and
Chris Lattner [Tue, 2 Dec 2008 08:16:11 +0000 (08:16 +0000)]
Implement PRE of loads in the GVN pass with a pretty cheap and
straight-forward implementation.  This does not require any extra
alias analysis queries beyond what we already do for non-local loads.

Some programs really really like load PRE.  For example, SPASS triggers
this ~1000 times, ~300 times in 255.vortex, and ~1500 times on 403.gcc.

The biggest limitation to the implementation is that it does not split
critical edges.  This is a huge killer on many programs and should be
addressed after the initial patch is enabled by default.

The implementation of this should incidentally speed up rejection of
non-local loads because it avoids creating the repl densemap in cases
when it won't be used for fully redundant loads.

This is currently disabled by default.
Before I turn this on, I need to fix a couple of miscompilations in
the testsuite, look at compile time performance numbers, and look at
perf impact.  This is pretty close to ready though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60408 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a new SCEV representing signed division.
Nick Lewycky [Tue, 2 Dec 2008 08:05:48 +0000 (08:05 +0000)]
Add a new SCEV representing signed division.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60407 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemoved some unnecessary code in widening.
Mon P Wang [Tue, 2 Dec 2008 07:35:08 +0000 (07:35 +0000)]
Removed some unnecessary code in widening.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60406 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd a little helper function that does PHI translation.
Chris Lattner [Tue, 2 Dec 2008 07:16:45 +0000 (07:16 +0000)]
add a little helper function that does PHI translation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60405 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd a note
Chris Lattner [Tue, 2 Dec 2008 06:32:34 +0000 (06:32 +0000)]
add a note

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60404 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove some errors that crept in. No functionality change.
Bill Wendling [Tue, 2 Dec 2008 06:24:20 +0000 (06:24 +0000)]
Remove some errors that crept in. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60403 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMerge two if-statements into one.
Bill Wendling [Tue, 2 Dec 2008 06:22:04 +0000 (06:22 +0000)]
Merge two if-statements into one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60402 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMore styalistic changes. No functionality change.
Bill Wendling [Tue, 2 Dec 2008 06:18:11 +0000 (06:18 +0000)]
More styalistic changes. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60401 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd densemap range insertion method.
Chris Lattner [Tue, 2 Dec 2008 06:08:04 +0000 (06:08 +0000)]
add densemap range insertion method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60400 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago- Remove the buggy -X/C -> X/-C transform. This isn't valid when X isn't a
Bill Wendling [Tue, 2 Dec 2008 05:12:47 +0000 (05:12 +0000)]
- Remove the buggy -X/C -> X/-C transform. This isn't valid when X isn't a
  constant. If X is a constant, then this is folded elsewhere.

- Added a note to Target/README.txt to indicate that we'd like to implement
  this when we're able.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60399 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImprove comment.
Bill Wendling [Tue, 2 Dec 2008 05:09:00 +0000 (05:09 +0000)]
Improve comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60398 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago- Reduce nesting.
Bill Wendling [Tue, 2 Dec 2008 05:06:43 +0000 (05:06 +0000)]
- Reduce nesting.
- No need to do a swap on a canonicalized pattern.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60397 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosome random comment improvements.
Chris Lattner [Tue, 2 Dec 2008 04:52:26 +0000 (04:52 +0000)]
some random comment improvements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60395 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a test for my previous PRE fix.
Owen Anderson [Tue, 2 Dec 2008 04:25:42 +0000 (04:25 +0000)]
Add a test for my previous PRE fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60394 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix an issue that Chris noticed, where local PRE was not properly instantiating
Owen Anderson [Tue, 2 Dec 2008 04:09:22 +0000 (04:09 +0000)]
Fix an issue that Chris noticed, where local PRE was not properly instantiating
a new value numbering set after splitting a critical edge.  This increases
the number of instances of PRE on 403.gcc from ~60 to ~570.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60393 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix PR3124: overly strict assert.
Evan Cheng [Tue, 2 Dec 2008 02:15:36 +0000 (02:15 +0000)]
Fix PR3124: overly strict assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60392 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a few more transformations.
Dale Johannesen [Tue, 2 Dec 2008 01:30:54 +0000 (01:30 +0000)]
Add a few more transformations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60391 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSecond stab at target-dependent lowering of everyone's favorite nodes: [SU]ADDO
Bill Wendling [Tue, 2 Dec 2008 01:06:39 +0000 (01:06 +0000)]
Second stab at target-dependent lowering of everyone's favorite nodes: [SU]ADDO

- LowerXADDO lowers [SU]ADDO into an ADD with an implicit EFLAGS define. The
  EFLAGS are fed into a SETCC node which has the conditional COND_O or COND_C,
  depending on the type of ADDO requested.

- LowerBRCOND now recognizes if it's coming from a SETCC node with COND_O or
  COND_C set.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60388 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoReapply r60382. This time, don't mark "ADC" nodes with "implicit EFLAGS".
Bill Wendling [Tue, 2 Dec 2008 00:07:05 +0000 (00:07 +0000)]
Reapply r60382. This time, don't mark "ADC" nodes with "implicit EFLAGS".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60385 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTemporarily revert r60382. It caused CodeGen/X86/i2k.ll and others to fail.
Bill Wendling [Mon, 1 Dec 2008 23:44:08 +0000 (23:44 +0000)]
Temporarily revert r60382. It caused CodeGen/X86/i2k.ll and others to fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60383 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago- Have "ADD" instructions return an implicit EFLAGS.
Bill Wendling [Mon, 1 Dec 2008 23:30:42 +0000 (23:30 +0000)]
- Have "ADD" instructions return an implicit EFLAGS.
- Add support for seto, setno, setc, and setnc instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60382 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoExpand getVTList, getNodeValueTypes, and SelectNodeTo to handle more value types.
Bill Wendling [Mon, 1 Dec 2008 23:28:22 +0000 (23:28 +0000)]
Expand getVTList, getNodeValueTypes, and SelectNodeTo to handle more value types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60381 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd rdar reference, make this actually fail when the patch isn't applied.
Chris Lattner [Mon, 1 Dec 2008 22:35:31 +0000 (22:35 +0000)]
Add rdar reference, make this actually fail when the patch isn't applied.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60376 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoConsider only references to an IV within the loop when
Dale Johannesen [Mon, 1 Dec 2008 22:00:01 +0000 (22:00 +0000)]
Consider only references to an IV within the loop when
figuring out the base of the IV.  This produces better
code in the example.  (Addresses use (IV) instead of
(BASE,IV) - a significant improvement on low-register
machines like x86).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60374 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoreenable array_pod_sort, this time hopefully happy on 64-bit
Chris Lattner [Mon, 1 Dec 2008 21:11:25 +0000 (21:11 +0000)]
reenable array_pod_sort, this time hopefully happy on 64-bit
and big endian systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60371 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't rebuild RHSNeg. Just use the one that's already there.
Bill Wendling [Mon, 1 Dec 2008 21:06:30 +0000 (21:06 +0000)]
Don't rebuild RHSNeg. Just use the one that's already there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60370 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDocument what this check is doing. Also, no need to cast to ConstantInt.
Bill Wendling [Mon, 1 Dec 2008 21:03:43 +0000 (21:03 +0000)]
Document what this check is doing. Also, no need to cast to ConstantInt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60369 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse a simple comparison. Overflow on integer negation can only occur when the
Bill Wendling [Mon, 1 Dec 2008 19:46:27 +0000 (19:46 +0000)]
Use a simple comparison. Overflow on integer negation can only occur when the
integer is "minint".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60366 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodon't #include <algorithm> into the llvm namespace.
Chris Lattner [Mon, 1 Dec 2008 19:45:45 +0000 (19:45 +0000)]
don't #include <algorithm> into the llvm namespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60365 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCellSPU:
Scott Michel [Mon, 1 Dec 2008 17:56:02 +0000 (17:56 +0000)]
CellSPU:
- Fix v2[if]64 vector insertion code before IBM files a bug report.
- Ensure that zero (0) offsets relative to $sp don't trip an assert
  (add $sp, 0 gets legalized to $sp alone, tripping an assert)
- Shuffle masks passed to SPUISD::SHUFB are now v16i8 or v4i32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60358 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoswitch to std::sort until I have time to sort this out.
Chris Lattner [Mon, 1 Dec 2008 17:00:08 +0000 (17:00 +0000)]
switch to std::sort until I have time to sort this out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60354 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocleanups suggested by duncan, thanks!
Chris Lattner [Mon, 1 Dec 2008 16:55:19 +0000 (16:55 +0000)]
cleanups suggested by duncan, thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60353 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodefine array_pod_sort in terms of operator< instead of my brain
Chris Lattner [Mon, 1 Dec 2008 16:50:01 +0000 (16:50 +0000)]
define array_pod_sort in terms of operator< instead of my brain
damaged approximation.  This should fix it on big endian platforms
and on 64-bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60352 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoThere are no longer any places that require a
Duncan Sands [Mon, 1 Dec 2008 11:41:29 +0000 (11:41 +0000)]
There are no longer any places that require a
MERGE_VALUES node with only one operand, so get
rid of special code that only existed to handle
that possibility.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60349 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoChange the interface to the type legalization method
Duncan Sands [Mon, 1 Dec 2008 11:39:25 +0000 (11:39 +0000)]
Change the interface to the type legalization method
ReplaceNodeResults: rather than returning a node which
must have the same number of results as the original
node (which means mucking around with MERGE_VALUES,
and which is also easy to get wrong since SelectionDAG
folding may mean you don't get the node you expect),
return the results in a vector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60348 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoGeneralize the FoldOrWithConstant method to fold for any two constants which
Bill Wendling [Mon, 1 Dec 2008 08:32:40 +0000 (08:32 +0000)]
Generalize the FoldOrWithConstant method to fold for any two constants which
don't have overlapping bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60344 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoReduce copy-and-paste code by splitting out the code into its own function.
Bill Wendling [Mon, 1 Dec 2008 08:23:25 +0000 (08:23 +0000)]
Reduce copy-and-paste code by splitting out the code into its own function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60343 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse m_Specific() instead of double matching.
Bill Wendling [Mon, 1 Dec 2008 08:09:47 +0000 (08:09 +0000)]
Use m_Specific() instead of double matching.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60341 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMove pattern check outside of the if-then statement. This prevents us from fiddling...
Bill Wendling [Mon, 1 Dec 2008 07:47:02 +0000 (07:47 +0000)]
Move pattern check outside of the if-then statement. This prevents us from fiddling with constants unless we have to.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60340 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRename some variables, only increment BI once at the start of the loop instead of...
Chris Lattner [Mon, 1 Dec 2008 07:35:54 +0000 (07:35 +0000)]
Rename some variables, only increment BI once at the start of the loop instead of throughout it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60339 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agopull the predMap densemap out of the inner loop of performPRE, so
Chris Lattner [Mon, 1 Dec 2008 07:29:03 +0000 (07:29 +0000)]
pull the predMap densemap out of the inner loop of performPRE, so
that it isn't reallocated all the time.  This is a tiny speedup for
GVN: 3.90->3.88s

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60338 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoswitch a couple more calls to use array_pod_sort.
Chris Lattner [Mon, 1 Dec 2008 06:52:57 +0000 (06:52 +0000)]
switch a couple more calls to use array_pod_sort.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60337 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agodon't assume iterators implicitly convert to pointers.
Chris Lattner [Mon, 1 Dec 2008 06:50:46 +0000 (06:50 +0000)]
don't assume iterators implicitly convert to pointers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60336 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIntroduce a new array_pod_sort function and switch LSR to use it
Chris Lattner [Mon, 1 Dec 2008 06:49:59 +0000 (06:49 +0000)]
Introduce a new array_pod_sort function and switch LSR to use it
instead of std::sort.  This shrinks the release-asserts LSR.o file
by 1100 bytes of code on my system.

We should start using array_pod_sort where possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60335 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoEliminate use of setvector for the DeadInsts set, just use a smallvector.
Chris Lattner [Mon, 1 Dec 2008 06:27:41 +0000 (06:27 +0000)]
Eliminate use of setvector for the DeadInsts set, just use a smallvector.
This is a lot cheaper and conceptually simpler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60332 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDeleteTriviallyDeadInstructions is always passed the
Chris Lattner [Mon, 1 Dec 2008 06:14:28 +0000 (06:14 +0000)]
DeleteTriviallyDeadInstructions is always passed the
DeadInsts ivar, just use it directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60330 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosimplify DeleteTriviallyDeadInstructions again, unlike my previous
Chris Lattner [Mon, 1 Dec 2008 06:11:32 +0000 (06:11 +0000)]
simplify DeleteTriviallyDeadInstructions again, unlike my previous
buggy rewrite, this notifies ScalarEvolution of a pending instruction
about to be removed and then erases it, instead of erasing it then
notifying.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60329 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosimplify these patterns using m_Specific. No need to grep for
Chris Lattner [Mon, 1 Dec 2008 05:16:26 +0000 (05:16 +0000)]
simplify these patterns using m_Specific.  No need to grep for
xor in testcase (or is a substring).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60328 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTeach jump threading to clean up after itself, DCE and constfolding the
Chris Lattner [Mon, 1 Dec 2008 04:48:07 +0000 (04:48 +0000)]
Teach jump threading to clean up after itself, DCE and constfolding the
new instructions it simplifies.  Because we're threading jumps on edges
with constants coming in from PHI's, we inherently are exposing a lot more
constants to the new block.  Folding them and deleting dead conditions
allows the cost model in jump threading to be more accurate as it iterates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60327 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoThe PreVerifier pass preserves everything. In practice, this
Chris Lattner [Mon, 1 Dec 2008 03:58:38 +0000 (03:58 +0000)]
The PreVerifier pass preserves everything.  In practice, this
prevents the passmgr from adding yet-another domtree invocation
for Verifier if there is already one live.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60326 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoChange instcombine to use FoldPHIArgGEPIntoPHI to fold two operand PHIs
Chris Lattner [Mon, 1 Dec 2008 03:42:51 +0000 (03:42 +0000)]
Change instcombine to use FoldPHIArgGEPIntoPHI to fold two operand PHIs
instead of using FoldPHIArgBinOpIntoPHI.  In addition to being more
obvious, this also fixes a problem where instcombine wouldn't merge two
phis that had different variable indices.  This prevented instcombine
from factoring big chunks of code in 403.gcc.  For example:

 insn_cuid.exit:
-       %tmp336 = load i32** @uid_cuid, align 4
-       %tmp337 = getelementptr %struct.rtx_def* %insn_addr.0.ph.i, i32 0, i32 3
-       %tmp338 = bitcast [1 x %struct.rtunion]* %tmp337 to i32*
-       %tmp339 = load i32* %tmp338, align 4
-       %tmp340 = getelementptr i32* %tmp336, i32 %tmp339
        br label %bb62

 bb61:
-       %tmp341 = load i32** @uid_cuid, align 4
-       %tmp342 = getelementptr %struct.rtx_def* %insn, i32 0, i32 3
-       %tmp343 = bitcast [1 x %struct.rtunion]* %tmp342 to i32*
-       %tmp344 = load i32* %tmp343, align 4
-       %tmp345 = getelementptr i32* %tmp341, i32 %tmp344
        br label %bb62

 bb62:
-       %iftmp.62.0.in = phi i32* [ %tmp345, %bb61 ], [ %tmp340, %insn_cuid.exit ]
+       %insn.pn2 = phi %struct.rtx_def* [ %insn, %bb61 ], [ %insn_addr.0.ph.i, %insn_cuid.exit ]
+       %tmp344.pn.in.in = getelementptr %struct.rtx_def* %insn.pn2, i32 0, i32 3
+       %tmp344.pn.in = bitcast [1 x %struct.rtunion]* %tmp344.pn.in.in to i32*
+       %tmp341.pn = load i32** @uid_cuid
+       %tmp344.pn = load i32* %tmp344.pn.in
+       %iftmp.62.0.in = getelementptr i32* %tmp341.pn, i32 %tmp344.pn
        %iftmp.62.0 = load i32* %iftmp.62.0.in

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60325 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTeach inst combine to merge GEPs through PHIs. This is really
Chris Lattner [Mon, 1 Dec 2008 02:34:36 +0000 (02:34 +0000)]
Teach inst combine to merge GEPs through PHIs.  This is really
important because it is sinking the loads using the GEPs, but
not the GEPs themselves.  This triggers 647 times on 403.gcc
and makes the .s file much much nicer.  For example before:

        je      LBB1_87 ## bb78
LBB1_62:        ## bb77
        leal    84(%esi), %eax
LBB1_63:        ## bb79
        movl    (%eax), %eax
...
LBB1_87:        ## bb78
        movl    $0, 4(%esp)
        movl    %esi, (%esp)
        call    L_make_decl_rtl$stub
        jmp     LBB1_62 ## bb77

after:

        jne     LBB1_63 ## bb79
LBB1_62:        ## bb78
        movl    $0, 4(%esp)
        movl    %esi, (%esp)
        call    L_make_decl_rtl$stub
LBB1_63:        ## bb79
        movl    84(%esi), %eax

The input code was (and the GEPs are merged and
the PHI is now eliminated by instcombine):

        br i1 %tmp233, label %bb78, label %bb77
bb77:
        %tmp234 = getelementptr %struct.tree_node* %t_addr.3, i32 0, i32 0, i32 22
        br label %bb79
bb78:
        call void @make_decl_rtl(%struct.tree_node* %t_addr.3, i8* null) nounwind
        %tmp235 = getelementptr %struct.tree_node* %t_addr.3, i32 0, i32 0, i32 22
        br label %bb79
bb79:
        %iftmp.12.0.in = phi %struct.rtx_def** [ %tmp235, %bb78 ], [ %tmp234, %bb77 ]
        %iftmp.12.0 = load %struct.rtx_def** %iftmp.12.0.in

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60322 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agotestcase for my previous commit.
Chris Lattner [Mon, 1 Dec 2008 01:42:03 +0000 (01:42 +0000)]
testcase for my previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60315 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake GVN be more intelligent about redundant load
Chris Lattner [Mon, 1 Dec 2008 01:31:36 +0000 (01:31 +0000)]
Make GVN be more intelligent about redundant load
elimination: when finding dependent load/stores, realize that
they are the same if aliasing claims must alias instead of relying
on the pointers to be exactly equal.  This makes load elimination
more aggressive.  For example, on 403.gcc, we had:

<     68 gvn    - Number of instructions PRE'd
< 152718 gvn    - Number of instructions deleted
<  49699 gvn    - Number of loads deleted
<   6153 memdep - Number of dirty cached non-local responses
< 169336 memdep - Number of fully cached non-local responses
< 162428 memdep - Number of uncached non-local responses

now we have:

>     64 gvn    - Number of instructions PRE'd
> 153623 gvn    - Number of instructions deleted
>  49856 gvn    - Number of loads deleted
>   5022 memdep - Number of dirty cached non-local responses
> 159030 memdep - Number of fully cached non-local responses
> 162443 memdep - Number of uncached non-local responses

That's an extra 157 loads deleted and extra 905 other instructions nuked.

This slows down GVN very slightly, from 3.91 to 3.96s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60314 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoReimplement the non-local dependency data structure in terms of a sorted
Chris Lattner [Mon, 1 Dec 2008 01:15:42 +0000 (01:15 +0000)]
Reimplement the non-local dependency data structure in terms of a sorted
vector instead of a densemap.  This shrinks the memory usage of this thing
substantially (the high water mark) as well as making operations like
scanning it faster.  This speeds up memdep slightly, gvn goes from
3.9376 to 3.9118s on 403.gcc

This also splits out the statistics for the cached non-local case to
differentiate between the dirty and clean cached case.  Here's the stats
for 403.gcc:

  6153 memdep - Number of dirty cached non-local responses
169336 memdep - Number of fully cached non-local responses
162428 memdep - Number of uncached non-local responses

yay for caching :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60313 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement ((A|B)&1)|(B&-2) -> (A&1) | B transformation. This also takes care of
Bill Wendling [Mon, 1 Dec 2008 01:07:11 +0000 (01:07 +0000)]
Implement ((A|B)&1)|(B&-2) -> (A&1) | B transformation. This also takes care of
permutations of this pattern.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60312 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix bogus assertion using getSExtValue for legitimate values, like -1 in
Eli Friedman [Mon, 1 Dec 2008 00:43:48 +0000 (00:43 +0000)]
Fix bogus assertion using getSExtValue for legitimate values, like -1 in
an 128-bit-wide integer.  No testcase; the issue I ran into depends on
local changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60311 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCache analyses in ivars and add some useful DEBUG output.
Chris Lattner [Mon, 1 Dec 2008 00:40:32 +0000 (00:40 +0000)]
Cache analyses in ivars and add some useful DEBUG output.
This speeds up GVN from 4.0386s to 3.9376s.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60310 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimprove indentation, do cheap checks before expensive ones,
Chris Lattner [Sun, 30 Nov 2008 23:39:23 +0000 (23:39 +0000)]
improve indentation, do cheap checks before expensive ones,
remove some fixme's.  This speeds up GVN very slightly on 403.gcc
(4.06->4.03s)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60309 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoEliminate the DepResultTy abstraction. It is now completely
Chris Lattner [Sun, 30 Nov 2008 23:17:19 +0000 (23:17 +0000)]
Eliminate the DepResultTy abstraction.  It is now completely
redundant with MemDepResult, and MemDepResult has a nicer interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60308 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMinor cleanup: use getTrue and getFalse where appropriate. No
Eli Friedman [Sun, 30 Nov 2008 22:48:49 +0000 (22:48 +0000)]
Minor cleanup: use getTrue and getFalse where appropriate.  No
functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60307 91177308-0d34-0410-b5e6-96231b3b80d8