oota-llvm.git
9 years agoRelease tag script: add -dry-run flag
Hans Wennborg [Tue, 13 Jan 2015 00:07:22 +0000 (00:07 +0000)]
Release tag script: add -dry-run flag

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

9 years agoDebug Info: Move support for constants into DwarfExpression.
Adrian Prantl [Tue, 13 Jan 2015 00:04:06 +0000 (00:04 +0000)]
Debug Info: Move support for constants into DwarfExpression.
Move the declaration of DebugLocDwarfExpression into DwarfExpression.h
because it needs to be accessed from AsmPrinterDwarf.cpp and DwarfDebug.cpp

NFC.

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

9 years agoIR: Split out writeMDTuple(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 23:45:31 +0000 (23:45 +0000)]
IR: Split out writeMDTuple(), NFC

Prepare for more subclasses of `UniquableMDNode` than `MDTuple`.

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

9 years agoMake DwarfExpression store the AsmPrinter instead of the TargetMachine.
Adrian Prantl [Mon, 12 Jan 2015 23:36:56 +0000 (23:36 +0000)]
Make DwarfExpression store the AsmPrinter instead of the TargetMachine.
NFC.

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

9 years agoremove extra semicolon
Adrian Prantl [Mon, 12 Jan 2015 23:36:50 +0000 (23:36 +0000)]
remove extra semicolon

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

9 years agomusttail: Only set the inreg flag for fastcall and vectorcall
Reid Kleckner [Mon, 12 Jan 2015 23:28:23 +0000 (23:28 +0000)]
musttail: Only set the inreg flag for fastcall and vectorcall

Otherwise we'll attempt to forward ECX, EDX, and EAX for cdecl and
stdcall thunks, leaving us with no scratch registers for indirect call
targets.

Fixes PR22052.

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

9 years agoR600/SI: Remove redundant setting expand on f64 vectors
Matt Arsenault [Mon, 12 Jan 2015 23:13:00 +0000 (23:13 +0000)]
R600/SI: Remove redundant setting expand on f64 vectors

None of these are legal types already, so they default to
Expand.

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

9 years agoIR: Unbreak the MSVC build after r225689
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 23:09:14 +0000 (23:09 +0000)]
IR: Unbreak the MSVC build after r225689

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

9 years agoRun clang-format on the parts of AsmPrinterDwarf where it improves the
Adrian Prantl [Mon, 12 Jan 2015 23:03:23 +0000 (23:03 +0000)]
Run clang-format on the parts of AsmPrinterDwarf where it improves the
readability.

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

9 years agoDebug Info: Add a virtual destructor to DwarfExpression.
Adrian Prantl [Mon, 12 Jan 2015 22:59:28 +0000 (22:59 +0000)]
Debug Info: Add a virtual destructor to DwarfExpression.
Thanks Chandler for noticing!

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

9 years ago[PM] Sink the reference vs. value decision for IR units out of the
Chandler Carruth [Mon, 12 Jan 2015 22:53:31 +0000 (22:53 +0000)]
[PM] Sink the reference vs. value decision for IR units out of the
templated interface.

So far, every single IR unit I can come up with has address-identity.
That is, when two units of IR are both active in LLVM, their addresses
will be distinct of the IR is distinct. This is clearly true for
Modules, Functions, BasicBlocks, and Instructions. It turns out that the
only practical way to make the CGSCC stuff work the way we want is to
make it true for SCCs as well. I expect this pattern to continue.

When first designing the pass manager code, I kept this dimension of
freedom in the type parameters, essentially allowing for a wrapper-type
whose address did not form identity. But that really no longer makes
sense and is making the code more complex or subtle for no gain. If we
ever have an actual use case for this, we can figure out what makes
sense then and there. It will be better because then we will have the
actual example in hand.

While the simplifications afforded in this patch are fairly small
(mostly sinking the '&' out of many type parameters onto a few
interfaces), it would have become much more pronounced with subsequent
changes. I have a sequence of changes that will completely remove the
code duplication that currently exists between all of the pass managers
and analysis managers. =] Should make things much cleaner and avoid bug
fixing N times for the N pass managers.

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

9 years agoIR: Remove incorrect comment, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:53:18 +0000 (22:53 +0000)]
IR: Remove incorrect comment, NFC

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

9 years agoIR: Fix unit test memory leak reported by ASan
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:46:15 +0000 (22:46 +0000)]
IR: Fix unit test memory leak reported by ASan

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/603/steps/check-llvm%20asan/logs/stdio

Thanks Alexey for pointing me to this!

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

9 years agoUntwine this expression. Thanks to David for noticing!
Adrian Prantl [Mon, 12 Jan 2015 22:39:14 +0000 (22:39 +0000)]
Untwine this expression. Thanks to David for noticing!

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

