Commit Graph

12190 Commits

Author SHA1 Message Date
Daniel Dunbar
cd3e639fe7 Disable this test for now...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125361 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 02:59:08 +00:00
Evan Cheng
c143dd4f63 Fix buggy fcopysign lowering.
This
define float @foo(float %x, float %y) nounwind readnone {
entry:
  %0 = tail call float @copysignf(float %x, float %y) nounwind readnone
  ret float %0
}

Was compiled to:
    vmov     s0, r1
    bic      r0, r0, #-2147483648
    vmov     s1, r0
    vcmpe.f32    s0, #0
    vmrs         apsr_nzcv, fpscr
    it           lt
    vneglt.f32   s1, s1
    vmov         r0, s1
    bx           lr

This fails to copy the sign of -0.0f because it's lost during the float to int
conversion. Also, it's sub-optimal when the inputs are in GPR registers.

Now it uses integer and + or operations when it's profitable. And it's correct!
    lsrs    r1, r1, #31
    bfi     r0, r1, #31, #1
    bx      lr
rdar://8984306


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125357 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 02:28:55 +00:00
Cameron Zwarich
a2f9d4e053 Add a test for the LSR issue exposed by r125254.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125325 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 00:49:27 +00:00
Nick Lewycky
3b739d278c Tolerate degenerate phi nodes that can occur in the middle of optimization
passes. Fixes PR9112. Patch by Jakub Staszak!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125319 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 23:54:10 +00:00
Cameron Zwarich
4a60b932a2 Rename 'loopsimplify' to 'loop-simplify'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125317 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 23:38:10 +00:00
Bruno Cardoso Lopes
7dd74ed8d8 Add mips o32 tests again with the hope that the buildbot won't complaint again
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125316 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 23:37:20 +00:00
Bruno Cardoso Lopes
b453ce74f7 Remove the test to silence the buildbot, will check it in again with a proper fix soon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125305 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 20:10:17 +00:00
Bruno Cardoso Lopes
8e826e69db Fix a lot of o32 CC issues and add a bunch of tests. Patch by Akira Hatanaka with some small modifications by me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125292 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 18:05:10 +00:00
Che-Liang Chiou
8e5d01cd6e ptx: add passing parameter to kernel functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125279 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 12:01:24 +00:00
Chris Lattner
6cdf2ea98e implement the first part of PR8882: when lowering an inbounds
gep to explicit addressing, we know that none of the intermediate
computation overflows.

This could use review: it seems that the shifts certainly wouldn't
overflow, but could the intermediate adds overflow if there is a 
negative index?

Previously the testcase would instcombine to:

define i1 @test(i64 %i) {
  %p1.idx.mask = and i64 %i, 4611686018427387903
  %cmp = icmp eq i64 %p1.idx.mask, 1000
  ret i1 %cmp
}

now we get:

define i1 @test(i64 %i) {
  %cmp = icmp eq i64 %i, 1000
  ret i1 %cmp
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 07:11:16 +00:00
Chris Lattner
7a6aa1a391 Enhance a bunch of transformations in instcombine to start generating
exact/nsw/nuw shifts and have instcombine infer them when it can prove
that the relevant properties are true for a given shift without them.

Also, a variety of refactoring to use the new patternmatch logic thrown
in for good luck.  I believe that this takes care of a bunch of related
code quality issues attached to PR8862.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125267 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 05:36:31 +00:00
Chris Lattner
b20c0b5092 Enhance the "compare with shift" and "compare with div"
optimizations to be much more aggressive in the face of
exact/nsw/nuw div and shifts.  For example, these (which
are the same except the first is 'exact' sdiv:

define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
  %A = sdiv exact i64 %X, -5   ; X/-5 == 0 --> x == 0
  %B = icmp eq i64 %A, 0
  ret i1 %B
}

define i1 @sdiv_icmp4(i64 %X) nounwind {
  %A = sdiv i64 %X, -5   ; X/-5 == 0 --> x == 0
  %B = icmp eq i64 %A, 0
  ret i1 %B
}

compile down to:

define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
  %1 = icmp eq i64 %X, 0
  ret i1 %1
}

define i1 @sdiv_icmp4(i64 %X) nounwind {
  %X.off = add i64 %X, 4
  %1 = icmp ult i64 %X.off, 9
  ret i1 %1
}

