oota-llvm.git
12 years agoDon't disable MMX support when AVX is enabled. Fix predicates for MMX instructions...
Craig Topper [Mon, 9 Jan 2012 00:11:29 +0000 (00:11 +0000)]
Don't disable MMX support when AVX is enabled. Fix predicates for MMX instructions that were added along with SSE instructions to check for AVX in addition to SSE level.

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

12 years agoEnable FISTTP* instructions when AVX is enabled.
Craig Topper [Sun, 8 Jan 2012 23:04:21 +0000 (23:04 +0000)]
Enable FISTTP* instructions when AVX is enabled.

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

12 years agoTweak my last commit to be less conservative about uses.
Benjamin Kramer [Sun, 8 Jan 2012 21:12:51 +0000 (21:12 +0000)]
Tweak my last commit to be less conservative about uses.

We still save an instruction when just the "and" part is replaced.
Also change the code to match comments more closely.

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

12 years agoDon't forget to transfer implicit uses of return instruction.
Evan Cheng [Sun, 8 Jan 2012 20:41:16 +0000 (20:41 +0000)]
Don't forget to transfer implicit uses of return instruction.

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

12 years agoAvoid eraseing copies from a reserved register unless the definition can be
Evan Cheng [Sun, 8 Jan 2012 19:52:28 +0000 (19:52 +0000)]
Avoid eraseing copies from a reserved register unless the definition can be
safely proven not to have been clobbered. No small test case possible.

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

12 years agoInstCombine: If we have a bit test and a sign test anded/ored together, merge the...
Benjamin Kramer [Sun, 8 Jan 2012 18:32:24 +0000 (18:32 +0000)]
InstCombine: If we have a bit test and a sign test anded/ored together, merge the sign bit into the bit test.

This is common in bit field code, e.g. checking if the first or the last bit of a bit field is set.

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

12 years agoReverted commit #147601 upon Evan's request.
Victor Umansky [Sun, 8 Jan 2012 17:20:33 +0000 (17:20 +0000)]
Reverted commit #147601 upon Evan's request.

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

12 years agoRemove MCELFStreamer.h.
Rafael Espindola [Sat, 7 Jan 2012 23:18:39 +0000 (23:18 +0000)]
Remove MCELFStreamer.h.

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

12 years agoDon't print a label before .cfi_startproc when we don't need to. This makes
Rafael Espindola [Sat, 7 Jan 2012 22:42:19 +0000 (22:42 +0000)]
Don't print a label before .cfi_startproc when we don't need to. This makes
the produce assembly when using CFI just a bit more readable.

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

12 years agoMake clever use of alignment and padding to shrink GlobalValue.
Benjamin Kramer [Sat, 7 Jan 2012 21:17:16 +0000 (21:17 +0000)]
Make clever use of alignment and padding to shrink GlobalValue.

-8 bytes on x86_64, no change on x86.

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

12 years agoMatch SelectionDAG logic for enabling movt.
Jakob Stoklund Olesen [Sat, 7 Jan 2012 20:49:15 +0000 (20:49 +0000)]
Match SelectionDAG logic for enabling movt.

Darwin doesn't do static, and ELF targets only support static.

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

12 years agoFix typo in the X86 backend readme. Patch from Jaeden Amero.
Craig Topper [Sat, 7 Jan 2012 20:35:21 +0000 (20:35 +0000)]
Fix typo in the X86 backend readme. Patch from Jaeden Amero.

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

12 years agoRemove VectorExtras. This unused helper was written for a type of API that is discour...
Benjamin Kramer [Sat, 7 Jan 2012 19:42:13 +0000 (19:42 +0000)]
Remove VectorExtras. This unused helper was written for a type of API that is discouraged now.

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

12 years agoRemove unnecessary check of hasAVX(). It's already included in hasXMM().
Craig Topper [Sat, 7 Jan 2012 18:48:43 +0000 (18:48 +0000)]
Remove unnecessary check of hasAVX(). It's already included in hasXMM().

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

