oota-llvm.git
10 years ago[SLP] Re-enable vectorization of GEP expressions (re-apply r210342 with a fix).
Michael Zolotukhin [Wed, 27 Aug 2014 15:01:18 +0000 (15:01 +0000)]
[SLP] Re-enable vectorization of GEP expressions (re-apply r210342 with a fix).

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

10 years agoClang-format over X86AsmInstrumentation.* with LLVM style.
Evgeniy Stepanov [Wed, 27 Aug 2014 13:11:55 +0000 (13:11 +0000)]
Clang-format over X86AsmInstrumentation.* with LLVM style.

r216536 mistakenly used -style=Google instead of LLVM.

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

10 years agoAdd an explicit cast to pacify implicit boolean conversion warnings.
Benjamin Kramer [Wed, 27 Aug 2014 11:47:52 +0000 (11:47 +0000)]
Add an explicit cast to pacify implicit boolean conversion warnings.

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

10 years ago[x86] Fix a regression introduced with r213897 for 32-bit targets where
Chandler Carruth [Wed, 27 Aug 2014 11:39:47 +0000 (11:39 +0000)]
[x86] Fix a regression introduced with r213897 for 32-bit targets where
we stopped efficiently lowering sextload using the SSE41 instructions
for that operation.

This is a consequence of a bad predicate I used thinking of the memory
access needs. The code actually handles the cases where the predicate
doesn't apply, and handles them much better. =] Simple fix and a test
case added. Fixes PR20767.

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

10 years ago[SDAG] Re-instate r215611 with a fix to a pesky X86 DAG combine.
Chandler Carruth [Wed, 27 Aug 2014 11:22:16 +0000 (11:22 +0000)]
[SDAG] Re-instate r215611 with a fix to a pesky X86 DAG combine.

This combine is essentially combining target-specific nodes back into target
independent nodes that it "knows" will be combined yet again by a target
independent DAG combine into a different set of target-independent nodes that
are legal (not custom though!) and thus "ok". This seems... deeply flawed. The
crux of the problem is that we don't combine un-legalized shuffles that are
introduced by legalizing other operations, and thus we don't see a very
profitable combine opportunity. So the backend just forces the input to that
combine to re-appear.

