Commit Graph

12141 Commits

Author SHA1 Message Date
NAKAMURA Takumi
ee0056d866 test/Makefile: "check-all" should update tools/clang/test/Unit/lit.site.cfg, too. Follow up to clang r124777.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124783 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 07:36:02 +00:00
Rafael Espindola
855ff183b9 Add -march to fix the bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124774 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 04:21:01 +00:00
Rafael Espindola
f297c93191 Fix PR9127 by reversing the operands even if they have more then one use.
Reversing the operands allows us to fold, but doesn't force us to. Also, at
this point the DAG is still being optimized, so the check for hasOneUse is not
very precise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124773 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 03:58:05 +00:00
Duncan Sands
4b720718fb Reenable the transform "(X*Y)/Y->X" when the multiplication is known not to
overflow (nsw flag), which was disabled because it breaks 254.gap.  I have
informed the GAP authors of the mistake in their code, and arranged for the
testsuite to use -fwrapv when compiling this benchmark.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124746 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 20:52:00 +00:00
Benjamin Kramer
56442dfdcf SimplifyCFG: Turn switches into sub+icmp+branch if possible.
This makes the job of the later optzn passes easier, allowing the vast amount of
icmp transforms to chew on it.

We transform 840 switches in gcc.c, leading to a 16k byte shrink of the resulting
binary on i386-linux.

The testcase from README.txt now compiles into
  decl  %edi
  cmpl  $3, %edi
  sbbl  %eax, %eax
  andl  $1, %eax
  ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124724 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 15:56:22 +00:00
Richard Osborne
ff0c5014b2 Add support for trampolines on the XCore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124722 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 14:57:41 +00:00
Dan Gohman
46985a1440 Fix reassociate to clear optional flags, such as nsw.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124712 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 02:02:34 +00:00
Evan Cheng
31959b19a7 Given a pair of floating point load and store, if there are no other uses of
the load, then it may be legal to transform the load and store to integer
load and store of the same width.

This is done if the target specified the transformation as profitable. e.g.
On arm, this can transform:
vldr.32 s0, []
vstr.32 s0, []

to

ldr r12, []
str r12, []