12 years agoReplace some uses of hasNUsesOfValue(0, X) with !hasAnyUseOfValue(X)
Craig Topper [Sat, 7 Jan 2012 18:31:09 +0000 (18:31 +0000)]
Replace some uses of hasNUsesOfValue(0, X) with !hasAnyUseOfValue(X)

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

12 years agoPort the trick to skip the check for empty buckets from StringMap to DenseMap.
Benjamin Kramer [Sat, 7 Jan 2012 13:12:07 +0000 (13:12 +0000)]
Port the trick to skip the check for empty buckets from StringMap to DenseMap.

This should fix the odd behavior that find() is slower than lookup().

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

12 years agoAdd some DAG combines for SUBC/SUBE. If nothing uses the carry/borrow out of subc...
Craig Topper [Sat, 7 Jan 2012 09:06:39 +0000 (09:06 +0000)]
Add some DAG combines for SUBC/SUBE. If nothing uses the carry/borrow out of subc, turn it into a sub. Turn (subc x, x) into 0 with no borrow. Turn (subc x, 0) into x with no borrow. Turn (subc -1, x) into (xor x, -1) with no borrow. Turn sube with no borrow in into subc.

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

12 years agoFix TableGen so that it will emit the correct signature for FastEmit_f:
Cameron Zwarich [Sat, 7 Jan 2012 08:18:37 +0000 (08:18 +0000)]
Fix TableGen so that it will emit the correct signature for FastEmit_f:

  /// FastEmit_f - This method is called by target-independent code
  /// to request that an instruction with the given type, opcode, and
  /// floating-point immediate operand be emitted.
  virtual unsigned FastEmit_f(MVT VT,
                              MVT RetVT,
                              unsigned Opcode,
                              const ConstantFP *FPImm);

Currently, it emits an accidentally overloaded version without the const on the
ConstantFP*. This doesn't affect anything in the tree, since nothing causes that
method to be autogenerated, but I have been playing with some ARM TableGen
refactorings that hit this problem.

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

12 years agoOptimize reserved register coalescing.
Jakob Stoklund Olesen [Sat, 7 Jan 2012 07:39:50 +0000 (07:39 +0000)]
Optimize reserved register coalescing.

Reserved registers don't have proper live ranges, their LiveInterval
simply has a snippet of liveness for each def.  Virtual registers with a
single value that is a copy of a reserved register (typically %esp) can
be coalesced with the reserved register if the live range doesn't
overlap any reserved register defs.

When coalescing with a reserved register, don't modify the reserved
register live range.  Just leave it as a bunch of dead defs.  This
eliminates quadratic coalescer behavior in i386 functions with many
function calls.

PR11699

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

12 years agoUse the 'regalloc' debug tag for most register allocator tracing.
Jakob Stoklund Olesen [Sat, 7 Jan 2012 07:39:47 +0000 (07:39 +0000)]
Use the 'regalloc' debug tag for most register allocator tracing.

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

12 years agoEnable redundant phi elimination after LSR.
Andrew Trick [Sat, 7 Jan 2012 07:08:17 +0000 (07:08 +0000)]
Enable redundant phi elimination after LSR.

This will be more important as we extend the LSR pass in ways that don't rely on the formula solver. In particular, we need it for constructing IV chains.

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

12 years agoFix dead link
Eli Bendersky [Sat, 7 Jan 2012 04:11:27 +0000 (04:11 +0000)]
Fix dead link

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

12 years agoUse getRegForValue() to materialize the address of ARM globals.
Jakob Stoklund Olesen [Sat, 7 Jan 2012 04:07:22 +0000 (04:07 +0000)]
Use getRegForValue() to materialize the address of ARM globals.

This enables basic local CSE, giving us 20% smaller code for
consumer-typeset in -O0 builds.

<rdar://problem/10658692>

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

12 years agoRevert part of r147716. Looks like x87 instructions kill markers are all messed
Evan Cheng [Sat, 7 Jan 2012 03:35:48 +0000 (03:35 +0000)]
Revert part of r147716. Looks like x87 instructions kill markers are all messed
up so branch folding pass can't use the scavenger. :-(  This doesn't breaks
anything currently. It just means targets which do not carefully update kill
markers cannot run post-ra scheduler (not new, it has always been the case).