9 years ago[X86][SSE] Minor regression fix for r225551
Simon Pilgrim [Mon, 12 Jan 2015 22:38:08 +0000 (22:38 +0000)]
[X86][SSE] Minor regression fix for r225551

r225551 vector byte shuffle optimization caused an assertion as fully zeroable vectors can be produced under certain circumstances. This fix drops the assert and returns a zero vector where the assert would have failed.

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

9 years agoDebug Info: Implement DwarfUnit::addRegisterOpPiece() using DwarfExpression.
Adrian Prantl [Mon, 12 Jan 2015 22:37:16 +0000 (22:37 +0000)]
Debug Info: Implement DwarfUnit::addRegisterOpPiece() using DwarfExpression.
NFC.

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

9 years agoBitcode: Range-based for, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:35:34 +0000 (22:35 +0000)]
Bitcode: Range-based for, NFC

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

9 years agoBitcode: Add abbreviation for METADATA_NAME
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:34:10 +0000 (22:34 +0000)]
Bitcode: Add abbreviation for METADATA_NAME

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

9 years agoBitcode: Range-based for, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:33:00 +0000 (22:33 +0000)]
Bitcode: Range-based for, NFC

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

9 years agoBitcode: Range-based for, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:31:35 +0000 (22:31 +0000)]
Bitcode: Range-based for, NFC

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

9 years agoBitcode: Simplify emission of METADATA_BLOCK
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:30:34 +0000 (22:30 +0000)]
Bitcode: Simplify emission of METADATA_BLOCK

Refactor logic so that we know up-front whether to open a block and
whether we need an MDString abbreviation.

This is almost NFC, but will start emitting `MDString` abbreviations
when the first record is not an `MDString`.

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

9 years agoAsmParser: Use subclass API instead of MDNode wrappers, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:27:39 +0000 (22:27 +0000)]
AsmParser: Use subclass API instead of MDNode wrappers, NFC

Use subclass API instead of the wrappers in `MDNode` in the assembly
parser.  This will make the code easier to follow once we have multiple
subclasses.

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

9 years agoAsmParser: Factor duplicated code into ParseMDNode(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:26:48 +0000 (22:26 +0000)]
AsmParser: Factor duplicated code into ParseMDNode(), NFC

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

9 years agoAsmParser: Reorder ParseMetadata() logic, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:24:50 +0000 (22:24 +0000)]
AsmParser: Reorder ParseMetadata() logic, NFC

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

9 years agoAsmParser: Simplify ParseMDTuple(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 22:23:04 +0000 (22:23 +0000)]
AsmParser: Simplify ParseMDTuple(), NFC

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

9 years agoDebug Info: Implement DwarfUnit::addRegisterOffset using DwarfExpression.
Adrian Prantl [Mon, 12 Jan 2015 22:19:26 +0000 (22:19 +0000)]
Debug Info: Implement DwarfUnit::addRegisterOffset using DwarfExpression.
No functional change.

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

9 years agoDebug info: Factor out the creation of DWARF expressions from AsmPrinter
Adrian Prantl [Mon, 12 Jan 2015 22:19:22 +0000 (22:19 +0000)]
Debug info: Factor out the creation of DWARF expressions from AsmPrinter
into a new class DwarfExpression that can be shared between AsmPrinter
and DwarfUnit.

This is the first step towards unifying the two entirely redundant
implementations of dwarf expression emission in DwarfUnit and AsmPrinter.

Almost no functional change — Testcases were updated because asm comments
that used to be on two lines now appear on the same line, which is
actually preferable.

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

9 years agoAsmParser: ParseMDNode() => ParseMDTuple(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 21:23:11 +0000 (21:23 +0000)]
AsmParser: ParseMDNode() => ParseMDTuple(), NFC

This isn't parsing arbitrary subclasses of `MDNode`, just `MDTuple`.

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

9 years ago80-cols; NFC
Sanjay Patel [Mon, 12 Jan 2015 21:21:28 +0000 (21:21 +0000)]
80-cols; NFC

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

9 years agoAsmParser: Remove unused version of ParseMDNodeID()
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 21:14:38 +0000 (21:14 +0000)]
AsmParser: Remove unused version of ParseMDNodeID()

Merge the two versions of `ParseMDNodeID()` now that no one needs
special forward references.

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

9 years agoAsmParser: Use normal references for metadata attachments, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 21:13:09 +0000 (21:13 +0000)]
AsmParser: Use normal references for metadata attachments, NFC

Remove special parsing logic for metadata attachments.  Now that
`DebugLoc` is stored normally (since the metadata/value split), we don't
need this special forward referencing logic.

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

9 years agoIR: Prepare for a new UniquableMDNode subclass, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:56:33 +0000 (20:56 +0000)]
IR: Prepare for a new UniquableMDNode subclass, NFC

Add generic dispatch for the parts of `UniquableMDNode` that cast to
`MDTuple`.  This makes adding other subclasses (like PR21433's
`MDLocation`) easier.

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