This happens when you do something like:
  (ptr1-ptr2) == 42

where the pointers are pointers to non-unit types.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125266 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 05:23:05 +00:00
Chris Lattner
44cc997d42 more cleanups, notably bitcast isn't used for "signed to unsigned type
conversions". :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 05:17:27 +00:00
Evan Cheng
4d96c638af After 3-addressifying a two-address instruction, update the register maps; add a missing check when considering whether it's profitable to commute. rdar://8977508.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125259 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 02:20:55 +00:00
Jim Grosbach
b9db0c50d8 Do AsmMatcher operand classification per-opcode.
When matching operands for a candidate opcode match in the auto-generated
AsmMatcher, check each operand against the expected operand match class.
Previously, operands were classified independently of the opcode being
handled, which led to difficulties when operand match classes were
more complicated than simple subclass relationships.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125245 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 00:08:28 +00:00
Chris Lattner
81a0dc9115 Teach instsimplify some tricks about exact/nuw/nsw shifts.
improve interfaces to instsimplify to take this info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125196 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 17:15:04 +00:00
Chris Lattner
6bfd77e315 merge two tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125195 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 17:06:41 +00:00
Chris Lattner
f18ed3853a remove a small scattering of basically pointless tests. These are
all covered by llvm-test, which is what they were reduced from back
in 2003.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125189 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 16:41:31 +00:00
Chris Lattner
71f4391b2e remove a broken test, this is matching nounwind on intrinsics, not the old unwind instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125188 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 16:40:56 +00:00
Richard Osborne
59982f3ffc Add intrinsic for setc instruction on the XCore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125186 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 13:22:12 +00:00
Nick Lewycky
3ba974a1c5 When removing a function from the function set and adding it to deferred, we
could end up removing a different function than we intended because it was
functionally equivalent, then end up with a comparison of a function against
itself in the next round of comparisons (the one in the function set and the
one on the deferred list). To fix this, I introduce a choice in the form of
comparison for ComparableFunctions, either normal or "pointer only" used to
find exact Function*'s in lookups.

Also add some debugging statements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125180 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 06:32:02 +00:00
NAKAMURA Takumi
c37b429484 test/lit.cfg: Seek sane tools(and bash) in directories and set to $PATH.
LitConfig.getBashPath() will not seek in $PATH after LitConfig.getToolsPath() was executed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125176 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 04:19:21 +00:00
NAKAMURA Takumi
b656a11c70 CMake: Add the new option LLVM_LIT_TOOLS_DIR. It can specify "Path to GnuWin32 tools".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125173 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 04:18:58 +00:00
Owen Anderson
971b83b67a Revert both r121082 (which broke a bunch of constant pool stuff) and r125074 (which worked around it). This should get us back to the old, correct behavior, though it will make the integrated assembler unhappy for the time being.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125127 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 22:39:40 +00:00
Benjamin Kramer
0fd90bc12f Support for .ifdef / .ifndef in the assembler parser. Patch by Joerg Sonnenberger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125120 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 22:29:56 +00:00
Andrew Trick
651c4ba80c PostRA antidependence breaker unit test for PR8986.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125091 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 17:42:05 +00:00
Andrew Trick
e4f34cd4db PostRA antidependence breaker unit test for rdar://8959122.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125090 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 17:41:12 +00:00
Benjamin Kramer
33828bcb24 SimplifyCFG: Track the number of used icmps when turning a icmp chain into a switch. If we used only one icmp, don't turn it into a switch.
Also prevent the switch-to-icmp transform from creating identity adds, noticed by Marius Wachtler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125056 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 22:37:28 +00:00
Bruno Cardoso Lopes
706d946cfe Add support for parsing dmb/dsb instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125055 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 22:09:15 +00:00
Evan Cheng
aa26102db4 Fix an obvious typo which caused an isel assertion. rdar://8964854.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125023 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 18:50:47 +00:00
Devang Patel
8c8d95d0c2 Reduce test case, smaller is better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125019 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 18:24:18 +00:00
Bob Wilson
1c3ef90cab Add codegen support for using post-increment NEON load/store instructions.
The vld1-lane, vld1-dup and vst1-lane instructions do not yet support using
post-increment versions, but all the rest of the NEON load/store instructions
should be handled now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125014 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 17:43:21 +00:00
Chris Lattner
f067d584a8 implement .ll and .bc support for nsw/nuw on shl and exact on lshr/ashr.
Factor some code better.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125006 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 16:40:21 +00:00
Jason W Kim
953a2a3dee Teach ARM/MC/ELF about gcc compatible reloc output to get past odd linkage
failures with relocations.