We should fix this at some point since it's really hacky.

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

12 years agoLSR: Don't optimize loops if an outer loop has no preheader.
Andrew Trick [Sat, 7 Jan 2012 03:16:50 +0000 (03:16 +0000)]
LSR: Don't optimize loops if an outer loop has no preheader.

LoopSimplify may not run on some outer loops, e.g. because of indirect
branches. SCEVExpander simply cannot handle outer loops with no preheaders.
Fixes rdar://10655343 SCEVExpander segfault.

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

12 years agoSplit Finish into Finish and FinishImpl to have a common place to do end of
Rafael Espindola [Sat, 7 Jan 2012 03:13:18 +0000 (03:13 +0000)]
Split Finish into Finish and FinishImpl to have a common place to do end of
file error checking. Use that to error on an unfinished cfi_startproc.

The error is not nice, but is already better than a segmentation fault.

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

12 years agoAdded a late machine instruction copy propagation pass. This catches
Evan Cheng [Sat, 7 Jan 2012 03:02:36 +0000 (03:02 +0000)]
Added a late machine instruction copy propagation pass. This catches
opportunities that only present themselves after late optimizations
such as tail duplication .e.g.
## BB#1:
        movl    %eax, %ecx
        movl    %ecx, %eax
        ret

The register allocator also leaves some of them around (due to false
dep between copies from phi-elimination, etc.)

This required some changes in codegen passes. Post-ra scheduler and the
pseudo-instruction expansion passes have been moved after branch folding
and tail merging. They were before branch folding before because it did
not always update block livein's. That's fixed now. The pass change makes
independently since we want to properly schedule instructions after
branch folding / tail duplication.

rdar://10428165
rdar://10640363

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

12 years agoCopy implicit defs (e.g. r0) when changing tBX_RET to tPOP_RET. This bug is
Evan Cheng [Sat, 7 Jan 2012 02:55:54 +0000 (02:55 +0000)]
Copy implicit defs (e.g. r0) when changing tBX_RET to tPOP_RET. This bug is
exposed with an upcoming change will would delete the copy to return register
because there is no use! It's amazing anything works.

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

12 years agoUse movw+movt in ARMFastISel::ARMMaterializeGV.
Jakob Stoklund Olesen [Sat, 7 Jan 2012 01:47:05 +0000 (01:47 +0000)]
Use movw+movt in ARMFastISel::ARMMaterializeGV.

This eliminates a lot of constant pool entries for -O0 builds of code
with many global variable accesses.

This speeds up -O0 codegen of consumer-typeset by 2x because the
constant island pass no longer has to look at thousands of constant pool
entries.

<rdar://problem/10629774>

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

12 years agoLSR: run DeleteDeadPhis before replaceCongruentPhis.
Andrew Trick [Sat, 7 Jan 2012 01:36:44 +0000 (01:36 +0000)]
LSR: run DeleteDeadPhis before replaceCongruentPhis.

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

12 years agoRefactor.
Devang Patel [Sat, 7 Jan 2012 01:33:34 +0000 (01:33 +0000)]
Refactor.

Store AsmParser info locally. A small step towards emitting match entries for multiple asm variants.

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

12 years agoCleanup comments and argument types related to my previous replaceCongruentPhis checkin.
Andrew Trick [Sat, 7 Jan 2012 01:29:21 +0000 (01:29 +0000)]
Cleanup comments and argument types related to my previous replaceCongruentPhis checkin.

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

12 years agoEliminate an error check that may not work with all asm syntax variants.
Devang Patel [Sat, 7 Jan 2012 01:22:23 +0000 (01:22 +0000)]
Eliminate an error check that may not work with all asm syntax variants.

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

12 years agoExtended replaceCongruentPhis to handle mixed phi types.
Andrew Trick [Sat, 7 Jan 2012 01:12:09 +0000 (01:12 +0000)]
Extended replaceCongruentPhis to handle mixed phi types.

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