rdar://8944252


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124708 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 01:06:55 +00:00
Duncan Sands
7681c6da60 Have m_One also match constant vectors for which every element is 1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124655 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 08:39:12 +00:00
Rafael Espindola
4e93885bab Correctly merge available_externally and regular definitions when they have
different visibilities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124650 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 05:33:52 +00:00
Evan Cheng
4d98ee5234 Fix test for non-darwin targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124640 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 01:16:18 +00:00
Devang Patel
e361d2eda1 Remove stale test that has never worked, afaik.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124635 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01 00:47:16 +00:00
Devang Patel
e9a7ea6865 Keep track of incoming argument's location while emitting LiveIns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124611 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-31 21:38:14 +00:00
Richard Osborne
4e3740ee6d Fix bug where ReduceLoadWidth was creating illegal ZEXTLOAD instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124587 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-31 17:41:44 +00:00
Anders Carlsson
77bc49e5e2 Recognize and simplify
(A+B) == A  ->  B == 0
A == (A+B)  ->  B == 0



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124567 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-30 22:01:13 +00:00
Duncan Sands
7af00c0f6e Commit 124487 broke 254.gap. See if disabling the part that might be triggered
by PR9088 fixes things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124561 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-30 18:24:20 +00:00
Duncan Sands
1895e98ef3 Transform (X/Y)*Y into X if the division is exact. Instcombine already knows how
to do this and more, but would only do it if X/Y had only one use.  Spotted as the
most common missed simplification in SPEC by my auto-simplifier, now that it knows
about nuw/nsw/exact flags.  This removes a bunch of multiplications from 447.dealII
and 483.xalancbmk.  It also removes a lot from tramp3d-v4, which results in much
more inlining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124560 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-30 18:03:50 +00:00
Benjamin Kramer
9b108a338d Teach DAGCombine to fold fold (sra (trunc (sr x, c1)), c2) -> (trunc (sra x, c1+c2) when c1 equals the amount of bits that are truncated off.
This happens all the time when a smul is promoted to a larger type.

On x86-64 we now compile "int test(int x) { return x/10; }" into
  movslq  %edi, %rax
  imulq $1717986919, %rax, %rax
  movq  %rax, %rcx
  shrq  $63, %rcx
  sarq  $34, %rax <- used to be "shrq $32, %rax; sarl $2, %eax"
  addl  %ecx, %eax

This fires 96 times in gcc.c on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124559 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-30 16:38:43 +00:00
Nick Lewycky
175e7aec13 Add the select optimization recently added to instcombine to constant folding.
This is the one where one of the branches of the select is another select on
the same condition.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124547 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 20:35:06 +00:00
Frits van Bommel
1fca2c32cc Move InstCombine's knowledge of fdiv to SimplifyInstruction().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124534 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 15:26:31 +00:00
Duncan Sands
9136782d27 Fix typo: should have been testing that X was odd, not V.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124533 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 13:27:00 +00:00
Evan Cheng
60f5ad46c2 Add a test for TCE return duplication.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124527 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 04:53:35 +00:00
Evan Cheng
c3f507f98a Re-apply r124518 with fix. Watch out for invalidated iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124526 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 04:46:23 +00:00
Evan Cheng
b0a42fdb36 Revert r124518. It broke Linux self-host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 02:43:04 +00:00
Evan Cheng
5e6940788f Re-commit r124462 with fixes. Tail recursion elim will now dup ret into unconditional predecessor to enable TCE on demand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124518 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-29 01:29:26 +00:00
Bob Wilson
d11c57a937 PR9030: Fix disassembly of ARM "mov pc, lr" instruction.
Patch by Jyun-Yan You.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124492 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 17:50:30 +00:00
Duncan Sands
593faa53fa My auto-simplifier noticed that ((X/Y)*Y)/Y occurs several times in SPEC
benchmarks, and that it can be simplified to X/Y.  (In general you can only
simplify (Z*Y)/Y to Z if the multiplication did not overflow; if Z has the
form "X/Y" then this is the case).  This patch implements that transform and
moves some Div logic out of instcombine and into InstructionSimplify.
Unfortunately instcombine gets in the way somewhat, since it likes to change
(X/Y)*Y into X-(X rem Y), so I had to teach instcombine about this too.
Finally, thanks to the NSW/NUW flags, sometimes we know directly that "Z*Y"
does not overflow, because the flag says so, so I added that logic too.  This
eliminates a bunch of divisions and subtractions in 447.dealII, and has good
effects on some other benchmarks too.  It seems to have quite an effect on
tramp3d-v4 but it's hard to say if it's good or bad because inlining decisions
changed, resulting in massive changes all over.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124487 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 16:51:11 +00:00
Roman Divacky
14e66553d5 Add support for parsing .float
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124485 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 14:20:32 +00:00
Evan Cheng
1b5c0cb71d Revert r124462. There are a few big regressions that I need to fix first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124478 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 07:12:38 +00:00
Nick Lewycky
26859587fd Clean up the tests a little, make sure we match an instruction in the right
test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124473 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 05:13:17 +00:00
Rafael Espindola
ddf0e59cc6 Add a triple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124471 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 03:57:55 +00:00
Nick Lewycky
df3bfae151 Fold select + select where both selects are on the same condition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124469 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 03:28:10 +00:00
Rafael Espindola
1ffb533699 Print the visibility of declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124468 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 03:20:10 +00:00
Nico Weber
4c4c732960 PR8951: Support for .equiv in integrated assembler, patch by Jörg Sonnenberger!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124467 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 03:04:41 +00:00
Evan Cheng
40f64cb0de - Stop simplifycfg from duplicating "ret" instructions into unconditional
branches. PR8575, rdar://5134905, rdar://8911460.
- Allow codegen tail duplication to dup small return blocks after register
  allocation is done.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124462 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 02:19:21 +00:00
Evan Cheng
c3a20bab75 Fix PLD encoding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124458 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 23:48:34 +00:00
Roman Divacky
54b0f4f2a4 Add support for specifying register name in cfi-register/offset/def
as well as register number.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 17:16:37 +00:00
Nick Lewycky
25296e25fd Fix surprising missed optimization in mergefunc where we forgot to consider
that relationships like "i8* null" is equivalent to "i32* null".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124368 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 08:38:19 +00:00
Eric Christopher
f382f3b4dd Add a testcase for my last checkin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124358 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 06:01:17 +00:00
Bruno Cardoso Lopes
106df6da36 Add encoding testcases for ARM vcvtr variations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124289 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 13:53:38 +00:00
Bruno Cardoso Lopes
1b10d5be40 fix the encoding and add testcases for ARM nop, yield, wfe and wfi instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124288 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 13:28:14 +00:00
Duncan Sands
37f87c7aa9 Fix PR9039, a use-after-free in reassociate. The issue was that the
operand being factorized (and erased) could occur several times in Ops,
resulting in freed memory being used when the next occurrence in Ops was
analyzed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124287 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 10:08:38 +00:00
NAKAMURA Takumi
7754f85885 Target/X86: Tweak win64's tailcall.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124272 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 02:04:09 +00:00
NAKAMURA Takumi
e5fffe9c3f Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124270 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 02:03:37 +00:00
Rafael Espindola
3971df5203 Move unnamed_addr after the function arguments on Sabre's request.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124209 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 19:09:56 +00:00
Devang Patel
8f31428119 Resolve DanglingDbgValue of PHI nodes where the use follows dbg.value intrinisic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124203 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 18:09:58 +00:00
Duncan Sands
227fba11ca In which I discover that zero+zero is zero, d'oh!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124188 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 15:14:15 +00:00
Duncan Sands
dadcf8eedd Turn off this test - the corresponding instsimplify logic has been
disabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124185 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 12:31:43 +00:00
Duncan Sands
d70d1a5c44 According to my auto-simplifier the most common missed simplifications in
optimized code are:
  (non-negative number)+(power-of-two) != 0 -> true
and
  (x | 1) != 0 -> true
Instcombine knows about the second one of course, but only does it if X|1
has only one use.  These fire thousands of times in the testsuite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124183 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 09:38:29 +00:00
Nick Lewycky
b38824f866 Teach mergefunc how to emit aliases safely again -- but keep it turned it off
for now. It's controlled by the HasGlobalAliases variable which is not attached
to any flag yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124182 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 08:56:50 +00:00