9 years agoIR: Stop erasing MDNodes from uniquing sets during teardown
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:50:25 +0000 (20:50 +0000)]
IR: Stop erasing MDNodes from uniquing sets during teardown

Stop erasing `MDNode`s from the uniquing sets in `LLVMContextImpl`
during teardown (in particular, during
`UniquableMDNode::~UniquableMDNode()`).  Although it's currently
feasible, there isn't any clear benefit and it may not be feasible for
other subclasses (which don't explicitly store the lookup hash).

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

9 years agoFirst crack at PowerPC 3.6 release notes
Bill Schmidt [Mon, 12 Jan 2015 20:46:43 +0000 (20:46 +0000)]
First crack at PowerPC 3.6 release notes

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

9 years ago[LIT] Remove string decoding in gtest discovery code. lit.util.capture now does decoding.
Eric Fiselier [Mon, 12 Jan 2015 20:43:34 +0000 (20:43 +0000)]
[LIT] Remove string decoding in gtest discovery code. lit.util.capture now does decoding.

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

9 years ago[X86] Also create+widen FMIN/FMAX nodes for v2f32.
Ahmed Bougacha [Mon, 12 Jan 2015 20:31:30 +0000 (20:31 +0000)]
[X86] Also create+widen FMIN/FMAX nodes for v2f32.

This happens in the HINT benchmark, where the SLP-vectorizer created
v2f32 fcmp/select code.  The "correct" solution would have been to
teach the vectorizer cost model that v2f32 isn't legal (because really,
it isn't), but if we can vectorize we might as well do so.

We legalize these v2f32 FMIN/FMAX nodes by widening to v4f32 later on.
v3f32 were already widened to v4f32 by the generic unroll-and-build-vector
legalization.

rdar://15763436
Differential Revision: http://reviews.llvm.org/D6557

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

9 years agoIR: Move creation logic to MDNodeFwdDecl, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:21:37 +0000 (20:21 +0000)]
IR: Move creation logic to MDNodeFwdDecl, NFC

Same as with `MDTuple`, factor out a `friend MDNode` by moving creation
logic to the concrete subclass.

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

9 years agoIR: Make MDNodeFwdDecl destructor public
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:19:54 +0000 (20:19 +0000)]
IR: Make MDNodeFwdDecl destructor public

Now that the leak detector is gone, anyone can call this.

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

9 years ago[X86] Make SSE min/max testcases more explicit. NFC.
Ahmed Bougacha [Mon, 12 Jan 2015 20:15:47 +0000 (20:15 +0000)]
[X86] Make SSE min/max testcases more explicit. NFC.

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

9 years agoIR: Move creation logic down to MDTuple, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:13:56 +0000 (20:13 +0000)]
IR: Move creation logic down to MDTuple, NFC

Move creation logic for `MDTuple`s down where it belongs.  Once there
are a few more subclasses, these functions really won't make much sense
here (the `friend` relationship was already awkward).  For now, leave
the `MDNode` versions around, but have it forward down.

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

9 years agoIR: Push storeDistinctInContext() down to UniquableMDNode, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:11:32 +0000 (20:11 +0000)]
IR: Push storeDistinctInContext() down to UniquableMDNode, NFC

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

9 years agoIR: Split GenericMDNode into MDTuple and UniquableMDNode
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 20:09:34 +0000 (20:09 +0000)]
IR: Split GenericMDNode into MDTuple and UniquableMDNode

Split `GenericMDNode` into two classes (with more descriptive names).

  - `UniquableMDNode` will be a common subclass for `MDNode`s that are
    sometimes uniqued like constants, and sometimes 'distinct'.

    This class gets the (short-lived) RAUW support and related API.

  - `MDTuple` is the basic tuple that has always been returned by
    `MDNode::get()`.  This is as opposed to more specific nodes to be
    added soon, which have additional fields, custom assembly syntax,
    and extra semantics.

    This class gets the hash-related logic, since other sublcasses of
    `UniquableMDNode` may need to hash based on other fields.

To keep this diff from getting too big, I've added casts to `MDTuple`
that won't really scale as new subclasses of `UniquableMDNode` are
added, but I'll clean those up incrementally.

(No functionality change intended.)

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

9 years ago[LIT] Decode string result in lit.util.capture
Eric Fiselier [Mon, 12 Jan 2015 20:09:34 +0000 (20:09 +0000)]
[LIT] Decode string result in lit.util.capture

Summary: I think this is probably a bug, but I'm putting this up for review just to be sure. I think that `lit.util.capture` should decode the resulting string in the same way `lit.util.executeCommand` does.

Reviewers: ddunbar, EricWF

Reviewed By: EricWF

Subscribers: llvm-commits

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

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

9 years agoIR: Invert logic to simplify control flow, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:45:44 +0000 (19:45 +0000)]
IR: Invert logic to simplify control flow, NFC

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