12 years agoMake the 'x' constraint work for AVX registers as well.
Eric Christopher [Sat, 7 Jan 2012 01:02:09 +0000 (01:02 +0000)]
Make the 'x' constraint work for AVX registers as well.

Fixes rdar://10614894

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

12 years agoMissing raw_ostream.h breaks MSVC build.
Andrew Trick [Sat, 7 Jan 2012 00:54:28 +0000 (00:54 +0000)]
Missing raw_ostream.h breaks MSVC build.

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

12 years agocomment typo
Andrew Trick [Sat, 7 Jan 2012 00:29:20 +0000 (00:29 +0000)]
comment typo

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

12 years agoExpose isNonConstantNegative to users of ScalarEvolution.
Andrew Trick [Sat, 7 Jan 2012 00:27:31 +0000 (00:27 +0000)]
Expose isNonConstantNegative to users of ScalarEvolution.

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

12 years agoAdd comment.
Chad Rosier [Fri, 6 Jan 2012 23:45:47 +0000 (23:45 +0000)]
Add comment.

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

12 years agoAdd a comment and ensure that anyone else looking at this code doesn't start
Eric Christopher [Fri, 6 Jan 2012 23:03:37 +0000 (23:03 +0000)]
Add a comment and ensure that anyone else looking at this code doesn't start
to bleed from the eyes.

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

12 years agoUse const vector references instead of a vector copy. Spotted by Devang.
Eric Christopher [Fri, 6 Jan 2012 23:03:34 +0000 (23:03 +0000)]
Use const vector references instead of a vector copy. Spotted by Devang.

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

12 years agoUse -> instead of (*iter).
Eric Christopher [Fri, 6 Jan 2012 23:03:27 +0000 (23:03 +0000)]
Use -> instead of (*iter).

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

12 years agoEnable aligned NEON spilling by default.
Jakob Stoklund Olesen [Fri, 6 Jan 2012 22:19:37 +0000 (22:19 +0000)]
Enable aligned NEON spilling by default.

Experiments show this to be a small speedup for modern ARM cores.

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

12 years agoPut all IVUsers in the processed set. Allow querying IVUsers with isIVUserOrOperand.
Andrew Trick [Fri, 6 Jan 2012 21:41:55 +0000 (21:41 +0000)]
Put all IVUsers in the processed set. Allow querying IVUsers with isIVUserOrOperand.

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

12 years agoAbort AdjustBBOffsetsAfter early when possible.
Jakob Stoklund Olesen [Fri, 6 Jan 2012 21:40:15 +0000 (21:40 +0000)]
Abort AdjustBBOffsetsAfter early when possible.

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

12 years agolit/lit.TestRunner: Add an extra_substitutions argument for executeShTest --
Daniel Dunbar [Fri, 6 Jan 2012 21:39:06 +0000 (21:39 +0000)]
lit/lit.TestRunner: Add an extra_substitutions argument for executeShTest --
useful for test suites which want to piggyback onto the "shtest" format style.

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

12 years agoSCEVExpander: hoistStep should check strict dominance.
Andrew Trick [Fri, 6 Jan 2012 21:23:43 +0000 (21:23 +0000)]
SCEVExpander: hoistStep should check strict dominance.

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

12 years agoTracing to help investigate issues with SjLj spill code.
Andrew Trick [Fri, 6 Jan 2012 21:16:27 +0000 (21:16 +0000)]
Tracing to help investigate issues with SjLj spill code.

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

12 years agoInitializing to false makes better sense. Thanks, David.
Chad Rosier [Fri, 6 Jan 2012 20:11:59 +0000 (20:11 +0000)]
Initializing to false makes better sense.  Thanks, David.

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

12 years agoFix uninitialized variable warning.
Chad Rosier [Fri, 6 Jan 2012 20:02:49 +0000 (20:02 +0000)]
Fix uninitialized variable warning.

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

12 years agoFix uninitialized variable warning.
Chad Rosier [Fri, 6 Jan 2012 19:59:58 +0000 (19:59 +0000)]
Fix uninitialized variable warning.

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

