Commit Graph

75875 Commits

Author SHA1 Message Date
Chandler Carruth
8c3a02f8fe [PM] Port domtree to the new pass manager (at last).
This adds the domtree analysis to the new pass manager. The analysis
returns the same DominatorTree result entity used by the old pass
manager and essentially all of the code is shared. We just have
different boilerplate for running and printing the analysis.

I've converted one test to run in both modes just to make sure this is
exercised while both are live in the tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225969 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 10:19:28 +00:00
Kai Nacke
92e28620d3 [mips] Refine octeon instructions seq/seqi/sne/snei
This commit refines the pattern for the octeon seq/seqi/sne/snei instructions.
The target register is set to 0 or 1 according to the result of the comparison.
In C, this is something like

rd = (unsigned long)(rs == rt)

This commit adds a zext to bring the result to i64. With this change the
instruction is selected for this type of code. (gcc produces the same code for
the above C code.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225968 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 10:19:09 +00:00
Brad Smith
f449c53c89 Use the integrated assembler by default on SPARC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225957 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 07:53:39 +00:00
David Majnemer
3eafccc036 Use the operand vector instead so inline assembly can be validated too
The buildbots got upset after r225941, this should hopefully fix things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225954 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 06:14:36 +00:00
Mehdi Amini
df6c8efd9d SelectionDAG: add a -filter-view-dags option to llc
This option takes the name of the basic block you want to visualize
with -view-*-dags

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225953 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 06:03:18 +00:00
Mehdi Amini
cfe92407cd DAG Combiner: Fold SelectCC When Cond is UNDEF
In case folding a node end up with a NaN as operand for the select, 
the folding of the condition of the selectcc node returns "UNDEF".

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225952 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:45:24 +00:00
Mehdi Amini
125de50e12 Add assertions for out of bound index in ComputeLinearIndex
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225951 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:38:48 +00:00
Saleem Abdulrasool
e1f65e239a X86: only access operands if they are present
If there is no associated immediate (MS style inline asm), do not try to access
the operand, assume that it is valid.  This should fix the buildbots after SVN
r225941.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225950 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:37:10 +00:00
Mehdi Amini
497b958447 Fold a loop for array processing in ComputeLinearIndex
When processing an array, every Elt has the same layout, it is
useless to recursively call each ComputeLinearIndex on each element.
Just do it once and multiply by the number of elements.
    
Differential Revision: http://reviews.llvm.org/D6832




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225949 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:33:01 +00:00
JF Bastien
7f0cbb5703 Revert "Insert random noops to increase security against ROP attacks (llvm)"
This reverts commit:
http://reviews.llvm.org/D3392

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225948 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:24:33 +00:00
Duncan P. N. Exon Smith
1f6209189c NVPTX: Use MapMetadata() instead of custom/stale/untested logic
Copy the `GVMap` over to a standard `ValueToValueMapTy` so that we can
reuse the `MapMetadata()` logic.  Unfortunately the `GVMap` can't just
be replaced, since `MapMetadata()` likes to modify the map, but at least
this will prevent NVPTX from bitrotting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:14:30 +00:00
Duncan P. N. Exon Smith
1dcdcc0077 NVPTX: Remove bogus remap logic for global variable address spaces
The comment is incorrect, and the code mangles debug info.  Remove the
bad logic, which wasn't tested anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225943 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:13:18 +00:00
Saleem Abdulrasool
1679d0d3c2 X86: validate 'int' instruction
The int instruction takes as an operand an 8-bit immediate value.  Validate that
the input is valid rather than silently truncating the value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225941 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 05:10:21 +00:00
Hao Liu
e928b4046a Fix a wrong comment in LoopVectorize.
I.E. more than two -> exactly two
Fix a typo function name in LoopVectorize.
  I.E. collectStrideAcccess() -> collectStrideAccess()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225935 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 03:02:16 +00:00
Duncan P. N. Exon Smith
a8f0d2f673 Remove trailing slash from r225924
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225929 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:42:43 +00:00
Matt Arsenault
781f7ee502 R600/SI: Fix bad code with unaligned byte vector loads
Don't do the v4i8 -> v4f32 combine if the load will need to
be expanded due to alignment. This stops adding instructions
to repack into a single register that the v_cvt_ubyteN_f32
instructions read.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225926 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:35:22 +00:00
Matt Arsenault
8b6a26ca85 Implement new way of expanding extloads.
Now that the source and destination types can be specified,
allow doing an expansion that doesn't use an EXTLOAD of the
result type. Try to do a legal extload to an intermediate type
and extend that if possible.

This generalizes the special case custom lowering of extloads
R600 has been using to work around this problem.

This also happens to fix a bug that would incorrectly use more
aligned loads than should be used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225925 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:35:17 +00:00
Duncan P. N. Exon Smith
4d430f0b77 Utils: Remove unreachable break, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225924 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:31:34 +00:00
Duncan P. N. Exon Smith
68ee48f92e Utils: Handle remapping distinct MDLocations
Part of PR21433.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225921 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:29:32 +00:00
Duncan P. N. Exon Smith
ffa1a450c3 Utils: Thread distinct-ness through the cloneMD*() functions, NFC
The new logic isn't actually reachable yet, so no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225918 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:24:38 +00:00
Duncan P. N. Exon Smith
df7a3b3789 Utils: Extract cloneMDNode(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225917 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:22:47 +00:00
Duncan P. N. Exon Smith
9b68f1ce3b Utils: Move cloneMD*() up, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225915 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:21:24 +00:00
Duncan P. N. Exon Smith
74195b2df3 Utils: Add mapping for uniqued MDLocations
Still doesn't handle distinct ones.  Part of PR21433.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225914 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:20:27 +00:00
Tom Stellard
aafca11ff9 R600/SI: Define a schedule model
The machine scheduler is still disabled by default.

The schedule model is not complete yet, and could be improved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225913 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:13:19 +00:00
Duncan P. N. Exon Smith
6f73d6fd4c Utils: Extract cloneMDTuple(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225912 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:12:14 +00:00
Duncan P. N. Exon Smith
cc1ea9cb4d Utils: Extract shouldRemapUniquedNode(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225911 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:08:47 +00:00
Hal Finkel
ade705c6e5 Revert "r225811 - Revert "r225808 - [PowerPC] Add StackMap/PatchPoint support""
This re-applies r225808, fixed to avoid problems with SDAG dependencies along
with the preceding fix to ScheduleDAGSDNodes::RegDefIter::InitNodeNumDefs.
These problems caused the original regression tests to assert/segfault on many
(but not all) systems.

Original commit message:

This commit does two things:

 1. Refactors PPCFastISel to use more of the common infrastructure for call
    lowering (this lets us take advantage of this common code for lowering some
    common intrinsics, stackmap/patchpoint among them).

 2. Adds support for stackmap/patchpoint lowering. For the most part, this is
    very similar to the support in the AArch64 target, with the obvious differences
    (different registers, NOP instructions, etc.). The test cases are adapted
    from the AArch64 test cases.

One difference of note is that the patchpoint call sequence takes 24 bytes, so
you can't use less than that (on AArch64 you can go down to 16). Also, as noted
in the docs, we take the patchpoint address to be the actual code address
(assuming the call is local in the TOC-sharing sense), which should yield
higher performance than generating the full cross-DSO indirect-call sequence
and is likely just as useful for JITed code (if not, we'll change it).

StackMaps and Patchpoints are still marked as experimental, and so this support
is doubly experimental. So go ahead and experiment!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225909 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:07:51 +00:00
JF Bastien
21befa7761 Insert random noops to increase security against ROP attacks (llvm)
A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks.

Command line options:
  -noop-insertion // Enable noop insertion.
  -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion)
  -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions.

In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future).
  -fdiversify

This is the llvm part of the patch.
clang part: D3393

http://reviews.llvm.org/D3392
Patch by Stephen Crane (@rinon)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225908 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:07:26 +00:00
Hal Finkel
7a4708e0eb Adjust ScheduleDAGSDNodes::RegDefIter for patchpoints
PATCHPOINT is a strange pseudo-instruction. Depending on how it is used, and
whether or not the AnyReg calling convention is being used, it might or might
not define a value. However, its TableGen definition says that it defines one
value, and so when it doesn't, the code in ScheduleDAGSDNodes::RegDefIter
becomes confused and the code that uses the RegDefIter will try to get the
register class of the MVT::Other type associated with the PATCHPOINT's chain
result (under certain circumstances).

This will be covered by the PPC64 PatchPoint test cases once that support is
re-committed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225907 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:07:03 +00:00
Duncan P. N. Exon Smith
73f9065770 Utils: Simplify code, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225906 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:07:03 +00:00
Duncan P. N. Exon Smith
5f1f94e4c5 Utils: Extract mapUniquedNode(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225905 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:06:21 +00:00
Reid Kleckner
504fa89c8e CodeGen support for x86_64 SEH catch handlers in LLVM
This adds handling for ExceptionHandling::MSVC, used by the
x86_64-pc-windows-msvc triple. It assumes that filter functions have
already been outlined in either the frontend or the backend. Filter
functions are used in place of the landingpad catch clause type info
operands. In catch clause order, the first filter to return true will
catch the exception.

The C specific handler table expects the landing pad to be split into
one block per handler, but LLVM IR uses a single landing pad for all
possible unwind actions. This patch papers over the mismatch by
synthesizing single instruction BBs for every catch clause to fill in
the EH selector that the landing pad block expects.

Missing functionality:
- Accessing data in the parent frame from outlined filters
- Cleanups (from __finally) are unsupported, as they will require
  outlining and parent frame access
- Filter clauses are unsupported, as there's no clear analogue in SEH

In other words, this is the minimal set of changes needed to write IR to
catch arbitrary exceptions and resume normal execution.

Reviewers: majnemer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225904 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:05:27 +00:00
Duncan P. N. Exon Smith
fbf153aebb Utils: MDNode => UniquableMDNode, NFC
Although this makes the `cast<>` assert more often, the
`assert(Node->isResolved())` on the following line would assert in all
those cases.  So, no functionality change here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225903 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:05:17 +00:00
Duncan P. N. Exon Smith
c60bd0cf4b Utils: Separate out mapDistinctNode(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225902 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:03:05 +00:00
Duncan P. N. Exon Smith
874f37749b Utils: Use helper function directly, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225901 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:02:17 +00:00
Adrian Prantl
f82fc00e4c Debug Info: Implement DwarfCompileUnit::addComplexAddress() using
DIEDwarfExpression (and get rid of a bunch of redundant code).

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225900 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:01:30 +00:00
Adrian Prantl
db48bda4a1 Debug Info: Emitting a register in DwarfExpression may fail. Report the
status in a bool and let the users deal with the error.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225899 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:01:28 +00:00
Adrian Prantl
e733e5461f Debug Info: Move DIEDwarfExpression into DwarfExpression.h because it
needs to be accessed from both DwarfCompileUnit.cpp and DwarfUnit.cpp.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225898 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:01:22 +00:00
Duncan P. N. Exon Smith
f29d97eb0f Utils: Extract helper function, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225897 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 01:01:19 +00:00
Duncan P. N. Exon Smith
cb5c0e6745 Utils: Use MDTuple::get() directly, NFC
Working towards supporting `MDLocation` in `MapMetadata()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225896 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 00:59:57 +00:00
Ahmed Bougacha
61d6dc41fa [SimplifyLibCalls] Don't try to simplify indirect calls.
It turns out, all callsites of the simplifier are guarded by a check for
CallInst::getCalledFunction (i.e., to make sure the callee is direct).

This check wasn't done when trying to further optimize a simplified fortified
libcall, introduced by a refactoring in r225640.

Fix that, add a testcase, and document the requirement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225895 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 00:55:05 +00:00
Eric Christopher
7e73dc4ef9 Remove unused predicate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225893 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 00:50:33 +00:00
Eric Christopher
ce0f74d412 Migrate ABIName to MCTargetOptions so that it can be shared between
the TargetMachine level and the MC level.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225891 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 00:50:31 +00:00
Chandler Carruth
c9109225e2 Revert r225854: [PM] Move the LazyCallGraph printing functionality to
a print method.

This was formulated on a bad idea, but sadly I didn't uncover how bad
this was until I got further down the path. I had hoped that we could
provide a low boilerplate way of printing analyses, but it just doesn't
seem like this really fits the needs of the analyses. Not all analyses
really want to do printing, and those that do don't all use the same
interface. Instead, with the new pass manager let's just take advantage
of the fact that creating an explicit printer pass like the LCG has is
pretty low boilerplate already and rely on that for testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225861 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 00:27:45 +00:00
Adrian Prantl
bb7e1f3687 Debug Info: Don't bother emitting DW_AT_frame_base if the function has
no frame register. "Tested" via an assertion triggered by DwarfExpression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225858 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 00:15:16 +00:00
Adrian Prantl
4e5d08aad0 Revert "Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a"
This reverts commit r225852, it was a bad idea.

MachineReg should always be a physical register. If it isn't this DebugLoc
shouldn't have been created in the first place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225857 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 00:15:12 +00:00
Chandler Carruth
2a463a1060 [PM] Move the LazyCallGraph printing functionality to a print method.
I'm adding generic analysis printing utility pass support which will
require such a method (or a specialization) so this will let the
existing printing logic satisfy that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225854 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 23:53:50 +00:00
Adrian Prantl
bc42415f0f Debug Info: Bail out of AddMachineRegPiece() if MachineReg is not a
physical register. The call to getMinimalPhysRegClass() later on asserts
on this condition.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225852 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 23:39:15 +00:00
Adrian Prantl
57ed5ffc76 Debug Info: Move the complex expression handling (=the remainder) of
emitDebugLocValue() into DwarfExpression.

Ought to be NFC, but it actually uncovered a bug in the debug-loc-asan.ll
testcase. The testcase checks that the address of variable "y" is stored
at [RSP+16], which also lines up with the comment.
It also check(ed) that the *value* of "y" is stored in RDI before that,
but that is actually incorrect, since RDI is the very value that is
stored in [RSP+16]. Here's the assembler output:

	movb	2147450880(%rcx), %r8b
	#DEBUG_VALUE: bar:y <- RDI
	cmpb	$0, %r8b
	movq	%rax, 32(%rsp)          # 8-byte Spill
	movq	%rsi, 24(%rsp)          # 8-byte Spill
	movq	%rdi, 16(%rsp)          # 8-byte Spill
.Ltmp3:
	#DEBUG_VALUE: bar:y <- [RSP+16]

Fixed the comment to spell out the correct register and the check to
expect an address rather than a value.

Note that the range that is emitted for the RDI location was and is still
wrong, it claims to begin at the function prologue, but really it should
start where RDI is first assigned.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225851 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 23:39:11 +00:00
Adrian Prantl
9fb34c5169 cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225848 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 23:11:51 +00:00
Adrian Prantl
82df5a6981 Document, cleanup, and clang-format DwarfExpression.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225847 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 23:11:07 +00:00
Adrian Prantl
78415546e9 Debug Info: Turn DIExpression::getFrameRegister() into an isFrameRegister()
function.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225846 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 23:10:43 +00:00
Tom Stellard
d90e5063ca R600/SI: Add pattern for bitcasting fp immediates to integers
The backend now assumes that all immediates are integers.  This allows
us to simplify immediate handling code, becasue we no longer need to
handle fp and integer immediates differently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225844 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 22:59:41 +00:00
Chandler Carruth
a28a251950 [PM] Remove the defunt CGSCC-specific debug flag.
Even before I sunk the debug flag into the opt tool this had been made
obsolete by factoring the pass and analysis managers into a single set
of templates that all used the core flag. No functionality changed here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225842 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 22:45:13 +00:00
Chandler Carruth
3c95d9ccc0 [PM] Push the debug option for the new pass manager into the opt tool
and expose the necessary hooks in the API directly.

This makes it much cleaner for example to log the usage of a pass
manager from a library. It also makes it more obvious that this
functionality isn't "optional" or "asserts-only" for the pass manager.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225841 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 22:42:38 +00:00
Adam Nemet
293f71ddd2 [AVX512] Unpack support in new shuffle lowering
This now handles both 32 and 64-bit element sizes.

In this version, the test are in vector-shuffle-512-v8.ll, canonicalized by
Chandler's update_llc_test_checks.py.

Part of <rdar://problem/17688758>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225838 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 22:20:18 +00:00
Adam Nemet
cebcef6329 [AVX512] Add pretty-printing of shuffle mask for unpacks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225837 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 22:20:14 +00:00
Matthias Braun
12232769b3 DAGCombiner: simplify by using condition variables; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225836 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 22:17:46 +00:00
Duncan P. N. Exon Smith
3b0fe4ec0a AsmParser/Bitcode: Add support for MDLocation
This adds assembly and bitcode support for `MDLocation`.  The assembly
side is rather big, since this is the first `MDNode` subclass (that
isn't `MDTuple`).  Part of PR21433.

(If you're wondering where the mountains of testcase updates are, we
don't need them until I update `DILocation` and `DebugLoc` to actually
use this class.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225830 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 21:10:44 +00:00
Matt Arsenault
7c06364dc0 R600: Implement getRecipEstimate
This requires a new hook to prevent expanding sqrt in terms
of rsqrt and reciprocal. v_rcp_f32, v_rsq_f32, and v_sqrt_f32 are
all the same rate, so this expansion would just double the number
of instructions and cycles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 20:53:23 +00:00
Matt Arsenault
8603a3d1c5 R600: Implement getRsqrtEstimate
Only do for f32 since I'm unclear on both what this is expecting
for the refinement steps in terms of accuracy, and what
f64 instruction actually provides.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225827 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 20:53:18 +00:00
Duncan P. N. Exon Smith
d640962656 IR: Add MDLocation class
Add a new subclass of `UniquableMDNode`, `MDLocation`.  This will be the
IR version of `DebugLoc` and `DILocation`.  The goal is to rename this
to `DILocation` once the IR classes supersede the `DI`-prefixed
wrappers.

This isn't used anywhere yet.  Part of PR21433.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225824 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 20:44:56 +00:00
Matt Arsenault
9e495c518c R600: Make cttz / ctlz cheap to speculate
Speculating things is generally good. SI+ has instructions for these
for 32-bit values. This is still probably better even with the expansion
for 64-bit values, although it is odd that this callback doesn't have
the size as a parameter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225822 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 19:46:48 +00:00
Julien Lerouge
88e1d95d4d Fix non-determinism issue in SLP
The issue was introduced in r214638:

+  for (auto &BSIter : BlocksSchedules) {
+    scheduleBlock(BSIter.second.get());
+  }

Because BlocksSchedules is a DenseMap with BasicBlock* keys, blocks are
scheduled in non-deterministic order, resulting in unpredictable IR.

Patch by Daniel Reynaud!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225821 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 19:45:52 +00:00
Ulrich Weigand
81d2500685 Use the integrated assembler as default on SystemZ
This was already done in clang, this commit now uses the integrated
assembler as default when using LLVM tools directly.

A number of test cases deliberately using an invalid instruction in
inline asm now have to use -no-integrated-as.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225820 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 19:45:16 +00:00
Ulrich Weigand
5a4c26e7bc Use the integrated assembler as default on PowerPC
This was already done in clang, this commit now uses the integrated
assembler as default when using LLVM tools directly.

A number of test cases using inline asm had to be adapted, either by
updating the expected output, or by using -no-integrated-as (for such
tests that deliberately use an invalid instruction in inline asm).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225819 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 19:43:45 +00:00
Chris Bieneman
33943f870f Running clang-format on CommandLine.h and CommandLine.cpp.
No functional changes, I'm just going to be doing a lot of work in these files and it would be helpful if they had more current LLVM style.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225817 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 19:14:20 +00:00
Hal Finkel
ea55eceaed Revert "r225808 - [PowerPC] Add StackMap/PatchPoint support"
Reverting this while I investiage buildbot failures (segfaulting in
GetCostForDef at ScheduleDAGRRList.cpp:314).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225811 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 18:25:05 +00:00
Hal Finkel
6365882935 [PowerPC] Add missing override keyword
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225809 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 18:02:22 +00:00
Hal Finkel
232f393466 [PowerPC] Add StackMap/PatchPoint support
This commit does two things:

 1. Refactors PPCFastISel to use more of the common infrastructure for call
    lowering (this lets us take advantage of this common code for lowering some
    common intrinsics, stackmap/patchpoint among them).

 2. Adds support for stackmap/patchpoint lowering. For the most part, this is
    very similar to the support in the AArch64 target, with the obvious differences
    (different registers, NOP instructions, etc.). The test cases are adapted
    from the AArch64 test cases.

One difference of note is that the patchpoint call sequence takes 24 bytes, so
you can't use less than that (on AArch64 you can go down to 16). Also, as noted
in the docs, we take the patchpoint address to be the actual code address
(assuming the call is local in the TOC-sharing sense), which should yield
higher performance than generating the full cross-DSO indirect-call sequence
and is likely just as useful for JITed code (if not, we'll change it).

StackMaps and Patchpoints are still marked as experimental, and so this support
is doubly experimental. So go ahead and experiment!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225808 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 17:48:12 +00:00
Hal Finkel
0ca9b79771 [StackMaps] Use CurrentFnSymForSize
When computing the call-site offset, use AP.CurrentFnSymForSize instead of
AP.CurrentFnSym. There should be no change for other targets, but this is
necessary for generating valid expressions for PPC64/ELF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225807 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 17:48:07 +00:00
Hal Finkel
b41c7e59a7 [StackMaps] Mark in CallLoweringInfo when lowering a patchpoint
While, generally speaking, the process of lowering arguments for a patchpoint
is the same as lowering a regular indirect call, on some targets it may not be
exactly the same. Targets may not, for example, want to add additional register
dependencies that apply only to making cross-DSO calls through linker stubs,
may not want to load additional registers out of function descriptors, and may
not want to add additional side-effect-causing instructions that cannot be
removed later with the call itself being generated.

The PowerPC target will use this in a future commit (for all of the reasons
stated above).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225806 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 17:48:04 +00:00
Hal Finkel
5e508855d6 [StackMaps] Allow the target to pre-process the live-out mask
Some targets, PowerPC for example, have pseudo-registers (such as that used to
represent the rounding mode), that don't have DWARF register numbers or a
register class. These are used only for internal dependency tracking, and
should not appear in the recorded live-outs. This adds a callback allowing the
target to pre-process the live-out mask in order to remove these kinds of
registers so that the StackMaps code does not complain about them and/or
attempt to include them in the output.

This will be used by the PowerPC target in a future commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225805 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 17:47:59 +00:00
Hal Finkel
a82e676bac [PowerPC] Split the blr definition into BLR and BLR8
We really need a separate 64-bit version of this instruction so that it can be
marked as clobbering LR8 (instead of just LR). No change in functionality
(although the verifier might be slightly happier), however, it is required for
stackmap/patchpoint support. Thus, this will be covered by stackmap test cases
once those are added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225804 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 17:47:54 +00:00
Hal Finkel
a950d7cd1d [PowerPC] Add DWARF numbers for CA (XER), etc.
For registers that have DWARF numbers (like CA, which is really part of XER),
add them. Also, RM is not an SPR, and the declaration hack (where it is
declared as an SPR with an arbitrary number) is not needed, so just declare it
as a register.

NFC; although CA's register number will be needed when stackmap/patchpoint
support is added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225800 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 17:45:11 +00:00
Jozef Kolek
abdc0284ff [mips][microMIPS] Fix issue with 16b instructions in jr instruction delay slot
16 bit instructions are not allowed in jr delay slot. Same stands for
PseudoIndirectBranch and PseudoReturn.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 15:59:17 +00:00
Olivier Sallenave
9dd21f4380 Added TLI hook for isFPExtFree. Some of the FMA combine heuristics are now guarded with that hook.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225795 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 15:06:36 +00:00
Erik Eckstein
046c3e807d Revert "SLPVectorizer: Cache results from memory alias checking."
The alias cache has a problem of incorrect collisions in case a new instruction is allocated at the same address as a previously deleted instruction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225790 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 14:36:46 +00:00
Erik Eckstein
5b23df7cd8 SLPVectorizer: Cache results from memory alias checking.
This speeds up the dependency calculations for blocks with many load/store/call instructions.
Beside the improved runtime, there is no functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225786 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 11:37:51 +00:00
Chandler Carruth
92602ea18e [PM] Refactor the new pass manager to use a single template to implement
the generic functionality of the pass managers themselves.

In the new infrastructure, the pass "manager" isn't actually interesting
at all. It just pipelines a single chunk of IR through N passes. We
don't need to know anything about the IR or the passes to do this really
and we can replace the 3 implementations of the exact same functionality
with a single generic PassManager template, complementing the single
generic AnalysisManager template.

I've left typedefs in place to give convenient names to the various
obvious instantiations of the template.

With this, I think I've nuked almost all of the redundant logic in the
managers, and I think the overall design is actually simpler for having
single templates that clearly indicate there is no special logic here.
The logging is made somewhat more annoying by this change, but I don't
think the difference is worth having heavy-weight traits to help log
things.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225783 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 11:13:56 +00:00
Mehdi Amini
24dbb798ff Peephole opt needs optimizeSelect() to keep track of newly created MIs
Peephole optimizer is scanning a basic block forward. At some point it 
needs to answer the question "given a pointer to an MI in the current 
BB, is it located before or after the current instruction".
To perform this, it keeps a set of the MIs already seen during the scan, 
if a MI is not in the set, it is assumed to be after.
It means that newly created MIs have to be inserted in the set as well.

This commit passes the set as an argument to the target-dependent 
optimizeSelect() so that it can properly update the set with the 
(potentially) newly created MIs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225772 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 07:07:13 +00:00
Ramkumar Ramachandra
65535d3842 fix {typo, build failure} in r225760
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225762 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 04:17:47 +00:00
Ramkumar Ramachandra
2bcc808cf9 Standardize {pred,succ,use,user}_empty()
The functions {pred,succ,use,user}_{begin,end} exist, but many users
have to check *_begin() with *_end() by hand to determine if the
BasicBlock or User is empty. Fix this with a standard *_empty(),
demonstrating a few usecases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225760 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 03:46:47 +00:00
Saleem Abdulrasool
3423a7b24f ARM: prepare prefix parsing for improved AAELF support
AAELF specifies a number of ELF specific relocation types which have custom
prefixes for the symbol reference.  Switch the parser to be more table driven
with an idea of file formats for which they apply.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225758 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 03:22:49 +00:00
Chandler Carruth
6b1894aeae [PM] Fold all three analysis managers into a single AnalysisManager
template.

This consolidates three copies of nearly the same core logic. It adds
"complexity" to the ModuleAnalysisManager in that it makes it possible
to share a ModuleAnalysisManager across multiple modules... But it does
so by deleting *all of the code*, so I'm OK with that. This will
naturally make fixing bugs in this code much simpler, etc.

The only down side here is that we have to use 'typename' and 'this->'
in various places, and the implementation is lifted into the header.
I'll take that for the code size reduction.

The convenient names are still typedef-ed and used throughout so that
users can largely ignore this aspect of the implementation.

The follow-up change to this will do the exact same refactoring for the
PassManagers. =D

It turns out that the interesting different code is almost entirely in
the adaptors. At the end, that should be essentially all that is left.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225757 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 02:51:47 +00:00
Sanjay Patel
97c66ef490 fix typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225753 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 01:51:52 +00:00
Reid Kleckner
d8f69a7201 Rename llvm.recoverframeallocation to llvm.framerecover
This name is less descriptive, but it sort of puts things in the
'llvm.frame...' namespace, relating it to frameallocate and
frameaddress. It also avoids using "allocate" and "allocation" together.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225752 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 01:51:34 +00:00
Reid Kleckner
221a7075cf Add the llvm.frameallocate and llvm.recoverframeallocation intrinsics
These intrinsics allow multiple functions to share a single stack
allocation from one function's call frame. The function with the
allocation may only perform one allocation, and it must be in the entry
block.

Functions accessing the allocation call llvm.recoverframeallocation with
the function whose frame they are accessing and a frame pointer from an
active call frame of that function.

These intrinsics are very difficult to inline correctly, so the
intention is that they be introduced rarely, or at least very late
during EH preparation.

Reviewers: echristo, andrew.w.kaylor

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225746 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:48:10 +00:00
Duncan P. N. Exon Smith
698be08c84 IR: Remove an invalid assertion when replacing resolved operands
This adds back the testcase from r225738, and adds to it.  Looks like we
need both sides for now (the assertion was incorrect both ways, and
although it seemed reasonable (when written correctly) it wasn't
particularly important).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225745 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:46:34 +00:00
Matt Arsenault
29ad7506e1 Combine fcmp + select to fminnum / fmaxnum if no nans and legal
Also require unsafe FP math for no since there isn't a way to
test for signed zeros.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225744 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:43:00 +00:00
Chandler Carruth
9136fdd9b7 [PM] Re-clang-format much of this code as the code has changed some and
so has clang-format. Notably, this fixes a bunch of formatting in the
CGSCC pass manager side of things that has been improved in clang-format
recently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225743 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:36:47 +00:00
Duncan P. N. Exon Smith
47952358ce Revert "IR: Fix an inverted assertion when replacing resolved operands"
This reverts commit r225738.  Maybe the assertion is just plain wrong,
but this version fails on WAY more bots.  I'll make sure both ways work
in a follow-up but I want to get bots green in the meantime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225742 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:34:21 +00:00
Eric Christopher
ccd4840428 Grammar and spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225740 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:21:14 +00:00
Duncan P. N. Exon Smith
4fef722974 IR: Fix an inverted assertion when replacing resolved operands
Add a unit test, since this bug was only exposed by clang tests.  Thanks
to Rafael for tracking this down!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225738 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 00:10:38 +00:00
Adrian Prantl
75212344d1 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
2015-01-13 00:04:06 +00:00
Duncan P. N. Exon Smith
120c186fde 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
2015-01-12 23:45:31 +00:00
Adrian Prantl
df545e8d6c 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
2015-01-12 23:36:56 +00:00
Adrian Prantl
0ec7e836f9 remove extra semicolon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 23:36:50 +00:00
Reid Kleckner
1ec250a32f 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
2015-01-12 23:28:23 +00:00
Matt Arsenault
549b6dbbb7 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
2015-01-12 23:13:00 +00:00
Adrian Prantl
2f95648566 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
2015-01-12 23:03:23 +00:00
Adrian Prantl
34ae4e7151 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
2015-01-12 22:59:28 +00:00
Chandler Carruth
21c4458d3c [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
2015-01-12 22:53:31 +00:00
Adrian Prantl
3d6fed1a57 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
2015-01-12 22:39:14 +00:00
Simon Pilgrim
c815f15537 [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
2015-01-12 22:38:08 +00:00
Adrian Prantl
8afb6d0e2f 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
2015-01-12 22:37:16 +00:00
Duncan P. N. Exon Smith
e73fc94f02 Bitcode: Range-based for, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225716 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 22:35:34 +00:00
Duncan P. N. Exon Smith
0c3289e0bb Bitcode: Add abbreviation for METADATA_NAME
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225715 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 22:34:10 +00:00
Duncan P. N. Exon Smith
442539c468 Bitcode: Range-based for, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225714 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 22:33:00 +00:00
Duncan P. N. Exon Smith
f3e42b3baf Bitcode: Range-based for, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225713 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 22:31:35 +00:00
Duncan P. N. Exon Smith
8d86cef92f 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
2015-01-12 22:30:34 +00:00
Duncan P. N. Exon Smith
0c51e0a826 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
2015-01-12 22:27:39 +00:00
Duncan P. N. Exon Smith
e390a8e7ab AsmParser: Factor duplicated code into ParseMDNode(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225710 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 22:26:48 +00:00
Duncan P. N. Exon Smith
9e9479148f AsmParser: Reorder ParseMetadata() logic, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225709 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 22:24:50 +00:00
Duncan P. N. Exon Smith
9460ae45a6 AsmParser: Simplify ParseMDTuple(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225708 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 22:23:04 +00:00
Adrian Prantl
93eb099f24 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
2015-01-12 22:19:26 +00:00
Adrian Prantl
f89325d832 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
2015-01-12 22:19:22 +00:00
Duncan P. N. Exon Smith
9e8d3bc46a 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
2015-01-12 21:23:11 +00:00
Sanjay Patel
1a135ced09 80-cols; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225700 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 21:21:28 +00:00
Duncan P. N. Exon Smith
023f8e4be7 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
2015-01-12 21:14:38 +00:00
Duncan P. N. Exon Smith
d0517feb77 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
2015-01-12 21:13:09 +00:00
Duncan P. N. Exon Smith
343bb3e252 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
2015-01-12 20:56:33 +00:00
Duncan P. N. Exon Smith
d1ec4f037d 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
2015-01-12 20:50:25 +00:00
Ahmed Bougacha
cd5bbd8bad [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
2015-01-12 20:31:30 +00:00
Duncan P. N. Exon Smith
c88b471b9d 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
2015-01-12 20:21:37 +00:00
Duncan P. N. Exon Smith
dc6a335d3d 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
2015-01-12 20:13:56 +00:00
Duncan P. N. Exon Smith
0196561697 IR: Push storeDistinctInContext() down to UniquableMDNode, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225683 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 20:11:32 +00:00
Duncan P. N. Exon Smith
ae9e15f914 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
2015-01-12 20:09:34 +00:00
Duncan P. N. Exon Smith
6fc29015ff 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
2015-01-12 19:45:44 +00:00
Duncan P. N. Exon Smith
2912990d86 IR: Separate out decrementUnresolvedOperandCount(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225667 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 19:43:15 +00:00
Duncan P. N. Exon Smith
aea8ab800f 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
2015-01-12 19:36:35 +00:00
Tom Stellard
d275e025d2 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
2015-01-12 19:33:18 +00:00
Sanjay Patel
2211d38267 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
2015-01-12 19:29:48 +00:00
Duncan P. N. Exon Smith
728315adf4 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
2015-01-12 19:22:04 +00:00
Duncan P. N. Exon Smith
6205b21cf5 IR: Separate out recalculateHash(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225655 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 19:16:34 +00:00
Duncan P. N. Exon Smith
7826807958 IR: Separate out helper: resolveAfterOperandChange(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225654 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 19:14:15 +00:00
Duncan P. N. Exon Smith
b8e8faf480 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
2015-01-12 19:12:37 +00:00
Matthias Braun
095ca8f493 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
2015-01-12 19:10:17 +00:00
Duncan P. N. Exon Smith
54b53edbd9 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
2015-01-12 18:59:40 +00:00
Duncan P. N. Exon Smith
1478aabb18 IR: Remove redundant comment, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225648 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 18:45:32 +00:00
Duncan P. N. Exon Smith
0315eb0bcb IR: Simplify code, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225647 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12 18:45:01 +00:00
Rafael Espindola
5512415ade 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
2015-01-12 18:13:07 +00:00
Duncan P. N. Exon Smith
e5e4a9a4df 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
2015-01-12 18:01:45 +00:00
Duncan P. N. Exon Smith
21245280cc 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
2015-01-12 17:57:38 +00:00
Timur Iskhodzhanov
de4190697a [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
2015-01-12 17:38:58 +00:00
Ahmed Bougacha
2cec3e9c11 [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
2015-01-12 17:22:43 +00:00
Ahmed Bougacha
fe2d64e0f6 [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
2015-01-12 17:20:06 +00:00
Ahmed Bougacha
aebee0ee62 [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
2015-01-12 17:18:19 +00:00
Jozef Kolek
ad017096fc [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
2015-01-12 12:03:34 +00:00
Hal Finkel
b6bb7db62b [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
2015-01-12 04:34:47 +00:00
Simon Pilgrim
dc5a2dabfe [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
2015-01-11 22:08:01 +00:00
David Majnemer
85a0cb9bf2 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
2015-01-11 07:29:51 +00:00
David Majnemer
d2f4460ee7 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
2015-01-11 05:08:57 +00:00
Saleem Abdulrasool
776673ea09 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
2015-01-11 04:39:24 +00:00
Saleem Abdulrasool
5e3c87ee1a 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
2015-01-11 04:39:18 +00:00
Sanjoy Das
7f0da20b97 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
2015-01-10 23:41:24 +00:00
Joerg Sonnenberger
3073d3960a Revert r225500, it leads to infinite loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225590 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-10 21:49:36 +00:00
Simon Pilgrim
47abf0e3da [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
2015-01-10 19:45:33 +00:00
Hal Finkel
9ae5b7a40a [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
2015-01-10 08:21:59 +00:00
Justin Hibbits
8ab13c61ed Remove some whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225583 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-10 07:50:31 +00:00
Justin Hibbits
1c6936f6d7 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
2015-01-10 01:57:21 +00:00
Alexey Samsonov
2ba0f89d9e 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
2015-01-10 00:46:38 +00:00
Hal Finkel
6829815d96 [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
2015-01-10 00:31:10 +00:00
Hal Finkel
a14d6f1ea5 [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
2015-01-10 00:30:55 +00:00
Rafael Espindola
68016e0a6e 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
2015-01-10 00:07:30 +00:00
Andrew Kaylor
e17e33b29f 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
2015-01-09 22:53:24 +00:00
Michael Zolotukhin
d23518097e Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225553 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 22:15:06 +00:00
Hans Wennborg
ca71be6415 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
2015-01-09 22:13:31 +00:00
Simon Pilgrim
34630b6ea9 [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
2015-01-09 22:03:19 +00:00
Michael Zolotukhin
b2e5f58de0 Remove duplicating code. NFC.
The removed condition is checked in the previous loop.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225542 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 20:36:19 +00:00
Tim Northover
8cd39a2630 Re-reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before
doing Load PRE"

It's not really expected to stick around, last time it provoked a weird LTO
build failure that I can't reproduce now, and the bot logs are long gone. I'll
re-revert it if the failures recur.

Original description: Perform Scalar PRE on gep indices that feed loads before
doing Load PRE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225536 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 19:19:56 +00:00
Lang Hames
4c553e0367 Recommit r224935 with a fix for the ObjC++/AArch64 bug that that revision
introduced.

A test case for the bug was already committed in r225385.

Patch by Rafael Espindola.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225534 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 18:55:42 +00:00
Duncan P. N. Exon Smith
98e3b1abbf Revert "Bitcode: Move the DEBUG_LOC record to DEBUG_LOC_OLD"
This reverts commit r225498 (but leaves r225499, which was a worthy
cleanup).

My plan was to change `DEBUG_LOC` to store the `MDNode` directly rather
than its operands (patch was to go out this morning), but on reflection
it's not clear that it's strictly better.  (I had missed that the
current code is unlikely to emit the `MDNode` at all.)

Conflicts:
	lib/Bitcode/Reader/BitcodeReader.cpp (due to r225499)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225531 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 17:53:27 +00:00
Daniel Sanders
8d7b0bdcf0 [mips] Add support for accessing $gp as a named register.
Summary:
Mips Linux uses $gp to hold a pointer to thread info structure and accesses it
with a named register. This makes this work for LLVM.

The N32 ABI doesn't quite work yet since the frontend generates incorrect IR
for this case. It neglects to truncate the 64-bit GPR to a 32-bit value before
converting to a pointer. Given correct IR (as in the testcase in this patch),
it works correctly.

Reviewers: sstankovic, vmedic, atanasyan

Reviewed By: atanasyan

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225529 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 17:21:30 +00:00
Sanjay Patel
61478e3bf9 remove names from comments; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225526 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 16:47:20 +00:00
Sanjay Patel
a987742b0e fix typos; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225525 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 16:35:37 +00:00
Sanjay Patel
46b23a185f fix typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 16:29:50 +00:00
Sanjay Patel
b1d136dd4f more efficient use of a dyn_cast; no functional change intended
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225523 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 16:28:15 +00:00
Hal Finkel
139bfee84c [PowerPC] Enable late partial unrolling on the POWER7
The P7 benefits from not have really-small loops so that we either have
multiple dispatch groups in the loop and/or the ability to form more-full
dispatch groups during scheduling. Setting the partial unrolling threshold to
44 seems good, empirically, for the P7. Compared to using no late partial
unrolling, this yields the following test-suite speedups:

SingleSource/Benchmarks/Adobe-C++/simple_types_constant_folding
	-66.3253% +/- 24.1975%
SingleSource/Benchmarks/Misc-C++/oopack_v1p8
	-44.0169% +/- 29.4881%
SingleSource/Benchmarks/Misc/pi
	-27.8351% +/- 12.2712%
SingleSource/Benchmarks/Stanford/Bubblesort
	-30.9898% +/- 22.4647%

I've speculatively added a similar setting for the P8. Also, I've noticed that
the unroller does not quite calculate the unrolling factor correctly for really
tiny loops because it neglects to account for the fact that not every loop body
replicant contains an ending branch and counter increment. I'll fix that later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225522 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 15:51:16 +00:00
Toma Tabacu
bdab504afd [mips] Add comment which explains why we need to change the assembler options before and after inline asm blocks. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225521 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 15:00:30 +00:00
Suyog Sarda
df970d6297 Assumption that "VectorizedValue" will always be an Instruction is not correct.
It can be a constant or a vector argument.

ex :

define i32 @hadd(<4 x i32> %a) #0 {
entry:
  %vecext = extractelement <4 x i32> %a, i32 0
  %vecext1 = extractelement <4 x i32> %a, i32 1
  %add = add i32 %vecext, %vecext1
  %vecext2 = extractelement <4 x i32> %a, i32 2
  %add3 = add i32 %add, %vecext2
  %vecext4 = extractelement <4 x i32> %a, i32 3
  %add5 = add i32 %add3, %vecext4
  ret i32 %add5
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225517 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 10:23:48 +00:00
Saleem Abdulrasool
c2a1df7125 ARM: add support for R_ARM_ABS16
Add support for R_ARM_ABS16 relocation mapping.  Addresses PR22156.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225510 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 06:57:24 +00:00
Saleem Abdulrasool
ea4fe48b22 ARM: add support for R_ARM_ABS8 relocations
Add support for R_ARM_ABS8 relocation.  Addresses PR22126.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225507 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 05:59:12 +00:00
Matthias Braun
c41acffe22 RegisterCoalescer: Fix removeCopyByCommutingDef with subreg liveness
The code that eliminated additional coalescable copies in
removeCopyByCommutingDef() used MergeValueNumberInto() which internally
may merge A into B or B into A. In this case A and B had different Def
points, so we have to reset ValNo.Def to the intended one after merging.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225503 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 03:01:31 +00:00
Matthias Braun
4493e98154 RegisterCoalescer: Some cleanup in removeCopyByCommutingDef(), NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225502 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 03:01:28 +00:00
Matthias Braun
fdddd47cc6 RegisterCoalescer: No need to set kill flags, they are recompute later anyway
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225501 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 03:01:26 +00:00
Matthias Braun
c25a1509c3 RegisterCoalescer: Turn some impossible conditions into asserts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225500 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 03:01:23 +00:00
Duncan P. N. Exon Smith
acec33834b Bitcode: Share logic for last instruction, NFC
Share logic for getting the last instruction emitted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225499 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 02:51:45 +00:00
Duncan P. N. Exon Smith
97bbaa3227 Bitcode: Move the DEBUG_LOC record to DEBUG_LOC_OLD
Prepare to simplify the `DebugLoc` record.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225498 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 02:48:48 +00:00
Hal Finkel
cc7ea4df1e [PowerPC] Add a flag for experimenting with subreg liveness tracking
This cannot yet be enabled by default, it causes ~50 miscompiles in the test
suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225497 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 02:03:11 +00:00
Hal Finkel
4e98296890 [PowerPC] Fold [sz]ext with fp_to_int lowering where possible
On modern cores with lfiw[az]x, we can fold a sign or zero extension from i32
to i64 into the load necessary for an i64 -> fp conversion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225493 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 01:34:30 +00:00
Hal Finkel
8e1d151abe [DAGCombine] Remainder of fix to r225380 (More FMA folding opportunities)
As pointed out by Aditya (and Owen), when we elide an FP extend to form an FMA,
we need to extend the incoming operands so that the resulting node will really
be legal. This is currently enabled only for PowerPC, and it happens to work
there regardless, but this should fix the functionality for everyone else
should anyone else wish to use it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225492 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 01:29:29 +00:00
Chandler Carruth
72dd2f22b5 [x86] Add a flag to control the vector shuffle legality predicates that
complements the new vector shuffle lowering code path. This flag,
naturally, is *off* because we've not tested or evaluated the results of
this at all. However, the flag will make it much easier to evaluate
whether we can be this aggressive and whether there are missing vector
shuffle lowering optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225491 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 01:24:36 +00:00
Chandler Carruth
f3c718e49b Cleaup ValueHandle to no longer keep a PointerIntPair for the Value*.
This was used previously for metadata but is no longer needed there. Not
doing this simplifies ValueHandle and will make it easier to fix things
like AssertingVH's DenseMapInfo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225487 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 00:48:47 +00:00
Hal Finkel
40ddb2ce8f Partial fix to r225380 (More FMA folding opportunities)
As pointed out by Aditya (and Owen), there are two things wrong with this code.
First, it adds patterns which elide FP extends when forming FMAs, and that might
not be profitable on all targets (it belongs behind the pre-existing
aggressive-FMA-formation flag). This is fixed by this change.

Second, the resulting nodes might have operands of different types (the
extensions need to be re-added). That will be fixed in the follow-up commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225485 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 00:45:54 +00:00
Philip Reames
ce0e12f0b4 [REFACTOR] Push logic from MemDepPrinter into getNonLocalPointerDependency
Previously, MemDepPrinter handled volatile and unordered accesses without involving MemoryDependencyAnalysis.  By making a slight tweak to the documented interface - which is respected by both callers - we can move this responsibility to MDA for the benefit of any future callers.  This is basically just cleanup.

In the future, we may decide to extend MDA's non local dependency analysis to return useful results for ordered or volatile loads.  I believe (but have not really checked in detail) that local dependency analyis does get useful results for ordered, but not volatile, loads.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225483 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 00:26:45 +00:00
Philip Reames
dba2d12578 [Refactor] Have getNonLocalPointerDependency take the query instruction
Previously, MemoryDependenceAnalysis::getNonLocalPointerDependency was taking a list of properties about the instruction being queried. Since I'm about to need one more property to be passed down through the infrastructure - I need to know a query instruction is non-volatile in an inner helper - fix the interface once and for all.

I also added some assertions and behaviour clarifications around volatile and ordered field accesses. At the moment, this is mostly to document expected behaviour. The only non-standard instructions which can currently reach this are atomic, but unordered, loads and stores. Neither ordered or volatile accesses can reach here.

The call in GVN is protected by an isSimple check when it first considers the load. The calls in MemDepPrinter are protected by isUnordered checks. Both utilities also check isVolatile for loads and stores.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-09 00:04:22 +00:00
Duncan P. N. Exon Smith
3408708548 Utils: Keep distinct MDNodes distinct in MapMetadata()
Create new copies of distinct `MDNode`s instead of following the
uniquing `MDNode` logic.

Just like self-references (or other cycles), `MapMetadata()` creates a
new node.  In practice most calls use `RF_NoModuleLevelChanges`, in
which case nothing is duplicated anyway.

Part of PR22111.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225476 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-08 22:42:30 +00:00
Duncan P. N. Exon Smith
f416d72973 IR: Add 'distinct' MDNodes to bitcode and assembly
Propagate whether `MDNode`s are 'distinct' through the other types of IR
(assembly and bitcode).  This adds the `distinct` keyword to assembly.

Currently, no one actually calls `MDNode::getDistinct()`, so these nodes
only get created for:

  - self-references, which are never uniqued, and
  - nodes whose operands are replaced that hit a uniquing collision.

The concept of distinct nodes is still not quite first-class, since
distinct-ness doesn't yet survive across `MapMetadata()`.

Part of PR22111.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225474 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-08 22:38:29 +00:00
Hal Finkel
b7c01bf403 [PowerPC] Mark all instructions as non-cheap for MachineLICM
MachineLICM uses a callback named hasLowDefLatency to determine if an
instruction def operand has a 'low' latency. If all relevant operands have a
'low' latency, the instruction is considered too cheap to hoist out of loops
even in low-register-pressure situations. On PowerPC cores, both the embedded
cores and the others, there is no reason to believe that this is a good choice:
all instructions have a cost inside a loop, and hoisting them when not limited
by register pressure is a reasonable default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225471 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-08 22:11:49 +00:00