9 years agoIR: Separate out decrementUnresolvedOperandCount(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:43:15 +0000 (19:43 +0000)]
IR: Separate out decrementUnresolvedOperandCount(), NFC

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

9 years agoIR: Prevent handleChangedOperand() recursion
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:36:35 +0000 (19:36 +0000)]
IR: Prevent handleChangedOperand() recursion

Instead of returning early on `handleChangedOperand()` recursion
(finally identified (and test added) in r225657), prevent it upfront by
releasing operands before RAUW.

Aside from massively different program flow, there should be no
functionality change ;).

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

9 years agoR600/SI: Use RegisterOperands to specify which operands can accept immediates
Tom Stellard [Mon, 12 Jan 2015 19:33:18 +0000 (19:33 +0000)]
R600/SI: Use RegisterOperands to specify which operands can accept immediates

There are some operands which can take either immediates or registers
and we were previously using different register class to distinguish
between operands that could take immediates and those that could not.

This patch switches to using RegisterOperands which should simplify the
backend by reducing the number of register classes and also make it
easier to implement the assembler.

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

9 years agoTarget: Allow target specific operand types
Tom Stellard [Mon, 12 Jan 2015 19:33:09 +0000 (19:33 +0000)]
Target: Allow target specific operand types

This adds two new fields to the RegisterOperand TableGen class:

string OperandNamespace = "MCOI";
string OperandType = "OPERAND_REGISTER";

These fields can be used to specify a target specific operand type,
which will be stored in the OperandType member of the MCOperandInfo
object.

This can be useful for targets that need to store some extra information
about operands that cannot be expressed using the target independent
types.  For example, in the R600 backend, there are operands which
can take either registers or immediates and it is convenient to be able
to specify this in the TableGen definitions.

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

9 years agoGVN: propagate equalities for floating point compares
Sanjay Patel [Mon, 12 Jan 2015 19:29:48 +0000 (19:29 +0000)]
GVN: propagate equalities for floating point compares

Allow optimizations based on FP comparison values in the same way
as integers.

This resolves PR17713:
http://llvm.org/bugs/show_bug.cgi?id=17713

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

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

9 years agoIR: Add test for handleChangedOperand() recursion
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:22:04 +0000 (19:22 +0000)]
IR: Add test for handleChangedOperand() recursion

Turns out this can happen.  Remove the `FIXME` and add a testcase that
crashes without the extra logic.

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

9 years agoIR: Separate out recalculateHash(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:16:34 +0000 (19:16 +0000)]
IR: Separate out recalculateHash(), NFC

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

9 years agoIR: Separate out helper: resolveAfterOperandChange(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:14:15 +0000 (19:14 +0000)]
IR: Separate out helper: resolveAfterOperandChange(), NFC

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

9 years agoIR: Use SubclassData32 directly, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 19:12:37 +0000 (19:12 +0000)]
IR: Use SubclassData32 directly, NFC

Simplify some logic by accessing `SubclassData32` directly instead of
relying on API.

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

9 years agoRegisterCoalescer: Turn some impossible conditions into asserts
Matthias Braun [Mon, 12 Jan 2015 19:10:17 +0000 (19:10 +0000)]
RegisterCoalescer: Turn some impossible conditions into asserts

This is a fixed version of reverted r225500. It fixes the too early
if() continue; of the last patch and adds a comment to the unorthodox
loop.

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

9 years agoIR: Don't allow operands to become unresolved
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 18:59:40 +0000 (18:59 +0000)]
IR: Don't allow operands to become unresolved

Operands shouldn't change from being resolved to unresolved during graph
construction.  Simplify the logic based on that assumption.

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

9 years agoIR: Remove redundant comment, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 18:45:32 +0000 (18:45 +0000)]
IR: Remove redundant comment, NFC

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

9 years agoIR: Simplify code, NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 18:45:01 +0000 (18:45 +0000)]
IR: Simplify code, NFC

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

9 years agoIR: Make temporary nodes distinct
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 18:41:26 +0000 (18:41 +0000)]
IR: Make temporary nodes distinct

Change the return of `MDNode::isDistinct()` for `MDNode::getTemporary()`
to `true`.  They aren't uniqued.

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

9 years agoAdd r224985 back with two fixes.
Rafael Espindola [Mon, 12 Jan 2015 18:13:07 +0000 (18:13 +0000)]
Add r224985 back with two fixes.

One is that AArch64 has additional restrictions on when local relocations can
be used. We have to take those into consideration when deciding to put a L
symbol in the symbol table or not.

The other is that ld64 requires the relocations to cstring to use linker
visible symbols on AArch64.

Thanks to Michael Zolotukhin for testing this!

Remove doesSectionRequireSymbols.

In an assembly expression like

bar:
.long L0 + 1

the intended semantics is that bar will contain a pointer one byte past L0.