12 years agoFix a leak I noticed while reviewing the accelerator table changes. Passes
Eric Christopher [Fri, 6 Jan 2012 19:35:04 +0000 (19:35 +0000)]
Fix a leak I noticed while reviewing the accelerator table changes. Passes
lldb testsuite.

rdar://10652330

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

12 years ago[asan] cleanup: remove the SIGILL-related code (compiler part)
Kostya Serebryany [Fri, 6 Jan 2012 18:09:21 +0000 (18:09 +0000)]
[asan] cleanup: remove the SIGILL-related code (compiler part)

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

12 years agoFix typo in string
Eli Bendersky [Fri, 6 Jan 2012 07:49:17 +0000 (07:49 +0000)]
Fix typo in string

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

12 years agoAs part of the ongoing work in finalizing the accelerator tables, extend
Eric Christopher [Fri, 6 Jan 2012 04:35:23 +0000 (04:35 +0000)]
As part of the ongoing work in finalizing the accelerator tables, extend
the debug type accelerator tables to contain the tag and a flag
stating whether or not a compound type is a complete type.

rdar://10652330

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

12 years agoFix SpeculativelyExecuteBB to either speculate all or none of the phis
Dan Gohman [Thu, 5 Jan 2012 23:58:56 +0000 (23:58 +0000)]
Fix SpeculativelyExecuteBB to either speculate all or none of the phis
present in the bottom of the CFG triangle, as the transformation isn't
ever valuable if the branch can't be eliminated.

Also, unify some heuristics between SimplifyCFG's multiple
if-converters, for consistency.

This fixes rdar://10627242.

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

12 years agoPR11705, part 2: globalopt shouldn't put inttoptr/ptrtoint operations into global...
Eli Friedman [Thu, 5 Jan 2012 23:03:32 +0000 (23:03 +0000)]
PR11705, part 2: globalopt shouldn't put inttoptr/ptrtoint operations into global initializers if there's an implied extension or truncation.

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

12 years agoLink symbols with different visibilities according to the rules in the
Rafael Espindola [Thu, 5 Jan 2012 23:02:01 +0000 (23:02 +0000)]
Link symbols with different visibilities according to the rules in the
System V Application Binary Interface. This lets us use
-fvisibility-inlines-hidden with LTO.
Fixes PR11697.

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

12 years agoRevert r56315. When the instruction to speculate is a load, this
Dan Gohman [Thu, 5 Jan 2012 22:54:35 +0000 (22:54 +0000)]
Revert r56315. When the instruction to speculate is a load, this
code can incorrectly move the load across a store. This never
happens in practice today, but only because the current
heuristics accidentally preclude it.

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

12 years agoKill ObjectCodeEmitter and BinaryObject, they were unused and superseded by MC.
Benjamin Kramer [Thu, 5 Jan 2012 22:31:37 +0000 (22:31 +0000)]
Kill ObjectCodeEmitter and BinaryObject, they were unused and superseded by MC.

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

12 years agoSCCCaptured is trivially false on entry to this loop and not modified inside it.
Nick Lewycky [Thu, 5 Jan 2012 22:21:45 +0000 (22:21 +0000)]
SCCCaptured is trivially false on entry to this loop and not modified inside it.
Eliminate the dead test for it on each loop iteration. No functionality change.

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

12 years agoRemove the old ELF writer.
Rafael Espindola [Thu, 5 Jan 2012 22:07:43 +0000 (22:07 +0000)]
Remove the old ELF writer.

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

12 years agoA small re-factored JIT/MCJIT::getPointerToNamedFunction(), so it could be called...
Danil Malyshev [Thu, 5 Jan 2012 21:16:14 +0000 (21:16 +0000)]
A small re-factored JIT/MCJIT::getPointerToNamedFunction(), so it could be called with the base class.

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

12 years agorevert r147542 after comments from Joerg Sonnenberger
Sebastian Pop [Thu, 5 Jan 2012 18:28:46 +0000 (18:28 +0000)]
revert r147542 after comments from Joerg Sonnenberger

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