The code committed is a first cut at compatibility for emitted relocations in
ELF .o.

Why do this? because existing ARM tools like emitting relocs symbols as
explicit relocations, not as section-offset relocs.

Result is that with these changes,
1) relocs are now substantially identical what to gcc outputs.
2) larger apps (including many spec2k tests) compile, cross-link, and pass

Added reminder fixme to tests for future conversion to .s form.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124996 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 01:11:15 +00:00
Jason W Kim
f009a961ca Rework some .ARM.attribute work for improved gcc compatibility.
Unified EmitTextAttribute for both Asm and Obj emission (.cpu only)
Added necessary cortex-A8 related attrs for codegen compat tests.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124995 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 00:49:53 +00:00
Chris Lattner
c6ee9181a5 teach instsimplify to transform (X / Y) * Y to X
when the div is an exact udiv.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124994 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-06 22:05:31 +00:00
Chris Lattner
c35a44d3d7 rename test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124993 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-06 21:59:10 +00:00
Chris Lattner
35bda8914c enhance vmcore to know that udiv's can be exact, and add a trivial
instcombine xform to exercise this.

Nothing forms exact udivs yet though.  This is progress on PR8862



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124992 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-06 21:44:57 +00:00
Anders Carlsson
6475d9434f When loading from a constant, fold inttoptr if the integer type and the resulting pointer type both have the same size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124987 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-06 20:11:56 +00:00
NAKAMURA Takumi
3f4be4fb86 Target/X86: Tweak allocating shadow area (aka home) on Win64. It must be enough for caller to allocate one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124949 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 15:11:32 +00:00
Bob Wilson
782b576749 Move a test that ended up in the wrong place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124933 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 04:15:50 +00:00
Devang Patel
6c3ea9012e Merge .debug_loc entries whenever possible to reduce debug_loc size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124904 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 22:57:18 +00:00
Nick Lewycky
c57ef56142 Mark that the return is using EAX so that we don't use it for some other
purpose. Fixes PR9080!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124903 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 22:44:08 +00:00
Jason W Kim
2d7a53aec2 Teach ARM/MC/ELF about EF_ARM_EABI_VERSION. The magic number is set to
5 to match the current doc.
Added FIXME reminder Make it really configurable later.





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124899 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 21:41:11 +00:00
Jason W Kim
685c350ae7 Teach ARM/MC/ELF to handle R_ARM_JUMP24 relocation type for conditional jumps.
(yes, this is different from R_ARM_CALL)

- Adds a new method getARMBranchTargetOpValue() which handles the
  necessary distinction between the conditional and unconditional br/bl
  needed for ARM/ELF

At least for ARM mode, the needed fixup for conditional versus unconditional
br/bl is identical, but the ARM docs and existing ARM tools expect this
reloc type...

Added a few FIXME's for future naming fixups in ARMInstrInfo.td




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124895 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 19:47:15 +00:00
Devang Patel
f827cd717b DebugLoc associated with a machine instruction is used to emit location entries. DebugLoc associated with a DBG_VALUE is used to identify lexical scope of the variable. After register allocation, while inserting DBG_VALUE remember original debug location for the first instruction and reuse it, otherwise dwarf writer may be mislead in identifying the variable's scope.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124845 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 01:43:25 +00:00
Benjamin Kramer
042b27f40e SimplifyCFG: Also transform switches that represent a range comparison but are not sorted into sub+icmp.
This transforms another 1000 switches in gcc.c.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124826 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 22:51:41 +00:00
Richard Osborne
17c1e51d22 Add XCore intrinsics for resource instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124794 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 13:14:25 +00:00
Duncan Sands
50ca4d37f7 Improve threading of comparisons over select instructions (spotted by my
auto-simplifier).  This has a big impact on Ada code, but not much else.
Unfortunately the impact is mostly negative!  This is due to PR9004 (aka
SCCP failing to resolve conditional branch conditions in the destination
blocks of the branch), in which simple correlated expressions are not
resolved but complicated ones are, so simplifying has a bad effect!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124788 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 09:37:39 +00:00
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