In sections that are merged by content (strings, 4 byte constants, etc), a
single position in the section doesn't give the linker enough information.
For example, it would not be able to tell a relocation must point to the
end of a string, since that would look just like the start of the next.

The solution used in ELF to use relocation with symbols if there is a non-zero
addend.

In MachO before this patch we would just keep all symbols in some sections.

This would miss some cases (only cstrings on x86_64 were implemented) and was
inefficient since most relocations have an addend of 0 and can be represented
without the symbol.

This patch implements the non-zero addend logic for MachO too.

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

9 years agoIR: Simplify replaceOperandWith(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 18:01:45 +0000 (18:01 +0000)]
IR: Simplify replaceOperandWith(), NFC

This will call `handleChangedOperand()` less frequently, but in that
case (i.e., `isStoredDistinctInContext()`) it has identical logic to
here.

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

9 years agoIR: Remove redundant calls to MDNode::setHash(), NFC
Duncan P. N. Exon Smith [Mon, 12 Jan 2015 17:57:38 +0000 (17:57 +0000)]
IR: Remove redundant calls to MDNode::setHash(), NFC

`storeDistinctInContext()` already calls `setHash(0)`.

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

9 years ago[ASan] Move the shadow on Windows 32-bit from 0x20000000 to 0x40000000
Timur Iskhodzhanov [Mon, 12 Jan 2015 17:38:58 +0000 (17:38 +0000)]
[ASan] Move the shadow on Windows 32-bit from 0x20000000 to 0x40000000

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

9 years ago[SimplifyLibCalls] Factor out fortified libcall handling.
Ahmed Bougacha [Mon, 12 Jan 2015 17:22:43 +0000 (17:22 +0000)]
[SimplifyLibCalls] Factor out fortified libcall handling.

This lets us remove CGP duplicate.

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

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

9 years ago[SimplifyLibCalls] Factor out str/mem libcall optimizations.
Ahmed Bougacha [Mon, 12 Jan 2015 17:20:06 +0000 (17:20 +0000)]
[SimplifyLibCalls] Factor out str/mem libcall optimizations.

Put them in a separate function, so we can reuse them to further
simplify fortified libcalls as well.

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

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

9 years ago[SimplifyLibCalls] Factor out signature checks for fortifiable libcalls.
Ahmed Bougacha [Mon, 12 Jan 2015 17:18:19 +0000 (17:18 +0000)]
[SimplifyLibCalls] Factor out signature checks for fortifiable libcalls.

The checks are the same for fortified counterparts to the libcalls, so
we might as well do them in a single place.

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

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

9 years ago[mips][microMIPS] Implement BEQZ16 and BNEZ16 instructions
Jozef Kolek [Mon, 12 Jan 2015 12:03:34 +0000 (12:03 +0000)]
[mips][microMIPS] Implement BEQZ16 and BNEZ16 instructions

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

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

9 years agoPut this test's input in the Inputs directory where it belongs, rather than
Richard Smith [Mon, 12 Jan 2015 08:50:47 +0000 (08:50 +0000)]
Put this test's input in the Inputs directory where it belongs, rather than
reusing a file from a different test directory.

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

9 years agoAdd a new utility script that helps update very simple regression tests.
Chandler Carruth [Mon, 12 Jan 2015 04:43:18 +0000 (04:43 +0000)]
Add a new utility script that helps update very simple regression tests.

This script is currently specific to x86 and limited to use with very
small regression or feature tests using 'llc' and 'FileCheck' in
a reasonably canonical way. It is in no way general purpose or robust at
this point. However, it works quite well for simple examples. Here is
the intended workflow:

- Make a change that requires updating N test files and M functions'
  assertions within those files.
- Stash the change.
- Update those N test files' RUN-lines to look "canonical"[1].
- Refresh the FileCheck lines for either the entire file or select
  functions by running this script.
  - The script will parse the RUN lines and run the 'llc' binary you
    give it according to each line, collecting the asm.
  - It will then annotate each function with the appropriate FileCheck
    comments to check every instruction from the start of the first
    basic block to the last return.
  - There will be numerous cases where the script either fails to remove
    the old lines, or inserts checks which need to be manually editted,
    but the manual edits tend to be deletions or replacements of
    registers with FileCheck variables which are fast manual edits.
  - A common pattern is to have the script insert complete checking of
    every instruction, and then edit it down to only check the relevant
    ones.
  - Be careful to do all of these cleanups though! The script is
    designed to make transferring and formatting the asm output of llc
    into a test case fast, it is *not* designed to be authoratitive
    about what constitutes a good test!
- Commit the nice fresh baseline of checks.
- Unstash your change and rebuild llc.
- Re-run script to regenerate the FileCheck annotations
  - Remember to re-cleanup these annotations!!!
- Check the diff to make sure this is sane, checking the things you
  expected it to, and check that the newly updated tests actually pass.
- Profit!