12 years agoallow clients of SmallSet to specify their own comparison function for the set.
Chris Lattner [Thu, 5 Jan 2012 17:35:07 +0000 (17:35 +0000)]
allow clients of SmallSet to specify their own comparison function for the set.
Patch by Stepan Dyatkovskiy!

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

12 years agoRemove an unused variable.
Chandler Carruth [Thu, 5 Jan 2012 11:25:47 +0000 (11:25 +0000)]
Remove an unused variable.

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

12 years agoPrevent a DAGCombine from firing where there are two uses of
Chandler Carruth [Thu, 5 Jan 2012 11:05:55 +0000 (11:05 +0000)]
Prevent a DAGCombine from firing where there are two uses of
a combined-away node and the result of the combine isn't substantially
smaller than the input, it's just canonicalized. This is the first part
of a significant (7%) performance gain for Snappy's hot decompression
loop.

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

12 years agoCleanup and FileCheck-ize a test.
Chandler Carruth [Thu, 5 Jan 2012 11:05:47 +0000 (11:05 +0000)]
Cleanup and FileCheck-ize a test.

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

12 years agoMark scalar FMA4 instructions as ignoring the VEX.L bit.
Craig Topper [Thu, 5 Jan 2012 08:56:10 +0000 (08:56 +0000)]
Mark scalar FMA4 instructions as ignoring the VEX.L bit.

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

12 years agoPeephole optimization of ptest-conditioned branch in X86 arch. Performs instruction...
Victor Umansky [Thu, 5 Jan 2012 08:46:19 +0000 (08:46 +0000)]
Peephole optimization of ptest-conditioned branch in X86 arch. Performs instruction combining of sequences generated by ptestz/ptestc intrinsics to ptest+jcc pair for SSE and AVX.

Testing: passed 'make check' including LIT tests for all sequences being handled (both SSE and AVX)

Reviewers: Evan Cheng, David Blaikie, Bruno Lopes, Elena Demikhovsky, Chad Rosier, Anton Korobeynikov

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

12 years agotest commit (verifyiing commit access)
Eli Bendersky [Thu, 5 Jan 2012 08:18:41 +0000 (08:18 +0000)]
test commit (verifyiing commit access)

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

12 years agoMinor postra scheduler cleanup. It could result in more precise antidependence latenc...
Andrew Trick [Thu, 5 Jan 2012 02:52:11 +0000 (02:52 +0000)]
Minor postra scheduler cleanup. It could result in more precise antidependence latency on ARM in exceedingly rare cases.

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

12 years agoReplace the uint64_t -> double convertion algorithm with one that's more efficient.
Bill Wendling [Thu, 5 Jan 2012 02:13:20 +0000 (02:13 +0000)]
Replace the uint64_t -> double convertion algorithm with one that's more efficient.

This small bit of ASM code is sufficient to do what the old algorithm did:

     movq       %rax,  %xmm0
     punpckldq  (c0),  %xmm0  // c0: (uint4){ 0x43300000U, 0x45300000U, 0U, 0U }
     subpd      (c1),  %xmm0  // c1: (double2){ 0x1.0p52, 0x1.0p52 * 0x1.0p32 }
   #ifdef __SSE3__
     haddpd   %xmm0, %xmm0
   #else
     pshufd   $0x4e, %xmm0, %xmm1
     addpd    %xmm1, %xmm0
   #endif

It's arguably faster. One caveat, the 'haddpd' instruction isn't very fast on
all processors.
<rdar://problem/7719814>

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

12 years agocomment cleanup
Andrew Trick [Thu, 5 Jan 2012 01:01:01 +0000 (01:01 +0000)]
comment cleanup

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

12 years agoDo not hard code asm variant number.
Devang Patel [Thu, 5 Jan 2012 00:51:28 +0000 (00:51 +0000)]
Do not hard code asm variant number.

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

12 years agoFileCheck hygiene.
Benjamin Kramer [Thu, 5 Jan 2012 00:43:34 +0000 (00:43 +0000)]
FileCheck hygiene.

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

12 years agoReapply r146997, "Heed spill slot alignment on ARM."
Jakob Stoklund Olesen [Thu, 5 Jan 2012 00:26:57 +0000 (00:26 +0000)]
Reapply r146997, "Heed spill slot alignment on ARM."