However, for this to work, the conditions detected to re-form the unlegalized
nodes must be *exactly* right. Previously, failing this would have caused poor
code (if you're lucky) or a crasher when we failed to select instructions.
After r215611 we would fall back into the legalizer. In some cases, this just
"fixed" the crasher by produces bad code. But in the test case added it caused
the legalizer and the dag combiner to iterate forever.

The fix is to make the alignment checking in the x86 side of things match the
alignment checking in the generic DAG combine exactly. This isn't really a
satisfying or principled fix, but it at least make the code work as intended.
It also highlights that it would be nice to detect the availability of under
aligned loads for a given type rather than bailing on this optimization. I've
left a FIXME to document this.

Original commit message for r215611 which covers the rest of the chang:
  [SDAG] Fix a case where we would iteratively legalize a node during
  combining by replacing it with something else but not re-process the
  node afterward to remove it.

  In a truly remarkable stroke of bad luck, this would (in the test case
  attached) end up getting some other node combined into it without ever
  getting re-processed. By adding it back on to the worklist, in addition
  to deleting the dead nodes more quickly we also ensure that if it
  *stops* being dead for any reason it makes it back through the
  legalizer. Without this, the test case will end up failing during
  instruction selection due to an and node with a type we don't have an
  instruction pattern for.

It took many million runs of the shuffle fuzz tester to find this.

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

10 years agoClang-format over X86AsmInstrumentation.*.
Evgeniy Stepanov [Wed, 27 Aug 2014 11:10:54 +0000 (11:10 +0000)]
Clang-format over X86AsmInstrumentation.*.

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

10 years ago[SKX] Added new versions of cmp instructions in avx512_icmp_cc multiclass, added...
Robert Khasanov [Wed, 27 Aug 2014 09:34:37 +0000 (09:34 +0000)]
[SKX] Added new versions of cmp instructions in avx512_icmp_cc multiclass, added VL multiclass.
Added encoding tests

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

10 years agoAVX-512: Added intrinsic for VMOVSS store form with mask.
Elena Demikhovsky [Wed, 27 Aug 2014 07:38:43 +0000 (07:38 +0000)]
AVX-512: Added intrinsic for VMOVSS store form with mask.

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

10 years agoSimplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting...
Craig Topper [Wed, 27 Aug 2014 05:25:25 +0000 (05:25 +0000)]
Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.

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

10 years agoFix some cases were ArrayRefs were being passed by reference. Also remove 'const...
Craig Topper [Wed, 27 Aug 2014 05:25:00 +0000 (05:25 +0000)]
Fix some cases were ArrayRefs were being passed by reference. Also remove 'const' from some other ArrayRef uses since its implicitly const already.

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

10 years agoInstCombine: Optimize GEP's involving ptrtoint better
David Majnemer [Wed, 27 Aug 2014 05:16:04 +0000 (05:16 +0000)]
InstCombine: Optimize GEP's involving ptrtoint better

We supported transforming:
(gep i8* X, -(ptrtoint Y))

to:
(inttoptr (sub (ptrtoint X), (ptrtoint Y)))

However, this only fired if 'X' had type i8*.  Generalize this to
support various types of different sizes.  This results in much better
CodeGen, especially for pointers to packed structs.

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

10 years agoRemove type unit skeletons. GDB no longer needs them & this saves a heap of space.
David Blaikie [Wed, 27 Aug 2014 05:04:14 +0000 (05:04 +0000)]
Remove type unit skeletons. GDB no longer needs them & this saves a heap of space.

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

10 years ago[FastISel][AArch64] Fix address simplification.
Juergen Ributzka [Wed, 27 Aug 2014 00:58:30 +0000 (00:58 +0000)]
[FastISel][AArch64] Fix address simplification.

When a shift with extension or an add with shift and extension cannot be folded
into the memory operation, then the address calculation has to be materialized
separately. While doing so the code forgot to consider a possible sign-/zero-
extension. This fix folds now also the sign-/zero-extension into the add or
shift instruction which is used to materialize the address.

This fixes rdar://problem/18141718.

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

10 years ago[FastISel][AArch64] Fold Sign-/Zero-Extend into the shift immediate instruction.
Juergen Ributzka [Wed, 27 Aug 2014 00:58:26 +0000 (00:58 +0000)]
[FastISel][AArch64] Fold Sign-/Zero-Extend into the shift immediate instruction.

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

10 years agoFix a couple of debug info test cases to match the metadata schema change in r216239
David Blaikie [Wed, 27 Aug 2014 00:04:16 +0000 (00:04 +0000)]
Fix a couple of debug info test cases to match the metadata schema change in r216239

Found these while testing something else.

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

10 years agoPass a std::unique_ptr<MemoryBuffer>& to getLazyBitcodeModule.
Rafael Espindola [Tue, 26 Aug 2014 22:00:09 +0000 (22:00 +0000)]
Pass a std::unique_ptr<MemoryBuffer>& to getLazyBitcodeModule.

By taking a reference we can do the ownership transfer in one place instead of
expecting every caller to do it.

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

10 years agoPass a MemoryBufferRef when we can avoid taking ownership.
Rafael Espindola [Tue, 26 Aug 2014 21:49:01 +0000 (21:49 +0000)]
Pass a MemoryBufferRef when we can avoid taking ownership.

The attached patch simplifies a few interfaces that don't need to take
ownership of a buffer.

For example, both parseAssembly and parseBitcodeFile will parse the
entire buffer before returning. There is no need to take ownership.

Using a MemoryBufferRef makes it obvious in the type signature that
there is no ownership transfer.

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

10 years agoGive ExecutionEngine of top level buffers.
Rafael Espindola [Tue, 26 Aug 2014 21:04:04 +0000 (21:04 +0000)]
Give ExecutionEngine of top level buffers.

Long term the idea if for the engine to not own the buffers, but for now
this is consistent with the rest of the API.

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

10 years agoMC: Split the x86 asm matcher implementations by dialect
Reid Kleckner [Tue, 26 Aug 2014 20:32:34 +0000 (20:32 +0000)]
MC: Split the x86 asm matcher implementations by dialect

The existing matcher has lots of AT&T assembly dialect assumptions baked
into it.  In particular, the hack for resolving the size of a memory
operand by appending the four most common suffixes doesn't work at all.
The Intel assembly dialect mnemonic table has ambiguous entries, so we
need to try matching multiple times with different operand sizes, since
that's the only way to choose different instruction variants.

This makes us more compatible with gas's implementation of Intel
assembly syntax.  MSVC assumes you want byte-sized operations for the
instructions that we reject as ambiguous.

Reviewed By: grosbach

Differential Revision: http://reviews.llvm.org/D4747

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

10 years agoRevert r210342 and r210343, add test case for the crasher.
Joerg Sonnenberger [Tue, 26 Aug 2014 19:06:41 +0000 (19:06 +0000)]
Revert r210342 and r210343, add test case for the crasher.
PR 20642.

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

10 years agoConvert MC command line option for fatal assembler warnings into a
Joerg Sonnenberger [Tue, 26 Aug 2014 18:39:50 +0000 (18:39 +0000)]
Convert MC command line option for fatal assembler warnings into a
proper flag.

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

10 years agoInvert the condition to have a single return.
Rafael Espindola [Tue, 26 Aug 2014 18:03:35 +0000 (18:03 +0000)]
Invert the condition to have a single return.

Thanks to David Blaikie for the suggestion.

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

10 years agoReturn a std::unique_ptr from the IRReader.h functions. NFC.
Rafael Espindola [Tue, 26 Aug 2014 17:29:46 +0000 (17:29 +0000)]
Return a std::unique_ptr from the IRReader.h functions. NFC.

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

10 years agoReturn a std::unique_ptr from parseInputFile and propagate. NFC.
Rafael Espindola [Tue, 26 Aug 2014 17:19:03 +0000 (17:19 +0000)]
Return a std::unique_ptr from parseInputFile and propagate. NFC.

The memory management in BugPoint is fairly convoluted, so this just unwraps
one layer by changing the return type of functions that always return
owned Modules.

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

10 years agoSimplify LTOModule::makeLTOModule a bit. NFC.
Rafael Espindola [Tue, 26 Aug 2014 15:09:32 +0000 (15:09 +0000)]
Simplify LTOModule::makeLTOModule a bit. NFC.

Just call parseBitcodeFile instead of getLazyBitcodeModule followed by
materializeAllPermanently.

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

10 years agoMerge TempDir and system_temp_directory.
Rafael Espindola [Tue, 26 Aug 2014 14:47:52 +0000 (14:47 +0000)]
Merge TempDir and system_temp_directory.

We had two functions for finding the temp or cache directory. Each had a
different set of smarts about OS specific APIs.

With this patch system_temp_directory becomes the only way to do it.

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

10 years agoSilence unused function warning in Release builds.
Benjamin Kramer [Tue, 26 Aug 2014 14:22:05 +0000 (14:22 +0000)]
Silence unused function warning in Release builds.

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

10 years agoChange the return value of "getEnd()" from a MachineInstr* to a MachineBasicBlock...
James Molloy [Tue, 26 Aug 2014 13:41:31 +0000 (13:41 +0000)]
Change the return value of "getEnd()" from a MachineInstr* to a MachineBasicBlock::iterator.

It seems on Darwin the illegal round-trip ::iterator -> MachineInstr* -> ::iterator breaks execution horribly when the iterator is not a real MachineInstr, like ::end().

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

10 years agoARM: Add patterns for dbg
Yi Kong [Tue, 26 Aug 2014 12:47:26 +0000 (12:47 +0000)]
ARM: Add patterns for dbg

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

10 years agoThis patch enables SimplifyUsingDistributiveLaws() to handle following pattens.
Dinesh Dwivedi [Tue, 26 Aug 2014 08:53:32 +0000 (08:53 +0000)]
This patch enables SimplifyUsingDistributiveLaws() to handle following pattens.

(X >> Z) & (Y >> Z)  -> (X&Y) >> Z  for all shifts.
(X >> Z) | (Y >> Z)  -> (X|Y) >> Z  for all shifts.
(X >> Z) ^ (Y >> Z)  -> (X^Y) >> Z  for all shifts.

These patterns were previously handled separately in visitAnd()/visitOr()/visitXor().

Differential Revision: http://reviews.llvm.org/D4951

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

10 years agoUse 'xz' compression instead of 'gz'.
Bill Wendling [Tue, 26 Aug 2014 08:11:22 +0000 (08:11 +0000)]
Use 'xz' compression instead of 'gz'.

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

10 years agoInstSimplify: Fold gep X, (sub 0, ptrtoint(X)) to null
David Majnemer [Tue, 26 Aug 2014 07:08:03 +0000 (07:08 +0000)]
InstSimplify: Fold gep X, (sub 0, ptrtoint(X)) to null

Save InstCombine some work if we can perform this fold during
InstSimplify.

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

10 years agoInstSimplify: Simplify trivial pointer expressions like b + (e - b)
David Majnemer [Tue, 26 Aug 2014 05:55:16 +0000 (05:55 +0000)]
InstSimplify: Simplify trivial pointer expressions like b + (e - b)

consider:
long long *f(long long *b, long long *e) {
  return b + (e - b);
}

we would lower this to something like:
define i64* @f(i64* %b, i64* %e) {
  %1 = ptrtoint i64* %e to i64
  %2 = ptrtoint i64* %b to i64
  %3 = sub i64 %1, %2
  %4 = ashr exact i64 %3, 3
  %5 = getelementptr inbounds i64* %b, i64 %4
  ret i64* %5
}

This should fold away to just 'e'.

N.B.  This adds m_SpecificInt as a convenient way to match against a
particular 64-bit integer when using LLVM's match interface.

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

10 years agoAArch64: use std::fill instead of memset
Dylan Noblesmith [Tue, 26 Aug 2014 03:33:26 +0000 (03:33 +0000)]
AArch64: use std::fill instead of memset

Followup based on review.

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

10 years agoRevert "AArch64: use std::vector for temp array"
Dylan Noblesmith [Tue, 26 Aug 2014 02:03:43 +0000 (02:03 +0000)]
Revert "AArch64: use std::vector for temp array"

This reverts commit r216365.

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

10 years agoAnalysis: cleanup
Dylan Noblesmith [Tue, 26 Aug 2014 02:03:40 +0000 (02:03 +0000)]
Analysis: cleanup

Address review comments.

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

10 years agoRevert "Analysis: unique_ptr-ify DependenceAnalysis::collectCoeffInfo"
Dylan Noblesmith [Tue, 26 Aug 2014 02:03:38 +0000 (02:03 +0000)]
Revert "Analysis: unique_ptr-ify DependenceAnalysis::collectCoeffInfo"

This reverts commit r216358.

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

10 years agoRevert "NVPTX: remove another raw delete call"
Dylan Noblesmith [Tue, 26 Aug 2014 02:03:35 +0000 (02:03 +0000)]
Revert "NVPTX: remove another raw delete call"

This reverts commit r216364.

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

10 years agoRevert "Support/APFloat: unique_ptr-ify temp arrays"
Dylan Noblesmith [Tue, 26 Aug 2014 02:03:33 +0000 (02:03 +0000)]
Revert "Support/APFloat: unique_ptr-ify temp arrays"

This reverts commit rr216359.

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

10 years agoRevert "Support/Path: remove raw delete"
Dylan Noblesmith [Tue, 26 Aug 2014 02:03:30 +0000 (02:03 +0000)]
Revert "Support/Path: remove raw delete"

This reverts commit r216360.

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

10 years agoExecutionEngine: address review comments
Dylan Noblesmith [Tue, 26 Aug 2014 02:03:28 +0000 (02:03 +0000)]
ExecutionEngine: address review comments

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

10 years agoCodeGen/LiveVariables: use vector::assign()
Dylan Noblesmith [Tue, 26 Aug 2014 02:03:25 +0000 (02:03 +0000)]
CodeGen/LiveVariables: use vector::assign()

Address review comments.

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

10 years agomusttail: Don't eliminate varargs packs if there is a forwarding call
Reid Kleckner [Tue, 26 Aug 2014 00:59:51 +0000 (00:59 +0000)]
musttail: Don't eliminate varargs packs if there is a forwarding call

Also clean up and beef up this grep test for the feature.

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

10 years agofix typos in comments
Sanjay Patel [Tue, 26 Aug 2014 00:59:15 +0000 (00:59 +0000)]
fix typos in comments

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

10 years agoDeclare that musttail calls in variadic functions forward the ellipsis
Reid Kleckner [Tue, 26 Aug 2014 00:33:28 +0000 (00:33 +0000)]
Declare that musttail calls in variadic functions forward the ellipsis

Summary:
There is no functionality change here except in the way we assemble and
dump musttail calls in variadic functions. There's really no need to
separate out the bits for musttail and "is forwarding varargs" on call
instructions. A musttail call by definition has to forward the ellipsis
or it would fail verification.

Reviewers: chandlerc, nlewycky

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D4892

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

10 years agoFix Path unittests on Windows after raw_fd_ostream changes
Reid Kleckner [Tue, 26 Aug 2014 00:24:23 +0000 (00:24 +0000)]
Fix Path unittests on Windows after raw_fd_ostream changes

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

10 years agoArgPromotion: Don't touch variadic functions
Reid Kleckner [Mon, 25 Aug 2014 23:58:48 +0000 (23:58 +0000)]
ArgPromotion: Don't touch variadic functions

Adding, removing, or changing non-pack parameters can change the ABI
classification of pack parameters. Clang and other frontends encode the
classification in the IR of the call site, but the callee side
determines it dynamically based on the number of registers consumed so
far. Changing the prototype affects the number of registers consumed
would break such code.

Dead argument elimination performs a similar task and already has a
similar check to avoid this problem.

Patch by Thomas Jablin!

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

10 years ago[MCJIT][SystemZ] Use a simpler expression for indirect relocation offsets.
Lang Hames [Mon, 25 Aug 2014 23:33:48 +0000 (23:33 +0000)]
[MCJIT][SystemZ] Use a simpler expression for indirect relocation offsets.

The expressions 'Reloc.Addend - Addend' and 'Reloc.Offset' should always be
equal in this context. The latter is prefered - we want to remove the
RelocationValueRef::Addend field in the future.

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

10 years agoFix bug in llvm::sys::argumentsFitWithinSystemLimits().
Rafael Espindola [Mon, 25 Aug 2014 22:53:21 +0000 (22:53 +0000)]
Fix bug in llvm::sys::argumentsFitWithinSystemLimits().

This patch fixes a subtle bug in the UNIX implementation of
llvm::sys::argumentsFitWithinSystemLimits() regarding the misuse of a static
variable. This bug causes our cached number that stores the system command line
maximum length to be halved after each call to the function. With a sufficient
number of calls to this function, it will eventually report any given command
line string to be over system limits.

Patch by Rafael Auler.

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

10 years ago[MCJIT] Dump section memory both before and after relocations are applied.
Lang Hames [Mon, 25 Aug 2014 22:19:14 +0000 (22:19 +0000)]
[MCJIT] Dump section memory both before and after relocations are applied.

Also switch section memory dump format from 8 to 16 columns.

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

10 years agoRefactor argument serialization logic when executing process. NFC.
Rafael Espindola [Mon, 25 Aug 2014 22:15:06 +0000 (22:15 +0000)]
Refactor argument serialization logic when executing process. NFC.

This patch refactors the argument serialization logic used in the Execute
function, used to launch new Windows processes. There is a critical step that
joins char** arguments into a single string, building the command line used to
launch the new process, and the readability of this code is improved if this
part is refactored in its own helper function.

Patch by Rafael Auler!

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

10 years ago[FastISel][AArch64] Refactor float zero materialization. NFCI.
Juergen Ributzka [Mon, 25 Aug 2014 19:58:05 +0000 (19:58 +0000)]
[FastISel][AArch64] Refactor float zero materialization. NFCI.

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

10 years ago[MCJIT] Make RuntimeDyld dump section contents in -debug mode.
Lang Hames [Mon, 25 Aug 2014 18:37:38 +0000 (18:37 +0000)]
[MCJIT] Make RuntimeDyld dump section contents in -debug mode.

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

10 years agoModernize raw_fd_ostream's constructor a bit.
Rafael Espindola [Mon, 25 Aug 2014 18:16:47 +0000 (18:16 +0000)]
Modernize raw_fd_ostream's constructor a bit.

Take a StringRef instead of a "const char *".
Take a "std::error_code &" instead of a "std::string &" for error.

A create static method would be even better, but this patch is already a bit too
big.

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

10 years ago[x86] Fix a bug in r216319 where I was missing a 'break'.
Chandler Carruth [Mon, 25 Aug 2014 18:06:11 +0000 (18:06 +0000)]
[x86] Fix a bug in r216319 where I was missing a 'break'.

This actually was caught by existing tests but those tests were disabled
with an XFAIL because of PR20736. While working on fixing that,
I noticed the test failure, and tracked it down to this.

We even have a really nice Clang warning that would have caught this but
it isn't enabled in LLVM! =[ I may look at enabling it.

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

10 years agoRemove dangling initializers in GlobalDCE
Bruno Cardoso Lopes [Mon, 25 Aug 2014 17:51:14 +0000 (17:51 +0000)]
Remove dangling initializers in GlobalDCE

GlobalDCE deletes global vars and updates their initializers to nullptr
while leaving underlying constants to be cleaned up later by its uses.
The clean up may never happen, fix this by forcing it every time it's
safe to destroy constants.

Final patch by Rafael Espindola
http://reviews.llvm.org/D4931

<rdar://problem/17523868>

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

10 years agoRise from the dead and update personal info
Bruno Cardoso Lopes [Mon, 25 Aug 2014 17:51:04 +0000 (17:51 +0000)]
Rise from the dead and update personal info

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

10 years ago[AArch32] Add patterns for VCVT{A,N,P,M}.
Chad Rosier [Mon, 25 Aug 2014 16:56:33 +0000 (16:56 +0000)]
[AArch32] Add patterns for VCVT{A,N,P,M}.

Patterns for lowering libm calls to VCVT{A,N,P,M} are also included.
Phabricator Revision: http://reviews.llvm.org/D5033

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

10 years ago[SKX] avx512_icmp_packed multiclass extension
Robert Khasanov [Mon, 25 Aug 2014 14:49:34 +0000 (14:49 +0000)]
[SKX] avx512_icmp_packed multiclass extension
Extended avx512_icmp_packed multiclass by masking versions.
Added avx512_icmp_packed_rmb multiclass for embedded broadcast versions.
Added corresponding _vl multiclasses.
Added encoding tests for CPCMP{EQ|GT}* instructions.
Add more fields for X86VectorVTInfo.
Added AVX512VLVectorVTInfo that include X86VectorVTInfo for 512/256/128-bit versions

Differential Revision: http://reviews.llvm.org/D5024

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

10 years agoMergeFunctions, tiny refactoring:
Stepan Dyatkovskiy [Mon, 25 Aug 2014 08:22:46 +0000 (08:22 +0000)]
MergeFunctions, tiny refactoring:
cmpAPFloat has been renamed to cmpAPFloats (multiple form).

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

10 years agoMergeFunctions, tiny refactoring:
Stepan Dyatkovskiy [Mon, 25 Aug 2014 08:19:50 +0000 (08:19 +0000)]
MergeFunctions, tiny refactoring:
cmpAPInt has been renamed to cmpAPInts (multiple form).

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

10 years agoMergeFunctions, tiny refactoring:
Stepan Dyatkovskiy [Mon, 25 Aug 2014 08:16:39 +0000 (08:16 +0000)]
MergeFunctions, tiny refactoring:
cmpType has been renamed to cmpTypes (multiple form).

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

10 years agoMergeFunctions, tiny refactoring:
Stepan Dyatkovskiy [Mon, 25 Aug 2014 08:12:45 +0000 (08:12 +0000)]
MergeFunctions, tiny refactoring:
cmpGEP has been renamed to cmpGEPs (multiple form).

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

10 years agoAllow vectorization of division by uniform power of 2.
Karthik Bhat [Mon, 25 Aug 2014 04:56:54 +0000 (04:56 +0000)]
Allow vectorization of division by uniform power of 2.

This patch adds support to recognize division by uniform power of 2 and modifies the cost table to vectorize division by uniform power of 2 whenever possible.
Updates Cost model for Loop and SLP Vectorizer.The cost table is currently only updated for X86 backend.
Thanks to Hal, Andrea, Sanjay for the review. (http://reviews.llvm.org/D4971)

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

10 years agoCodeGen/LiveVariables: hoist out code in nested loops
Dylan Noblesmith [Mon, 25 Aug 2014 01:59:49 +0000 (01:59 +0000)]
CodeGen/LiveVariables: hoist out code in nested loops

This makes runOnMachineFunction vastly more readable.

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

10 years agoCodeGen/LiveVariables: switch to std::vector
Dylan Noblesmith [Mon, 25 Aug 2014 01:59:42 +0000 (01:59 +0000)]
CodeGen/LiveVariables: switch to std::vector

No functionality change.

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

10 years agoAArch64: unique_ptr-ify map structures
Dylan Noblesmith [Mon, 25 Aug 2014 01:59:38 +0000 (01:59 +0000)]
AArch64: unique_ptr-ify map structures

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

10 years agoAArch64: use std::vector for temp array
Dylan Noblesmith [Mon, 25 Aug 2014 01:59:36 +0000 (01:59 +0000)]
AArch64: use std::vector for temp array

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

10 years agoNVPTX: remove another raw delete call
Dylan Noblesmith [Mon, 25 Aug 2014 01:59:32 +0000 (01:59 +0000)]
NVPTX: remove another raw delete call

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

10 years agoNVPTX: remove raw delete call
Dylan Noblesmith [Mon, 25 Aug 2014 01:59:29 +0000 (01:59 +0000)]
NVPTX: remove raw delete call

Also make members that are never accessed outside the class
private.

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

10 years agoExecutionEngine: unique_ptr-ify
Dylan Noblesmith [Mon, 25 Aug 2014 00:58:18 +0000 (00:58 +0000)]
ExecutionEngine: unique_ptr-ify

NFC.

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

10 years agoEE/JIT: unique_ptr-ify
Dylan Noblesmith [Mon, 25 Aug 2014 00:58:15 +0000 (00:58 +0000)]
EE/JIT: unique_ptr-ify

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

10 years agoSupport/Path: remove raw delete
Dylan Noblesmith [Mon, 25 Aug 2014 00:58:13 +0000 (00:58 +0000)]
Support/Path: remove raw delete

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

10 years agoSupport/APFloat: unique_ptr-ify temp arrays
Dylan Noblesmith [Mon, 25 Aug 2014 00:58:10 +0000 (00:58 +0000)]
Support/APFloat: unique_ptr-ify temp arrays

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

10 years agoAnalysis: unique_ptr-ify DependenceAnalysis::collectCoeffInfo
Dylan Noblesmith [Mon, 25 Aug 2014 00:28:43 +0000 (00:28 +0000)]
Analysis: unique_ptr-ify DependenceAnalysis::collectCoeffInfo

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

10 years agoAnalysis: unique_ptr-ify DependenceAnalysis::depends
Dylan Noblesmith [Mon, 25 Aug 2014 00:28:39 +0000 (00:28 +0000)]
Analysis: unique_ptr-ify DependenceAnalysis::depends

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

10 years agoAnalysis: take a reference instead of pointer
Dylan Noblesmith [Mon, 25 Aug 2014 00:28:35 +0000 (00:28 +0000)]
Analysis: take a reference instead of pointer

This parameter is never null.

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

10 years agoCodeGen: switch raw array to std::vector
Dylan Noblesmith [Mon, 25 Aug 2014 00:28:31 +0000 (00:28 +0000)]
CodeGen: switch raw array to std::vector

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

10 years agoIR: remove dead code
Dylan Noblesmith [Mon, 25 Aug 2014 00:28:27 +0000 (00:28 +0000)]
IR: remove dead code

This was added in r134994, to fix a memory leak;
three days later, r135248 switched
ContainedTys from being new-allocated to being allocated
via BumpPtrAllocator, and the earlier fix was never
reverted.

The destructor doesn't seem to ever actually be called
on Types anyway, so it's harmless, but if it were,
this'd be an invalid pointer.

This reverts r134994.

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

10 years agoUse range based for loops to avoid needing to re-mention SmallPtrSet size.
Craig Topper [Sun, 24 Aug 2014 23:23:06 +0000 (23:23 +0000)]
Use range based for loops to avoid needing to re-mention SmallPtrSet size.

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

10 years agoTableGen: unique_ptr-ify RecordKeeper
Dylan Noblesmith [Sun, 24 Aug 2014 19:10:57 +0000 (19:10 +0000)]
TableGen: unique_ptr-ify RecordKeeper

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

10 years agoTableGen: delete no-op code
Dylan Noblesmith [Sun, 24 Aug 2014 19:10:53 +0000 (19:10 +0000)]
TableGen: delete no-op code

This does nothing but remove the Record from the map, and
then re-add it, without actually changing it in between.

The Record's Name used to be changed before re-adding it
when the code was first committed in r137232, but the
name-changing lines were removed in r142510, and since
then this code seems to do nothing.

This was also the only caller of removeClass or removeDef,
so now RecordKeeper owns its Records unconditionally,
and could be unique_ptr-ified.

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

10 years agoTableGen: use auto and for-range
Dylan Noblesmith [Sun, 24 Aug 2014 19:10:49 +0000 (19:10 +0000)]
TableGen: use auto and for-range

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

10 years agoThis code is from r216285, which did not go out to the mailing list for some reason.
Aaron Ballman [Sun, 24 Aug 2014 13:25:16 +0000 (13:25 +0000)]
This code is from r216285, which did not go out to the mailing list for some reason.

The switch statement would never fire due to the preceding break statement. Also, the switch statement has a default label with no case labels. Simplified the code, and allow it to execute.

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

10 years agoX86 intrinsics table - simplifies intrinsics lowering.
Elena Demikhovsky [Sun, 24 Aug 2014 09:19:56 +0000 (09:19 +0000)]
X86 intrinsics table - simplifies intrinsics lowering.
The tables are initialized when X86TargetLowering object is created.

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

10 years agoSilence gcc -Wpedantic.
Patrik Hagglund [Sun, 24 Aug 2014 09:12:33 +0000 (09:12 +0000)]
Silence gcc -Wpedantic.

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

10 years agoInstCombine: Properly optimize or'ing bittests together
David Majnemer [Sun, 24 Aug 2014 09:10:57 +0000 (09:10 +0000)]
InstCombine: Properly optimize or'ing bittests together

CFE, with -03, would turn:
bool f(unsigned x) {
  bool a = x & 1;
  bool b = x & 2;
  return a | b;
}

into:
  %1 = lshr i32 %x, 1
  %2 = or i32 %1, %x
  %3 = and i32 %2, 1
  %4 = icmp ne i32 %3, 0

This sort of thing exposes a nasty pathology in GCC, ICC and LLVM.

Instead, we would rather want:
  %1 = and i32 %x, 3
  %2 = icmp ne i32 %1, 0

Things get a bit more interesting in the following case:
  %1 = lshr i32 %x, %y
  %2 = or i32 %1, %x
  %3 = and i32 %2, 1
  %4 = icmp ne i32 %3, 0

Replacing it with the following sequence is better:
  %1 = shl nuw i32 1, %y
  %2 = or i32 %1, 1
  %3 = and i32 %2, %x
  %4 = icmp ne i32 %3, 0

This sequence is preferable because %1 doesn't involve %x and could
potentially be hoisted out of loops if it is invariant; only perform
this transform in the non-constant case if we know we won't increase
register pressure.

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

10 years ago[PowerPC] Add support for dcbtst and icbt (prefetch)
Hal Finkel [Sat, 23 Aug 2014 23:21:04 +0000 (23:21 +0000)]
[PowerPC] Add support for dcbtst and icbt (prefetch)

Adds code generation support for dcbtst (data cache prefetch for write) and
icbt (instruction cache prefetch for read - Book E cores only).

We still end up with a 'cannot select' error for the non-supported prefetch
intrinsic forms. This will be fixed in a later commit.

Fixes PR20692.

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

10 years agoSupport: add llvm::unique_lock
Dylan Noblesmith [Sat, 23 Aug 2014 23:07:14 +0000 (23:07 +0000)]
Support: add llvm::unique_lock

Based on the STL class of the same name, it guards a mutex
while also allowing it to be unlocked conditionally before
destruction.

This eliminates the last naked usages of mutexes in LLVM and
clang.

It also uncovered and fixed a bug in callExternalFunction()
when compiled without USE_LIBFFI, where the mutex would never
be unlocked if the end of the function was reached.

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

10 years agoSupport: make LLVM Mutexes STL-compatible
Dylan Noblesmith [Sat, 23 Aug 2014 22:49:22 +0000 (22:49 +0000)]
Support: make LLVM Mutexes STL-compatible

Use lock/unlock() convention instead of acquire/release().

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

10 years agoSupport/Unix: use ScopedLock wherever possible
Dylan Noblesmith [Sat, 23 Aug 2014 22:49:17 +0000 (22:49 +0000)]
Support/Unix: use ScopedLock wherever possible

Only one function remains a bit too complicated
for a simple mutex guard. No functionality change.

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

10 years agocmake: actually test -Wcomment
Dylan Noblesmith [Sat, 23 Aug 2014 21:10:58 +0000 (21:10 +0000)]
cmake: actually test -Wcomment

This test was testing nothing, as only -Werror was ever
being added to the compiler flags.

You can see the final nitty-gritty compiler invocation in
CMakeFiles/CMakeOutput.log (for successful tests) and
CMakeFiles/CMakeError.log (for failed tests).

Before:
Building C object CMakeFiles/cmTryCompileExec3385359576.dir/src.c.o
/usr/bin/clang   -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default  -DC_WCOMMENT_ALLOWS_LINE_WRAP  -Werror   -o CMakeFiles/cmTryCompileExec3385359576.dir/src.c.o   -c /home/nobled/code/llvm-b9/CMakeFiles/CMakeTmp/src.c

After:
Building C object CMakeFiles/cmTryCompileExec3385359576.dir/src.c.o
/usr/bin/clang   -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default  -DC_WCOMMENT_ALLOWS_LINE_WRAP  -Werror -Wcomment   -o CMakeFiles/cmTryCompileExec3385359576.dir/src.c.o   -c /home/nobled/code/llvm-b9/CMakeFiles/CMakeTmp/src.c

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

10 years agocmake: disable -Wnon-virtual-dtor when it gives false positives
Dylan Noblesmith [Sat, 23 Aug 2014 21:10:56 +0000 (21:10 +0000)]
cmake: disable -Wnon-virtual-dtor when it gives false positives

clang has only been smart enough not to trigger -Wnon-virtual-dtor
warnings on final classes since r208449 (in clang 3.5). Building
with older versions is extremely noisy, so disable the warning
on those compilers.

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

10 years agoRevert "ARM: improve RTABI 4.2 conformance on Linux"
Chad Rosier [Sat, 23 Aug 2014 18:29:43 +0000 (18:29 +0000)]
Revert "ARM: improve RTABI 4.2 conformance on Linux"

This reverts commit r215862 due to nightly failures.  Will work on getting a
reduced test case, but I wanted to get our bots green in the meantime.

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

10 years agoRevert "ARM: mark missing functions from RTABI"
Chad Rosier [Sat, 23 Aug 2014 18:29:40 +0000 (18:29 +0000)]
Revert "ARM: mark missing functions from RTABI"

This reverts commit r215863.

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

10 years ago[x86] Start fixing a really subtle and terrible form of miscompile in
Chandler Carruth [Sat, 23 Aug 2014 10:25:15 +0000 (10:25 +0000)]
[x86] Start fixing a really subtle and terrible form of miscompile in
these DAG combines.

The DAG auto-CSE thing is truly terrible. Due to it, when RAUW-ing
a node with its operand, you can cause its uses to CSE to itself, which
then causes their uses to become your uses which causes them to be
picked up by the RAUW. For nodes that are determined to be "no-ops",
this is "fine". But if the RAUW is one of several steps to enact
a transformation, this causes the DAG to really silently eat an discard
nodes that you would never expect. It took days for me to actually
pinpoint a test case triggering this and a really frustrating amount of
time to even comprehend the bug because I never even thought about the
ability of RAUW to iteratively consume nodes due to CSE-ing them into
itself.

To fix this, we have to build up a brand-new chain of operations any
time we are combining across (potentially) intervening nodes. But once
the logic is added to do this, another issue surfaces: CombineTo eagerly
deletes the one node combined, *but no others*. This is... really
frustrating. If deleting it makes its operands become dead, those
operand nodes often won't go onto the worklist in the
order you would want -- they're already on it and not near the top. That
means things higher on the worklist will get combined prior to these
dead nodes being GCed out of the worklist, and if the chain is long, the
immediate users won't be enough to re-detect where the root of the chain
is that became single-use again after deleting the dead nodes. The
better way to do this is to never immediately delete nodes, and instead
to just enqueue them so we can recursively delete them. The
combined-from node is typically not on the worklist anyways by virtue of
having been popped off.... But that in turn breaks other tests that
*require* CombineTo to delete unused nodes. :: sigh ::

Fortunately, there is a better way. This whole routine should have been
returning the replacement rather than using CombineTo which is quite
hacky. Switch to that, and all the pieces fall together.

I suspect the same kind of miscompile is possible in the half-shuffle
folding code, and potentially the recursive folding code. I'll be
switching those over to a pattern more like this one for safety's sake
even though I don't immediately have any test cases for them. Note that
the only way I got a test case for this instance was with *heavily* DAG
combined 256-bit shuffle sequences generated by my fuzzer. ;]

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

10 years agoProgrammersManual: the flag is called -debug-only
Hans Wennborg [Sat, 23 Aug 2014 04:34:58 +0000 (04:34 +0000)]
ProgrammersManual: the flag is called -debug-only

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

10 years agollvm-cov: test: add xfail for the big-endian buildbots
Alex Lorenz [Sat, 23 Aug 2014 00:47:24 +0000 (00:47 +0000)]
llvm-cov: test: add xfail for the big-endian buildbots

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

10 years agoRevert r215611 because it caused the infinite loop in bug 20736. There is a reduced...
Nick Lewycky [Sat, 23 Aug 2014 00:45:03 +0000 (00:45 +0000)]
Revert r215611 because it caused the infinite loop in bug 20736. There is a reduced testcase in that bug.

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

10 years agoAdd a test case for SROA where the store size is bigger than slice size. The
Yunzhong Gao [Fri, 22 Aug 2014 23:27:04 +0000 (23:27 +0000)]
Add a test case for SROA where the store size is bigger than slice size. The
test case was fixed in r216248.

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