Also, I'm *terrible* at writing Python, and frankly I didn't spend a lot
of time making this script beautiful or well engineered. But it's useful
to me and may be useful to others so I thought I'd send it out.

http://reviews.llvm.org/D5546

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

9 years ago[PowerPC] Fix calls to non-function objects
Hal Finkel [Mon, 12 Jan 2015 04:34:47 +0000 (04:34 +0000)]
[PowerPC] Fix calls to non-function objects

Looking at r225438 inspired me to see how the PowerPC backend handled the
situation (calling a bitcasted TLS global), and it turns out we also produced
an error (cannot select ...). What it means to "call" something that is not a
function is implementation and platform specific, but in the name of doing
something (besides crashing), this makes sure we do what GCC does (treat all
such calls as calls through a function pointer -- meaning that the pointer is
assumed, as is the convention on PPC, to point to a function descriptor
structure holding the actual code address along with the function's TOC pointer
and environment pointer). As GCC does, we now do the same for calling regular
(non-TLS) non-function globals too.

I'm not sure whether this is the most useful way to define the behavior, but at
least we won't be alone.

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

9 years ago[X86][SSE] Minor fix to VPBLENDW AVX2 commutation.
Simon Pilgrim [Sun, 11 Jan 2015 22:08:01 +0000 (22:08 +0000)]
[X86][SSE] Minor fix to VPBLENDW AVX2 commutation.

D6015 / rL221313 enabled commutation for SSE immediate blend instructions, but due to a typo the AVX2 VPBLENDW ymm instructions weren't flagged as commutative along with the others in the tables, but were still being commuted in code and tested for.

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

9 years agoFix silly mistake in release notes for Mips.
Daniel Sanders [Sun, 11 Jan 2015 10:48:20 +0000 (10:48 +0000)]
Fix silly mistake in release notes for Mips.

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

9 years agoAdded release notes for the Mips target.
Daniel Sanders [Sun, 11 Jan 2015 10:34:52 +0000 (10:34 +0000)]
Added release notes for the Mips target.

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

9 years agoRevert most of r225597
David Majnemer [Sun, 11 Jan 2015 07:29:51 +0000 (07:29 +0000)]
Revert most of r225597

We can't rely on a DataLayout enlightened constant folder.

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

9 years agoX86: Properly decode shuffle masks when the constant pool type is weird
David Majnemer [Sun, 11 Jan 2015 05:08:57 +0000 (05:08 +0000)]
X86: Properly decode shuffle masks when the constant pool type is weird

It's possible for the constant pool entry for the shuffle mask to come
from a completely different operation.  This occurs when Constants have
the same bit pattern but have different types.

Make DecodePSHUFBMask tolerant of types which, after a bitcast, are
appropriately sized vector types.

This fixes PR22188.

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

9 years agoX86: teach X86TargetLowering about L,M,O constraints
Saleem Abdulrasool [Sun, 11 Jan 2015 04:39:24 +0000 (04:39 +0000)]
X86: teach X86TargetLowering about L,M,O constraints

Teach the ISelLowering for X86 about the L,M,O target specific constraints.
Although, for the moment, clang performs constraint validation and prevents
passing along inline asm which may have immediate constant constraints violated,
the backend should be able to cope with the invalid inline asm a bit better.

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

9 years agoARM: add support for segment base relocations (SBREL)
Saleem Abdulrasool [Sun, 11 Jan 2015 04:39:18 +0000 (04:39 +0000)]
ARM: add support for segment base relocations (SBREL)

This adds support for parsing and emitting the SBREL relocation variant for the
ARM target.  Handling this relocation variant is necessary for supporting the
full ARM ELF specification.  Addresses PR22128.

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

9 years ago[x86] Remove some windows line endings that snuck into the tests here.
Chandler Carruth [Sun, 11 Jan 2015 01:36:20 +0000 (01:36 +0000)]
[x86] Remove some windows line endings that snuck into the tests here.

Folks on Windows, remember to set up your subversion to strip these when
submitting...

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

9 years ago[ADT] Remove the unused default constructor for iterator_range.
Chandler Carruth [Sun, 11 Jan 2015 01:16:26 +0000 (01:16 +0000)]
[ADT] Remove the unused default constructor for iterator_range.

This default constructor is a bit weird. It left the range in an invalid
state. That might be reasonable so that you can construct a local
iterator range and assign to it based on some logic to compute the range
you want. If folks would like to support that use case, I can add it
back, but in 238-odd usages none have actually wanted to do this. ;]

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

9 years agoFix PR22179.
Sanjoy Das [Sat, 10 Jan 2015 23:41:24 +0000 (23:41 +0000)]
Fix PR22179.