Now that canRealignStack() understands frozen reserved registers, it is
safe to use it for aligned spill instructions.

It will only return true if the registers reserved at the beginning of
register allocation allow for dynamic stack realignment.

<rdar://problem/10625436>

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

12 years agoAvoid reserving an ARM base pointer during register allocation.
Jakob Stoklund Olesen [Thu, 5 Jan 2012 00:26:52 +0000 (00:26 +0000)]
Avoid reserving an ARM base pointer during register allocation.

Once register allocation has started the reserved registers are frozen.

Fix the ARM canRealignStack() hook to respect the frozen register state.
Now the hook returns false if register allocation was started with frame
pointer elimination enabled.

It also returns false if register allocation started without a reserved
base pointer, and stack realignment would require a base pointer.  This
bug was breaking oggenc on armv6.

No test case, an upcoming patch will use this functionality to realign
the stack for spill slots when possible.

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

12 years agoFreeze reserved registers before starting register allocation.
Jakob Stoklund Olesen [Thu, 5 Jan 2012 00:26:49 +0000 (00:26 +0000)]
Freeze reserved registers before starting register allocation.

The register allocators don't currently support adding reserved
registers while they are running.  Extend the MRI API to keep track of
the set of reserved registers when register allocation started.

Target hooks like hasFP() and needsStackRealignment() can look at this
set to avoid reserving more registers during register allocation.

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

12 years agoGeneralize isSafeToSpeculativelyExecute to work on arbitrary
Dan Gohman [Wed, 4 Jan 2012 23:01:09 +0000 (23:01 +0000)]
Generalize isSafeToSpeculativelyExecute to work on arbitrary
Values, rather than just Instructions, since it's interesting
for ConstantExprs too.

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

12 years agoSilence warnings of a mysterious compiler that still defaults to C89.
Benjamin Kramer [Wed, 4 Jan 2012 22:06:45 +0000 (22:06 +0000)]
Silence warnings of a mysterious compiler that still defaults to C89.

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

12 years agoSimplify more DenseMap.find users.
Benjamin Kramer [Wed, 4 Jan 2012 21:41:24 +0000 (21:41 +0000)]
Simplify more DenseMap.find users.

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

12 years agoStringMap.find never points to an empty bucket or tombstone, skip the check.
Benjamin Kramer [Wed, 4 Jan 2012 20:45:14 +0000 (20:45 +0000)]
StringMap.find never points to an empty bucket or tombstone, skip the check.

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

12 years agoSimplify code. No functionality change.
Benjamin Kramer [Wed, 4 Jan 2012 20:20:08 +0000 (20:20 +0000)]
Simplify code. No functionality change.

Using DenseMap iterators isn't free as they have to check for empty
buckets. Dominator queries are common so this gives a minor speedup.

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

12 years agouse getHostTriple instead of getDefaultTargetTriple in getClosestTargetForJIT
Sebastian Pop [Wed, 4 Jan 2012 19:47:22 +0000 (19:47 +0000)]
use getHostTriple instead of getDefaultTargetTriple in getClosestTargetForJIT

Get back getHostTriple.

For JIT compilation, use the host triple instead of the default
target: this fixes some JIT testcases that used to fail when the
compiler has been configured as a cross compiler.

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

12 years agoEnable -soft-float for MIPS.
Akira Hatanaka [Wed, 4 Jan 2012 19:29:11 +0000 (19:29 +0000)]
Enable -soft-float for MIPS.

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

12 years agoRemove pointless asserts.
Nick Lewycky [Wed, 4 Jan 2012 09:42:30 +0000 (09:42 +0000)]
Remove pointless asserts.

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

12 years agoTeach instcombine all sorts of great stuff about shifts that have exact, nuw or
Nick Lewycky [Wed, 4 Jan 2012 09:28:29 +0000 (09:28 +0000)]
Teach instcombine all sorts of great stuff about shifts that have exact, nuw or
nsw bits on them.

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

12 years agoAllow vector shuffle normalizing to use concat vector even if the sources are commute...
Craig Topper [Wed, 4 Jan 2012 09:23:09 +0000 (09:23 +0000)]
Allow vector shuffle normalizing to use concat vector even if the sources are commuted in the shuffle mask.

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

12 years agoImplement VECTOR_SHUFFLE canonicalizations during DAG combine.
Craig Topper [Wed, 4 Jan 2012 08:07:43 +0000 (08:07 +0000)]
Implement VECTOR_SHUFFLE canonicalizations during DAG combine.

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

12 years agotest/CodeGen/X86/jump_sign.ll: Add -mcpu=pentiumpro for non-x86 hosts. It uses "cmov".
NAKAMURA Takumi [Wed, 4 Jan 2012 03:52:23 +0000 (03:52 +0000)]
test/CodeGen/X86/jump_sign.ll: Add -mcpu=pentiumpro for non-x86 hosts. It uses "cmov".

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

12 years agoRename immLUiOpnd.
Akira Hatanaka [Wed, 4 Jan 2012 03:09:26 +0000 (03:09 +0000)]
Rename immLUiOpnd.

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

12 years ago- Define base classes for Jump-and-link instructions and make 32-bit and 64-bit
Akira Hatanaka [Wed, 4 Jan 2012 03:02:47 +0000 (03:02 +0000)]
- Define base classes for Jump-and-link instructions and make 32-bit and 64-bit
  versions derive from them.
- JALR64 is not needed since N64 does not emit jal.
- Add template parameter to BranchLink that sets the rt field.
- Fix the set of temporary registers for O32 and N64.

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

12 years agoHave getRegForInlineAsmConstraint return the correct register class when target
Akira Hatanaka [Wed, 4 Jan 2012 02:45:01 +0000 (02:45 +0000)]
Have getRegForInlineAsmConstraint return the correct register class when target
is Mips64.

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

12 years agoFix more places which should be checking for iOS, not darwin.
Evan Cheng [Wed, 4 Jan 2012 01:55:04 +0000 (01:55 +0000)]
Fix more places which should be checking for iOS, not darwin.

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

12 years agoFor x86, canonicalize max
Evan Cheng [Wed, 4 Jan 2012 01:41:39 +0000 (01:41 +0000)]
For x86, canonicalize max
(x > y) ? x : y
=>
(x >= y) ? x : y

So for something like
(x - y) > 0 : (x - y) ? 0
It will be
(x - y) >= 0 : (x - y) ? 0

This makes is possible to test sign-bit and eliminate a comparison against
zero. e.g.
subl   %esi, %edi
testl  %edi, %edi
movl   $0, %eax
cmovgl %edi, %eax
=>
xorl   %eax, %eax
subl   %esi, $edi
cmovsl %eax, %edi

rdar://10633221

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

12 years ago[asan] one more test for asan instrumentation: (*a)++ should be instrumented only...
Kostya Serebryany [Wed, 4 Jan 2012 01:02:14 +0000 (01:02 +0000)]
[asan] one more test for asan instrumentation: (*a)++ should be instrumented only once.

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

12 years agoTurn a few more inline asm errors into "emitErrors" instead of fatal errors.
Chris Lattner [Tue, 3 Jan 2012 23:51:01 +0000 (23:51 +0000)]
Turn a few more inline asm errors into "emitErrors" instead of fatal errors.

Before we'd get:

$ clang t.c
fatal error: error in backend: Invalid operand for inline asm constraint 'i'!

Now we get:

$ clang t.c
t.c:16:5: error: invalid operand for inline asm constraint 'i'!
    "movq         (%4), %%mm0\n"
    ^

Which at least gets us the inline asm that is the problem.

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

12 years agogeneralize LLVMContext::emitError to take a twine instead of a StringRef.
Chris Lattner [Tue, 3 Jan 2012 23:47:05 +0000 (23:47 +0000)]
generalize LLVMContext::emitError to take a twine instead of a StringRef.

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

12 years agoFix 80-column violations.
Chad Rosier [Tue, 3 Jan 2012 23:19:12 +0000 (23:19 +0000)]
Fix 80-column violations.

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