We were incorrectly inferring nsw for certain SCEVs. We can be more
aggressive here (see Richard Smith's comment on
http://llvm.org/bugs/show_bug.cgi?id=22179) but this change just
focuses on correctness.

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

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

9 years agoRevert r225500, it leads to infinite loops.
Joerg Sonnenberger [Sat, 10 Jan 2015 21:49:36 +0000 (21:49 +0000)]
Revert r225500, it leads to infinite loops.

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

9 years ago[X86][SSE] Improved (v)insertps shuffle matching
Simon Pilgrim [Sat, 10 Jan 2015 19:45:33 +0000 (19:45 +0000)]
[X86][SSE] Improved (v)insertps shuffle matching

In the current code we only attempt to match against insertps if we have exactly one element from the second input vector, irrespective of how much of the shuffle result is zeroable.

This patch checks to see if there is a single non-zeroable element from either input that requires insertion. It also supports matching of cases where only one of the inputs need to be referenced.

We also split insertps shuffle matching off into a new lowerVectorShuffleAsInsertPS function.

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

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

9 years ago.gitignore: add some rules for tagging programs
Ramkumar Ramachandra [Sat, 10 Jan 2015 19:11:29 +0000 (19:11 +0000)]
.gitignore: add some rules for tagging programs

Often, we miss committing new files, and 'arc diff' is supposed to warn
us about this. Unfortunately, because of the spurious output of the
command (due to unignored untracked files), we tend to ignore it and
lose information.

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

9 years ago[PowerPC] Mark zext of a small scalar load as free
Hal Finkel [Sat, 10 Jan 2015 08:21:59 +0000 (08:21 +0000)]
[PowerPC] Mark zext of a small scalar load as free

This initial implementation of PPCTargetLowering::isZExtFree marks as free
zexts of small scalar loads (that are not sign-extending). This callback is
used by SelectionDAGBuilder's RegsForValue::getCopyToRegs, and thus to
determine whether a zext or an anyext is used to lower illegally-typed PHIs.
Because later truncates of zero-extended values are nops, this allows for the
elimination of later unnecessary truncations.

Fixes the initial complaint associated with PR22120.

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

9 years agoRemove some whitespace.
Justin Hibbits [Sat, 10 Jan 2015 07:50:31 +0000 (07:50 +0000)]
Remove some whitespace.

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

9 years agoConvertUTFTest: fix misleading empty line
Dmitri Gribenko [Sat, 10 Jan 2015 05:03:29 +0000 (05:03 +0000)]
ConvertUTFTest: fix misleading empty line

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

9 years agotests: fix previous commit
Saleem Abdulrasool [Sat, 10 Jan 2015 02:53:25 +0000 (02:53 +0000)]
tests: fix previous commit

The previous commit accidentally missed changes to the test output checking,
resulting in an errant failure.

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

9 years agotest: merge ARM relocations test
Saleem Abdulrasool [Sat, 10 Jan 2015 02:48:29 +0000 (02:48 +0000)]
test: merge ARM relocations test

There is a fair number of relocations that are part of the AAELF specification.
Simply merge the tests into a single test file, otherwise, we will end up with
far too many test files to test each relocation type.  NFC.

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

9 years agotests: convert a couple of ARM relocation tests to readobj
Saleem Abdulrasool [Sat, 10 Jan 2015 02:48:25 +0000 (02:48 +0000)]
tests: convert a couple of ARM relocation tests to readobj

These tests are checking the relocation generation.  Use the readobj output as
it is much easier to follow when glancing over the tests.

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

9 years agoFully fix Bug #22115.
Justin Hibbits [Sat, 10 Jan 2015 01:57:21 +0000 (01:57 +0000)]
Fully fix Bug #22115.

Summary:
In the previous commit, the register was saved, but space was not allocated.
This resulted in the parameter save area potentially clobbering r30, leading to
nasty results.

Test Plan: Tests updated

Reviewers: hfinkel

Subscribers: llvm-commits

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

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

9 years agoFix undefined behavior (shift of negative value) in RuntimeDyldMachOAArch64::encodeAd...
Alexey Samsonov [Sat, 10 Jan 2015 00:46:38 +0000 (00:46 +0000)]
Fix undefined behavior (shift of negative value) in RuntimeDyldMachOAArch64::encodeAddend.

Test Plan: regression test suite with/without UBSan.

Reviewers: lhames, ributzka

Subscribers: aemerson, llvm-commits

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

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

9 years ago[PowerPC] Readjust the loop unrolling threshold
Hal Finkel [Sat, 10 Jan 2015 00:31:10 +0000 (00:31 +0000)]
[PowerPC] Readjust the loop unrolling threshold

Now that the way that the partial unrolling threshold for small loops is used
to compute the unrolling factor as been corrected, a slightly smaller threshold
is preferable. This is expected; other targets may need to re-tune as well.

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

9 years ago[LoopUnroll] Fix the partial unrolling threshold for small loop sizes
Hal Finkel [Sat, 10 Jan 2015 00:30:55 +0000 (00:30 +0000)]
[LoopUnroll] Fix the partial unrolling threshold for small loop sizes

When we compute the size of a loop, we include the branch on the backedge and
the comparison feeding the conditional branch. Under normal circumstances,
these don't get replicated with the rest of the loop body when we unroll. This
led to the somewhat surprising behavior that really small loops would not get
unrolled enough -- they could be unrolled more and the resulting loop would be
below the threshold, because we were assuming they'd take
(LoopSize * UnrollingFactor) instructions after unrolling, instead of
(((LoopSize-2) * UnrollingFactor)+2) instructions. This fixes that computation.

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

9 years agoUse the DiagnosticHandler to print diagnostics when reading bitcode.
Rafael Espindola [Sat, 10 Jan 2015 00:07:30 +0000 (00:07 +0000)]
Use the DiagnosticHandler to print diagnostics when reading bitcode.

The bitcode reading interface used std::error_code to report an error to the
callers and it is the callers job to print diagnostics.

This is not ideal for error handling or diagnostic reporting:

* For error handling, all that the callers care about is 3 possibilities:
  * It worked
  * The bitcode file is corrupted/invalid.
  * The file is not bitcode at all.

* For diagnostic, it is user friendly to include far more information
  about the invalid case so the user can find out what is wrong with the
  bitcode file. This comes up, for example, when a developer introduces a
  bug while extending the format.

The compromise we had was to have a lot of error codes.

With this patch we use the DiagnosticHandler to communicate with the
human and std::error_code to communicate with the caller.

This allows us to have far fewer error codes and adds the infrastructure to
print better diagnostics. This is so because the diagnostics are printed when
he issue is found. The code that detected the problem in alive in the stack and
can pass down as much context as needed. As an example the patch updates
test/Bitcode/invalid.ll.

Using a DiagnosticHandler also moves the fatal/non-fatal error decision to the
caller. A simple one like llvm-dis can just use fatal errors. The gold plugin
needs a bit more complex treatment because of being passed non-bitcode files. An
hypothetical interactive tool would make all bitcode errors non-fatal.

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

9 years agoFix UBSan error reports in ValueMapCallbackVH and AssertingVH<T> empty/tombstone...
Alexey Samsonov [Fri, 9 Jan 2015 23:17:25 +0000 (23:17 +0000)]
Fix UBSan error reports in ValueMapCallbackVH and AssertingVH<T> empty/tombstone keys generation.

Summary:
One more attempt to fix UBSan reports: make sure DenseMapInfo::getEmptyKey()
and DenseMapInfo::getTombstoneKey() doesn't do any upcasts/downcasts to/from Value*.

Test Plan: check-llvm test suite with/without UBSan bootstrap

Reviewers: chandlerc, dexonsmith

Subscribers: llvm-commits, majnemer

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

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

9 years agoDisable Go bindings test under UBSan.
Alexey Samsonov [Fri, 9 Jan 2015 23:17:23 +0000 (23:17 +0000)]
Disable Go bindings test under UBSan.

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

9 years agoFix the JIT event listeners and replace the associated tests.
Andrew Kaylor [Fri, 9 Jan 2015 22:53:24 +0000 (22:53 +0000)]
Fix the JIT event listeners and replace the associated tests.

The changes to EventListenerCommon.h were contributed by Arch Robison.

This fixes bug 22095.

http://reviews.llvm.org/D6905

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

9 years agoUpdate comment.
Michael Zolotukhin [Fri, 9 Jan 2015 22:15:06 +0000 (22:15 +0000)]
Update comment.

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

9 years agoSimplifyCFG: check uses of constant-foldable instrs in switch destinations (PR20210)
Hans Wennborg [Fri, 9 Jan 2015 22:13:31 +0000 (22:13 +0000)]
SimplifyCFG: check uses of constant-foldable instrs in switch destinations (PR20210)

The previous code assumed that such instructions could not have any uses
outside CaseDest, with the motivation that the instruction could not
dominate CommonDest because CommonDest has phi nodes in it. That simply
isn't true; e.g., CommonDest could have an edge back to itself.

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

9 years ago[X86][SSE] Avoid vector byte shuffles with zero by using pshufb to create zeros
Simon Pilgrim [Fri, 9 Jan 2015 22:03:19 +0000 (22:03 +0000)]
[X86][SSE] Avoid vector byte shuffles with zero by using pshufb to create zeros

pshufb can shuffle in zero bytes as well as bytes from a source vector - we can use this to avoid having to shuffle 2 vectors and ORing the result when the used inputs from a vector are all zeroable.

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

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

9 years agoFix an ASAN failure introduced with r225537 (adding the -universal-headers to llvm...
Kevin Enderby [Fri, 9 Jan 2015 21:55:03 +0000 (21:55 +0000)]
Fix an ASAN failure introduced with r225537 (adding the -universal-headers to llvm-obdump).
And a fly by fix to some formatting issues with the same commit.

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