Commit Graph

76005 Commits

Author SHA1 Message Date
Erik Eckstein
04075c619b SLPVectorizer: limit the number of alias checks to reduce the runtime.
In case of blocks with many memory-accessing instructions, alias checking can take lot of time
(because calculating the memory dependencies has quadratic complexity).
I chose a limit which resulted in no changes when running the benchmarks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226439 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 09:33:38 +00:00
Hal Finkel
e6e4c786b1 [PowerPC] Minor correction to r226432
We don't need to exclude patchpoints from the implicit r2 dependence in
FastISel because it is added as an implicit operand and, thus, should not
confuse that StackMap code.

By inspection / no test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226434 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 07:44:45 +00:00
Michael Kuperstein
5a0c8601d3 [MIScheduler] Slightly better handling of constrainLocalCopy when both source and dest are local
This fixes PR21792.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226433 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 07:30:47 +00:00
Hal Finkel
d1f1656447 [PowerPC] Add r2 as an operand for all calls under both PPC64 ELF V1 and V2
Our PPC64 ELF V2 call lowering logic added r2 as an operand to all direct call
instructions in order to represent the dependency on the TOC base pointer
value. Restricting this to ELF V2, however, does not seem to make sense: calls
under ELF V1 have the same dependence, and indirect calls have an r2 dependence
just as direct ones. Make sure the dependence is noted for all calls under both
ELF V1 and ELF V2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226432 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 07:20:27 +00:00
Craig Topper
6f91bd79f3 [x86] Change AVX512 intrinsics to take a 8-bit immediate for the comparision kind instead of a 32-bit immediate. This better aligns with the emitted instruction. It also matches SSE and AVX1 equivalents. Also add auto upgrade support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226430 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 06:07:27 +00:00
Chandler Carruth
d09c0db8a9 [PM] Lift the analyses into the interface for
SplitLandingPadPredecessors and remove the Pass argument from its
interface.

Another step to the utilities being usable with both old and new pass
managers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226426 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-19 03:03:39 +00:00
David Blaikie
5f16ba708b unique_ptrify the RelInfo parameter to TargetRegistry::createMCSymbolizer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226416 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 20:45:48 +00:00
David Blaikie
341a7e245e std::unique_ptrify the MCStreamer argument to createAsmPrinter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226414 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 20:29:04 +00:00
Hal Finkel
341223ee0a [PowerPC] Don't hard-code R2 as register when processing TOC relocations
Instructions that have high-order TOC relocations always carry R2 as their base
register, so it does not matter whether we take the register from the
instruction or just hard-code it in PPCAsmPrinter. In the future, however, we
might want to apply these relocations to instructions using a different
register, so taking the register from the instruction is a better thing to do.
No change in functionality here, however.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226403 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 15:59:44 +00:00
Hal Finkel
180f89537a [PowerPC] Add some FIXMEs for fastcc and FPR <-> GPR moves
So we don't forget, once we support FPR <-> GPR moves on the P8, we'll likely
want to re-visit this part of the calling convention.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226401 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 14:31:10 +00:00
Hal Finkel
a01b583dbc [PowerPC] Initial PPC64 calling-convention changes for fastcc
The default calling convention specified by the PPC64 ELF (V1 and V2) ABI is
designed to work with both prototyped and non-prototyped/varargs functions. As
a result, GPRs and stack space are allocated for every argument, even those
that are passed in floating-point or vector registers.

GlobalOpt::OptimizeFunctions will transform local non-varargs functions (that
do not have their address taken) to use the 'fast' calling convention.

When functions are using the 'fast' calling convention, don't allocate GPRs for
arguments passed in other types of registers, and don't allocate stack space for
arguments passed in registers. Other changes for the fast calling convention
may be added in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226399 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 12:08:47 +00:00
Chandler Carruth
5817eaff8f [PM] Pull the analyses used for another utility routine into its API
rather than relying on the pass object.

This one is a bit annoying, but will pay off. First, supporting this one
will make the next one much easier, and for utilities like LoopSimplify,
this is moving them (slowly) closer to not having to pass the pass
object around throughout their APIs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226396 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 09:21:15 +00:00
Chandler Carruth
7478e27573 [PM] Sink the specific analyses preserved by SplitBlock into its
interface, removing Pass from its interface.

This also makes those analyses optional so that passes which don't even
preserve these (or use them) can skip the logic entirely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226394 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 02:39:37 +00:00
Chandler Carruth
0389537c08 [PM] Replace another Pass argument with specific analyses that are
optionally updated by MergeBlockIntoPredecessors.

No functionality changed, just refactoring to clear the way for the new
pass manager.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226392 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 02:11:23 +00:00
Chandler Carruth
d39e52bef7 [PM] Refactor how the LoopRotation pass access the DominatorTree.
Instead of querying the pass every where we need to, do that once and
cache a pointer in the pass object. This is both simpler and I'm about
to add yet another place where we need to dig out that pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226391 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 02:08:05 +00:00
Chandler Carruth
b7f66977be [PM] Lift the actual analyses used into the inferface rather than
accepting a Pass and querying it for analyses.

This is necessary to allow the utilities to work both with the old and
new pass managers, and I also think this makes the interface much more
clear and helps the reader know what analyses the utility can actually
handle. I plan to repeat this process iteratively to clean up all the
pass utilities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226386 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 01:45:07 +00:00
Chandler Carruth
5a2d01e5b8 [PM] Now that LoopInfo isn't in the Pass type hierarchy, it is much
cleaner to derive from the generic base.

Thise removes a ton of boiler plate code and somewhat strange and
pointless indirections. It also remove a bunch of the previously needed
friend declarations. To fully remove these, I also lifted the verify
logic into the generic LoopInfoBase, which seems good anyways -- it is
generic and useful logic even for the machine side.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226385 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-18 01:25:51 +00:00
Chandler Carruth
e81cec19db [PM] Cleanup more warnings my refactoring exposed where now we have
unused variables in a no-asserts build.

I've fixed this by putting the entire loop behind an #ifndef as it
contains nothing other than asserts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226377 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 14:49:23 +00:00
Chandler Carruth
122e67cb34 [PM] Remove a dead field.
This was dead even before I refactored how we initialized it, but my
refactoring made it trivially dead and it is now caught by a Clang
warning. This fixes the warning and should clean up the -Werror bot
failures (sorry!).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226376 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 14:31:35 +00:00
Chandler Carruth
de5df29556 [PM] Split the LoopInfo object apart from the legacy pass, creating
a LoopInfoWrapperPass to wire the object up to the legacy pass manager.

This switches all the clients of LoopInfo over and paves the way to port
LoopInfo to the new pass manager. No functionality change is intended
with this iteration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226373 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 14:16:18 +00:00
Hal Finkel
962cff0c08 [PowerPC] Don't list R11 as a patchpoint scratch register
R11's status is the same under both the PPC64 ELF V1 and V2 ABIs: it is
reserved for use as an "environment pointer" for compilation models that
require such a thing. We don't, we also don't need a second scratch register,
and because we support only "local" patchpoint call targets, we might as well
let R11 be used for anyregcc patchpoints.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226369 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 03:57:34 +00:00
Mehdi Amini
5eed637b34 Improve DAG combine pass on certain IR vector patterns
Loading 2 2x32-bit float vectors into the bottom half of a 256-bit vector
produced suboptimal code in AVX2 mode with certain IR combinations.

In particular, the IR optimizer folded 2f32 + 2f32 -> 4f32, 4f32 + 4f32
(undef) -> 8f32 into a 2f32 + 2f32 -> 8f32, which seems more canonical,
but then mysteriously generated rather bad code; the movq/movhpd combination
didn't match.

The problem lay in the BUILD_VECTOR optimization path. The 2f32 inputs
would get promoted to 4f32 by the type legalizer, eventually resulting
in a BUILD_VECTOR on two 4f32 into an 8f32. The BUILD_VECTOR then, recognizing
these were both half the output size, concatted them and then produced
a shuffle. However, the resulting concat + shuffle was more complex than
it should be; in the case where the upper half of the output is undef, we
probably want to generate shuffle + concat instead.

This enhancement causes the vector_shuffle combine step to recognize this
suboptimal pattern and correct it. I included it there instead of in BUILD_VECTOR
in case the same suboptimal pattern occurs for other reasons.

This results in the optimizer correctly producing the optimal movq + movhpd
sequence for all three variations on this IR, even with AVX2.

I've included a test case.

Radar link: rdar://problem/19287012
Fix for PR 21943.

From: Fiona Glaser <fglaser@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226360 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 01:35:56 +00:00
Lang Hames
f2a51a78f5 [RuntimeDyld] Tidy up emitCommonSymbols a little. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226358 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 00:55:05 +00:00
Richard Trieu
6cf3f3fceb Remove std::move that was preventing return value optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226356 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 00:46:44 +00:00
Matthias Braun
0553dac91f RegisterCoalescer: Cleanup and improved comment for a subtle detail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 00:33:13 +00:00
Matthias Braun
b26c2fc557 RegisterCoalescer: Cleanup by factoring out a common expression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226352 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 00:33:11 +00:00
Matthias Braun
b8f5c8cb95 RegisterCoalescer: Cleanup comment style
- Consistenly put comments above the function declaration, not the
  definition. To achieve this some duplicate comments got merged and
  some comment parts describing implementation details got moved into their
  functions.
- Consistently use doxygen comments above functions.
- Do not use doxygen comments inside functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226351 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 00:33:09 +00:00
Matthias Braun
07a087f45c RegisterCoalescer: Drive-by typo + whitespace fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226350 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 00:33:06 +00:00
Lang Hames
944d563647 [RuntimeDyld] Remove the brace initialization that was introduced in r226341.
Evidently MSVC doesn't like it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226349 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-17 00:32:56 +00:00
Philip Reames
70e90cefd5 Update a comment
Be a bit more explicit about the fact that addrspace(1) is not reserved.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226344 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 23:21:07 +00:00
Philip Reames
999412767a clang-format all the GC related files (NFC)
Nothing interesting here...




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226342 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 23:16:12 +00:00
Lang Hames
61bd005d1b [RuntimeDyld] Track symbol visibility in RuntimeDyld.
RuntimeDyld symbol info previously consisted of just a Section/Offset pair. This
patch replaces that pair type with a SymbolInfo class that also tracks symbol
visibility. A new method, RuntimeDyld::getExportedSymbolLoadAddress, is
introduced which only returns a non-zero result for exported symbols. For
non-exported or non-existant symbols this method will return zero. The
RuntimeDyld::getSymbolAddress method retains its current behavior, returning
non-zero results for all symbols regardless of visibility.

No in-tree clients of RuntimeDyld are changed. The newly introduced
functionality will be used by the Orc APIs.

No test case: Since this patch doesn't modify the behavior for any in-tree
clients we don't have a good tool to test this with yet. Once Orc is in we can
use it to write regression tests that test these changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226341 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 23:13:56 +00:00
Kevin Enderby
57cc8ad672 Fix the Archive::Child::getRawSize() method used by llvm-objdump’s -archive-headers option
and tweak its use in llvm-objdump.  Add back the test case for the -archive-headers option.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226332 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 22:10:36 +00:00
Colin LeMahieu
d08a6cd083 [Hexagon] Converting halfword to doubleword multiply intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226326 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 21:41:57 +00:00
Colin LeMahieu
9a56f06825 [Hexagon] Converting accumulating halfword multiply intrinsics to patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226324 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 21:36:34 +00:00
Colin LeMahieu
67451fe320 [Hexagon] Beginning converting intrinsics to patterns instead of duplicated definitions. Converting halfword multiply intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226318 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 20:38:54 +00:00
Colin LeMahieu
6a1bcaf6ff [Hexagon] Fix 226309, replacement atomic store patterns didn't actually exist, added new versions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226315 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 20:16:14 +00:00
Saleem Abdulrasool
d4bdb4e0b2 X86: fix comment typo in AsmParser
Fix a typo.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226313 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 20:16:06 +00:00
Philip Reames
07fbc5c1c6 Move ownership of GCStrategy objects to LLVMContext
Note: This change ended up being slightly more controversial than expected.  Chandler has tentatively okayed this for the moment, but I may be revisiting this in the near future after we settle some high level questions.

Rather than have the GCStrategy object owned by the GCModuleInfo - which is an immutable analysis pass used mainly by gc.root - have it be owned by the LLVMContext. This simplifies the ownership logic (i.e. can you have two instances of the same strategy at once?), but more importantly, allows us to access the GCStrategy in the middle end optimizer. To this end, I add an accessor through Function which becomes the canonical way to get at a GCStrategy instance.

In the near future, this will allows me to move some of the checks from http://reviews.llvm.org/D6808 into the Verifier itself, and to introduce optimization legality predicates for some of the recent additions to InstCombine. (These will follow as separate changes.)

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 20:07:33 +00:00
Colin LeMahieu
9da6e03161 [Hexagon] Removing old duplicate atomic load/store patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226309 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 19:53:35 +00:00
Philip Reames
8a660bd822 Remove gc.root's findCustomSafePoints mechanism
Searching all of the existing gc.root implementations I'm aware of (all three of them), there was exactly one use of this mechanism, and that was to implement a performance improvement that should have been applied to the default lowering.

Having this function is requiring a dependency on a CodeGen class (MachineFunction), in a class which is otherwise completely independent of CodeGen. I could solve this differently, but given that I see absolutely no value in preserving this mechanism, I going to just get rid of it.

Note: Tis is the first time I'm intentionally breaking previously supported gc.root functionality. Given 3.6 has branched, I believe this is a good time to do this.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226305 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 19:33:28 +00:00
Colin LeMahieu
3cec3682bb [Hexagon] Converting old patterns to new versions using classes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226304 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 19:29:59 +00:00
Adam Nemet
ad2ac976af [AVX512] Add intrinsics for masked aligned FP loads and stores
Similar to the unaligned cases.

Test was generated with update_llc_test_checks.py.

Part of <rdar://problem/17688758>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226296 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 18:50:09 +00:00
Duncan P. N. Exon Smith
fb7514fccb IR: Allow 16-bits for column info
Raise the limit for column information from 8 bits to 16 bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226291 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 17:33:08 +00:00
Duncan P. N. Exon Smith
44fb4b337f IR: Cleanup dead code, NFC
Line/column fixups already exist in `MDLocation`.  Delete the duplicated
logic in `DebugLoc`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226290 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 17:31:29 +00:00
Colin LeMahieu
9fd1ca6c40 [Hexagon] Updating call/jump instruction patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226288 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 17:05:27 +00:00
Andrea Di Biagio
ac7b9c828f [X86][DAG] Disable target specific combine on INSERTPS dag nodes at -O0.
This patch disables target specific combine on X86ISD::INSERTPS dag nodes
if optlevel is CodeGenOpt::None.

The backend currently implements a target specific combine rule that converts
a vector load used by an INSERTPS dag node into a scalar load plus a
scalar_to_vector. This allows ISel to select a single INSERTPSrm instead of
two instructions (i.e. a vector load plus INSERTPSrr).

However, the existing target combine rule on INSERTPS nodes only works under
the assumption that ISel will always be able to match an INSERTPSrm. This is
not true in general at -O0, since the backend only allows folding a load into
the memory operand of an instruction if the optimization level is not
CodeGenOpt::None.

In the example below:

//
__m128 test(__m128 a, __m128 *b) {
  __m128 c = _mm_insert_ps(a, *b, 1 << 6);
  return c;
}
//

Before this patch, at -O0, the backend would have canonicalized the load to 'b'
into a scalar load plus scalar_to_vector. Later on, ISel would have selected an
INSERTPSrr leaving the insertps mask in an inconsistent state:

  movss 4(%rdi), %xmm1
  insertps  $64, %xmm1, %xmm0 # xmm0 = xmm1[1],xmm0[1,2,3].

With this patch, the backend avoids folding the vector load into the operand of
the INSERTPS. The new codegen at -O0 is:

  movaps (%rdi), %xmm1
  insertps  $64, %xmm1, %xmm0 # %xmm1[1],xmm0[1,2,3].


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226277 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 14:55:26 +00:00
Toma Tabacu
ca2812cfc6 [mips] Remove a redundant semicolon and add space before curly brackets. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226269 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 10:45:15 +00:00
Timur Iskhodzhanov
6a7c74de33 Revert r226242 - Revert Revert Don't create new comdats in CodeGen
This breaks AddressSanitizer (ninja check-asan) on Windows

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226251 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 08:38:45 +00:00
Hal Finkel
92cd0ca3b2 [PowerPC] Adjust PatchPoints for ppc64le
Bill Schmidt pointed out that some adjustments would be needed to properly
support powerpc64le (using the ELF V2 ABI). For one thing, R11 is not available
as a scratch register, so we need to use R12. R12 is also available under ELF
V1, so to maintain consistency, I flipped the order to make R12 the first
scratch register in the array under both ABIs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226247 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 04:40:58 +00:00
Mehdi Amini
525f296ef1 Fix Reassociate handling of constant in presence of undef float
http://reviews.llvm.org/D6993

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226245 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 03:00:58 +00:00
Rafael Espindola
dfe88a08c7 Revert "Revert Don't create new comdats in CodeGen"
This reverts commit r226173, adding r226038 back.

No change in this commit, but clang was changed to also produce trivial comdats for
costructors, destructors and vtables when needed.

Original message:

Don't create new comdats in CodeGen.

This patch stops the implicit creation of comdats during codegen.

Clang now sets the comdat explicitly when it is required. With this patch clang and gcc
now produce the same result in pr19848.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226242 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 02:22:55 +00:00
Sanjoy Das
148e8c9b8b Add a new pass "inductive range check elimination"
IRCE eliminates range checks of the form

  0 <= A * I + B < Length

by splitting a loop's iteration space into three segments in a way
that the check is completely redundant in the middle segment.  As an
example, IRCE will convert

  len = < known positive >
  for (i = 0; i < n; i++) {
    if (0 <= i && i < len) {
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }

to

  len = < known positive >
  limit = smin(n, len)
  // no first segment
  for (i = 0; i < limit; i++) {
    if (0 <= i && i < len) { // this check is fully redundant
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }
  for (i = limit; i < n; i++) {
    if (0 <= i && i < len) {
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }


IRCE can deal with multiple range checks in the same loop (it takes
the intersection of the ranges that will make each of them redundant
individually).

Currently IRCE does not do any profitability analysis.  That is a
TODO.

Please note that the status of this pass is *experimental*, and it is
not part of any default pass pipeline.  Having said that, I will love
to get feedback and general input from people interested in trying
this out.

This pass was originally r226201.  It was reverted because it used C++
features not supported by MSVC 2012.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226238 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 01:03:22 +00:00
Kevin Enderby
5d80532925 This should fix the build bot clang-cmake-armv7-a15-full failing on
the macho-archive-headers.test added with r226228.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226232 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-16 00:27:31 +00:00
Matt Arsenault
ab2315014e R600/SI: Add patterns for v_cvt_{flr|rpi}_i32_f32
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226230 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 23:58:35 +00:00
Filipe Cabecinhas
909dd28c54 Fix edge case when Start overflowed in 32 bit mode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226229 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 23:50:44 +00:00
Kevin Enderby
cdfe54f8a9 Add the option, -archive-headers, used with -macho to print the Mach-O archive headers to llvm-objdump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226228 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 23:19:11 +00:00
Matt Arsenault
c204f47feb R600/SI: Fix trailing comma with modifiers
Instructions with 1 operand can still use source modifiers,
so make sure we don't print an extra comma afterwards.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226226 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 23:17:03 +00:00
Colin LeMahieu
c93be748d7 [Hexagon] Adding new-value store and bit reverse instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226224 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 23:10:29 +00:00
Filipe Cabecinhas
0183477621 Report fatal errors instead of segfaulting/asserting on a few invalid accesses while reading MachO files.
Summary:
Shift an older “invalid file” test to get a consistent naming for these tests.

Bugs found by afl-fuzz

Reviewers: rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226219 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 22:52:38 +00:00
Lang Hames
07e3f81e93 [Object] Add SF_Exported flag. This flag will be set on all symbols that would
be exported from a dylib if their containing object file were linked into one.

No test case: No command line tools query this flag, and there are no Object
unit tests.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226217 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 22:33:30 +00:00
Sanjoy Das
df1b4f601d Revert r226201 (Add a new pass "inductive range check elimination")
The change used C++11 features not supported by MSVC 2012.  I will fix
the change to use things supported MSVC 2012 and recommit shortly.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226216 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 22:18:10 +00:00
David Majnemer
63feac1e76 InductiveRangeCheckElimination: Remove extra ';'
This silences a GCC warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226215 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 21:55:16 +00:00
Andrew Kaylor
3a370d412f Fixing pedantic build warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226214 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 21:50:53 +00:00
Colin LeMahieu
c0518a01f0 [Hexagon] Fix 226206 by uncommenting required pattern and changing patterns for simple load-extends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226210 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 21:35:49 +00:00
Hal Finkel
94dc061e85 [PowerPC] Loosen ELFv1 PPC64 func descriptor loads for indirect calls
Function pointers under PPC64 ELFv1 (which is used on PPC64/Linux on the
POWER7, A2 and earlier cores) are really pointers to a function descriptor, a
structure with three pointers: the actual pointer to the code to which to jump,
the pointer to the TOC needed by the callee, and an environment pointer. We
used to chain these loads, and make them opaque to the rest of the optimizer,
so that they'd always occur directly before the call. This is not necessary,
and in fact, highly suboptimal on embedded cores. Once the function pointer is
known, the loads can be performed ahead of time; in fact, they can be hoisted
out of loops.

Now these function descriptors are almost always generated by the linker, and
thus the contents of the descriptors are invariant. As a result, by default,
we'll mark the associated loads as invariant (allowing them to be hoisted out
of loops). I've added a target feature to turn this off, however, just in case
someone needs that option (constructing an on-stack descriptor, casting it to a
function pointer, and then calling it cannot be well-defined C/C++ code, but I
can imagine some JIT-compilation system doing so).

Consider this simple test:
  $ cat call.c

  typedef void (*fp)();
  void bar(fp x) {
    for (int i = 0; i < 1600000000; ++i)
      x();
  }

  $ cat main.c

  typedef void (*fp)();
  void bar(fp x);
  void foo() {}
  int main() {
    bar(foo);
  }

On the PPC A2 (the BG/Q supercomputer), marking the function-descriptor loads
as invariant brings the execution time down to ~8 seconds from ~32 seconds with
the loads in the loop.

The difference on the POWER7 is smaller. Compiling with:

  gcc -std=c99 -O3 -mcpu=native call.c main.c : ~6 seconds [this is 4.8.2]

  clang -O3 -mcpu=native call.c main.c : ~5.3 seconds

  clang -O3 -mcpu=native call.c main.c -mno-invariant-function-descriptors : ~4 seconds
  (looks like we'd benefit from additional loop unrolling here, as a first
   guess, because this is faster with the extra loads)

The -mno-invariant-function-descriptors will be added to Clang shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226207 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 21:17:34 +00:00
Colin LeMahieu
02b677594c [Hexagon] Updating indexed load-extend patterns and changing test to new expected output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 21:07:52 +00:00
Sanjoy Das
0170a308ec Add a new pass "inductive range check elimination"
IRCE eliminates range checks of the form

  0 <= A * I + B < Length

by splitting a loop's iteration space into three segments in a way
that the check is completely redundant in the middle segment.  As an
example, IRCE will convert

  len = < known positive >
  for (i = 0; i < n; i++) {
    if (0 <= i && i < len) {
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }

to

  len = < known positive >
  limit = smin(n, len)
  // no first segment
  for (i = 0; i < limit; i++) {
    if (0 <= i && i < len) { // this check is fully redundant
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }
  for (i = limit; i < n; i++) {
    if (0 <= i && i < len) {
      do_something();
    } else {
      throw_out_of_bounds();
    }
  }


IRCE can deal with multiple range checks in the same loop (it takes
the intersection of the ranges that will make each of them redundant
individually).

Currently IRCE does not do any profitability analysis.  That is a
TODO.

Please note that the status of this pass is *experimental*, and it is
not part of any default pass pipeline.  Having said that, I will love
to get feedback and general input from people interested in trying
this out.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226201 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 20:45:46 +00:00
Hal Finkel
39b09ae788 Revert "r226086 - Revert "r226071 - [RegisterCoalescer] Remove copies to reserved registers""
Reapply r226071 with fixes. Two fixes:

 1. We need to manually remove the old and create the new 'deaf defs'
    associated with physical register definitions when we move the definition of
    the physical register from the copy point to the point of the original vreg def.

    This problem was picked up by the machinstr verifier, and could trigger a
    verification failure on test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll, so I've
    turned on the verifier in the tests.

 2. When moving the def point of the phys reg up, we need to make sure that it
    is neither defined nor read in between the two instructions. We don't, however,
    extend the live ranges of phys reg defs to cover uses, so just checking for
    live-range overlap between the pair interval and the phys reg aliases won't
    pick up reads. As a result, we manually iterate over the range and check for
    reads.

    A test soon to be committed to the PowerPC backend will test this change.

Original commit message:

[RegisterCoalescer] Remove copies to reserved registers

This allows the RegisterCoalescer to join "non-flipped" range pairs with a
physical destination register -- which allows the RegisterCoalescer to remove
copies like this:

<vreg> = something (maybe a load, for example)
... (things that don't use PHYSREG)
PHYSREG = COPY <vreg>

(with all of the restrictions normally applied by the RegisterCoalescer: having
compatible register classes, etc. )

Previously, the RegisterCoalescer handled only the opposite case (copying
*from* a physical register). I don't handle the problem fully here, but try to
get the common case where there is only one use of <vreg> (the COPY).

An upcoming commit to the PowerPC backend will make this pattern much more
common on PPC64/ELF systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226200 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 20:32:09 +00:00
Philip Reames
ff0ce51bab Style cleanup of old gc.root lowering code
Use static functions for helpers rather than static member functions.  a) this changes the linking (minor at best), and b) this makes it obvious no object state is involved.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226198 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 19:49:25 +00:00
Philip Reames
b0a04acdc0 clang-format GCStrategy.cpp & GCRootLowering.cpp (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226196 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 19:39:17 +00:00
Philip Reames
71649b0d0d Split GCStrategy.cpp into two files (NFC)
This preparation for an update to http://reviews.llvm.org/D6811.  GCStrategy.cpp will hopefully be moving into IR/, where as the lowering logic needs to stay in CodeGen/



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226195 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 19:29:42 +00:00
Colin LeMahieu
42fa763380 [Hexagon] Removing old versions of vsplice, valign, cl0, ct0 and updating references to new versions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226194 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 19:28:32 +00:00
Marek Olsak
3d7ab06c38 R600/SI: Unify VOP2 instructions which are VOP3-only on VI
This removes some duplicated classes and definitions.

These instructions are defined:
  _e32 // pseudo
  _e32_si
  _e64 // pseudo
  _e64_si
  _e64_vi

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226191 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:43:06 +00:00
Marek Olsak
232d5fa02c R600/SI: Use 64-bit encoding by default for opcodes that are VOP3-only on VI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226190 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:43:01 +00:00
Marek Olsak
352fa59ec3 R600/SI: Add V_READLANE_B32 and V_WRITELANE_B32 for VI
These are VOP3-only on VI.

The new multiclass doesn't define VOP3 versions of VOP2 instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226189 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:42:55 +00:00
Marek Olsak
6589ea14e7 R600/SI: Don't shrink instructions whose e32 encoding doesn't exist
v2: modify hasVALU32BitEncoding instead
v3: - add pseudoToMCOpcode helper to AMDGPUInstInfo, which is used by both
      hasVALU32BitEncoding and AMDGPUMCInstLower::lower
    - report an error if a pseudo can't be lowered

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226188 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:42:51 +00:00
Marek Olsak
cbb4ac578d R600/SI: Add common class VOPAnyCommon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226187 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:42:44 +00:00
Marek Olsak
a32c8ca9eb R600/SI: Don't select SI-only VOP3 opcodes on VI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226186 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:42:40 +00:00
Colin LeMahieu
500b0d97a1 [Hexagon] Adding vmux instruction. Removing old transfer instructions and updating references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 18:16:00 +00:00
Joerg Sonnenberger
638077aa41 Support @PLT loads on 32bit x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226182 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 17:59:02 +00:00
Colin LeMahieu
044438aff5 [Hexagon] Deleting old float comparison instruction and updating references to new ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226179 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 17:28:14 +00:00
Colin LeMahieu
4ce3b1e4ce [Hexagon] Replacing old fadd/fsub instructions and updating references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226176 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 16:30:07 +00:00
Timur Iskhodzhanov
d048b3be70 Revert Don't create new comdats in CodeGen
It breaks AddressSanitizer on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226173 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 16:14:34 +00:00
Daniel Sanders
cb71ef1b46 [mips] Fix a typo in the compare patterns for MIPS32r6/MIPS64r6.
Summary: The patterns intended for the SETLE node were actually matching the SETLT node.

Reviewers: atanasyan, sstankovic, vmedic

Reviewed By: vmedic

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226171 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 15:41:03 +00:00
Mehdi Amini
79c01f67ab Fix SelectionDAG -view-*-dags filtering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226163 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 12:03:32 +00:00
Alexander Kornienko
b4c6267f7c Replace size method call of containers to empty method where appropriate
This patch was generated by a clang tidy checker that is being open sourced.
The documentation of that checker is the following:

/// The emptiness of a container should be checked using the empty method
/// instead of the size method. It is not guaranteed that size is a
/// constant-time function, and it is generally more efficient and also shows
/// clearer intent to use empty. Furthermore some containers may implement the
/// empty method but not implement the size method. Using empty whenever
/// possible makes it easier to switch to another container in the future.

Patch by Gábor Horváth!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226161 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 11:41:30 +00:00
Chandler Carruth
e2ffd02ad3 [PM] Port TargetLibraryInfo to the new pass manager, provided by the
TargetLibraryAnalysis pass.

There are actually no direct tests of this already in the tree. I've
added the most basic test that the pass manager bits themselves work,
and the TLI object produced will be tested by an upcoming patches as
they port passes which rely on TLI.

This is starting to point out the awkwardness of the invalidate API --
it seems poorly fitting on the *result* object. I suspect I will change
it to live on the analysis instead, but that's not for this change, and
I'd rather have a few more passes ported in order to have more
experience with how this plays out.

I believe there is only one more analysis required in order to start
porting instcombine. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226160 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 11:39:46 +00:00
Chandler Carruth
eeeec3ce0d [PM] Separate the TargetLibraryInfo object from the immutable pass.
The pass is really just a means of accessing a cached instance of the
TargetLibraryInfo object, and this way we can re-use that object for the
new pass manager as its result.

Lots of delta, but nothing interesting happening here. This is the
common pattern that is developing to allow analyses to live in both the
old and new pass manager -- a wrapper pass in the old pass manager
emulates the separation intrinsic to the new pass manager between the
result and pass for analyses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226157 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 10:41:28 +00:00
Craig Topper
06185e7f6b Hide some redundant AVX512 instructions from the asm parser, but force them to show up in the disassembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226155 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 09:37:15 +00:00
David Majnemer
cdfb69b2a3 SimplifyIndVar: Remove unused variable
OtherOperandIdx is not used anymore, remove it to silence warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226138 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 07:11:23 +00:00
NAKAMURA Takumi
20b033eae5 Update libdeps since TLI was moved from Target to Analysis in r226078.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226126 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 05:21:00 +00:00
NAKAMURA Takumi
9500df49eb Reorder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226125 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 05:20:46 +00:00
Hal Finkel
f908e37144 Revert "r226071 - [RegisterCoalescer] Remove copies to reserved registers"
Reverting this while I investigate some bad behavior this is causing. As a
possibly-related issue, adding -verify-machineinstrs to one of the test cases
now fails because of this change:

  llc test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll -march=x86-64 -o - -verify-machineinstrs

*** Bad machine code: No instruction at def index ***
- function:    foo
- basic block: BB#0 return (0x10007e21f10) [0B;736B)
- liverange:   [128r,128d:9)[160r,160d:8)[176r,176d:7)[336r,336d:6)[464r,464d:5)[480r,480d:4)[624r,624d:3)[752r,752d:2)[768r,768d:1)[78
4r,784d:0)  0@784r 1@768r 2@752r 3@624r 4@480r 5@464r 6@336r 7@176r 8@160r 9@128r
- register:    %DS
Valno #3 is defined at 624r

*** Bad machine code: Live segment doesn't end at a valid instruction ***
- function:    foo
- basic block: BB#0 return (0x10007e21f10) [0B;736B)
- liverange:   [128r,128d:9)[160r,160d:8)[176r,176d:7)[336r,336d:6)[464r,464d:5)[480r,480d:4)[624r,624d:3)[752r,752d:2)[768r,768d:1)[78
4r,784d:0)  0@784r 1@768r 2@752r 3@624r 4@480r 5@464r 6@336r 7@176r 8@160r 9@128r
- register:    %DS
[624r,624d:3)
LLVM ERROR: Found 2 machine code errors.

where 624r corresponds exactly to the interval combining change:

624B    %RSP<def> = COPY %vreg16; GR64:%vreg16
        Considering merging %vreg16 with %RSP
                RHS = %vreg16 [608r,624r:0)  0@608r
                updated: 608B   %RSP<def> = MOV64rm <fi#3>, 1, %noreg, 0, %noreg; mem:LD8[%saved_stack.1]
        Success: %vreg16 -> %RSP
        Result = %RSP

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226086 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 03:08:59 +00:00
Chandler Carruth
dd1b7ed60b Switch this header file to not hard-code Windows line endings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226081 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 02:21:56 +00:00
Chandler Carruth
bda134910a [PM] Move TargetLibraryInfo into the Analysis library.
While the term "Target" is in the name, it doesn't really have to do
with the LLVM Target library -- this isn't an abstraction which LLVM
targets generally need to implement or extend. It has much more to do
with modeling the various runtime libraries on different OSes and with
different runtime environments. The "target" in this sense is the more
general sense of a target of cross compilation.

This is in preparation for porting this analysis to the new pass
manager.

No functionality changed, and updates inbound for Clang and Polly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226078 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 02:16:27 +00:00
NAKAMURA Takumi
635656e231 Win64Exception.cpp: Try to fix crash for x64 EH. "Per" might be null there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226077 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 02:15:21 +00:00
Sanjoy Das
7ec1829823 Fix PR22222
The bug was introduced in r225282. r225282 assumed that sub X, Y is
the same as add X, -Y. This is not correct if we are going to upgrade
the sub to sub nuw. This change fixes the issue by making the
optimization ignore sub instructions.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226075 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 01:46:09 +00:00
Hal Finkel
47ab8c106f [RegisterCoalescer] Remove copies to reserved registers
This allows the RegisterCoalescer to join "non-flipped" range pairs with a
physical destination register -- which allows the RegisterCoalescer to remove
copies like this:

<vreg> = something (maybe a load, for example)
... (things that don't use PHYSREG)
PHYSREG = COPY <vreg>

(with all of the restrictions normally applied by the RegisterCoalescer: having
compatible register classes, etc. )

Previously, the RegisterCoalescer handled only the opposite case (copying
*from* a physical register). I don't handle the problem fully here, but try to
get the common case where there is only one use of <vreg> (the COPY).

An upcoming commit to the PowerPC backend will make this pattern much more
common on PPC64/ELF systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226071 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 01:25:28 +00:00
Hal Finkel
4572a0a0a2 [PowerPC] Add assembler support for mcrfs and friends
Fill out our support for the floating-point status and control register
instructions (mcrfs and friends). As it turns out, these are necessary for
compiling src/test/harness_fp.h in TBB for PowerPC.

Thanks to Raf Schietekat for reporting the issue!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226070 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 01:00:53 +00:00
Richard Smith
ef7d38d35a For PR21145: recognise a builtin call to a known deallocation function even if
it's defined in the current module. Clang generates this situation for the
C++14 sized deallocation functions, because it generates a weak definition in
case one isn't provided by the C++ runtime library.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226069 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 01:00:33 +00:00
Colin LeMahieu
32467012f6 [Hexagon] Replacing old versions of stores and loads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 00:15:30 +00:00
Ramkumar Ramachandra
fba4d82671 [GC] CodeGenPrep transform: simplify offsetable relocate
The transform is somewhat involved, but the basic idea is simple: find
derived pointers that have been offset from the base pointer using gep
and replace the relocate of the derived pointer with a gep to the
relocated base pointer (with the same offset).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226060 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 23:27:07 +00:00
Colin LeMahieu
419855bfeb [Hexagon] Replacing old version of convert and load f64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226057 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 23:07:36 +00:00
Philip Reames
8f9d11309a getMangledTypeStr: clarify how it mangles types, and add tests
"Write a set of tests that show how name mangling is done for overloaded intrinsics."  These happen to use gc.relocates to exercise the codepath in question, but is not a GC specific test.

Patch by: artagnon@gmail.com
Differential Revision: http://reviews.llvm.org/D6915



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226056 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 23:05:17 +00:00
NAKAMURA Takumi
2495c84184 Update libdeps in NVPTXCodeGen, since r225944.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226055 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 23:01:36 +00:00
Reid Kleckner
4ac8ae7ea1 Use MMI->getPersonality() instead of MMI->getPersonalities()[MMI->getPersonalityIndex()]
Also nuke the comment about supporting multiple personalities in a
single function, aka PR1414. That's just crazy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226052 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 22:47:54 +00:00
Duncan P. N. Exon Smith
37ac8d3622 IR: Move MDLocation into place
This commit moves `MDLocation`, finishing off PR21433.  There's an
accompanying clang commit for frontend testcases.  I'll attach the
testcase upgrade script I used to PR21433 to help out-of-tree
frontends/backends.

This changes the schema for `DebugLoc` and `DILocation` from:

    !{i32 3, i32 7, !7, !8}

to:

    !MDLocation(line: 3, column: 7, scope: !7, inlinedAt: !8)

Note that empty fields (line/column: 0 and inlinedAt: null) don't get
printed by the assembly writer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226048 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 22:27:36 +00:00
Matthias Braun
de8202b084 MachineVerifier: Allow undef reads if a matching superreg is defined.
Summary:
Some pseudo instruction expansions break down a wide register use into
multiple uses of smaller sub registers. If the super register was
partially undefined the broken down sub registers may be completely
undefined now leading to MachineVerifier complaints. Unfortunately
liveness information to add the required dead flags is not easily
(cheaply) available when expanding pseudo instructions.

This commit changes the verifier to be quiet if there is an additional
implicit use of a super register. Pseudo instruction expanders can use
this to mark cases where partially defined values get potentially broken
into completely undefined ones.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226047 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 22:25:14 +00:00
Duncan P. N. Exon Smith
bf13dd03e7 IR: Always print MDLocation line
Print `MDLocation`'s `line` field even when it's 0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226046 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 22:14:26 +00:00
Duncan P. N. Exon Smith
0294f639d2 IR: Drop metadata references more aggressively during teardown
Sometimes teardown happens before the debug info graph is complete
(e.g., when clang throws an error).  In that case, `MDNode`s will still
have RAUW, so deleting constants that the `MDNode`s point at will be
relatively expensive -- it'll cause re-uniquing all up the chain (what
I've been referring to as "teardown madness").

So, drop references *before* deleting constants.  We need to drop a few
more references now: the metadata side of the metadata/value bridges
needs to be dropped off the cliff along with the rest of it (previously,
the bridges were cleaned before we did anything with the `MDNode`s).

There's no real functionality change here -- state before and after
`LLVMContextImpl::~LLVMContextImpl()` is unchanged -- so no testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226044 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 21:58:17 +00:00
Rafael Espindola
33f5127540 Don't create new comdats in CodeGen.
This patch stops the implicit creation of comdats during codegen.

Clang now sets the comdat explicitly when it is required. With this patch clang and gcc
now produce the same result in pr19848.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226038 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 20:55:48 +00:00
Colin LeMahieu
f7db2526ad [Hexagon] Removing old, unused !tstbit instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226036 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 20:26:15 +00:00
Chandler Carruth
8af8091ef5 [MBP] Add flags to disable the BadCFGConflict check in MachineBlockPlacement.
Some benchmarks have shown that this could lead to a potential
performance benefit, and so adding some flags to try to help measure the
difference.

A possible explanation. In diamond-shaped CFGs (A followed by either
B or C both followed by D), putting B and C both in between A and
D leads to the code being less dense than it could be. Always either
B or C have to be skipped increasing the chance of cache misses etc.
Moving either B or C to after D might be beneficial on average.

In the long run, but we should probably do a better job of analyzing the
basic block and branch probabilities to move the correct one of B or
C to after D. But even if we don't use this in the long run, it is
a good baseline for benchmarking.

Original patch authored by Daniel Jasper with test tweaks and a second
flag added by me.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226034 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 20:19:29 +00:00
Bill Schmidt
11abe69e98 [PPC64] Add support for the ICBT instruction on POWER8.
Patch by Kit Barton.

Support for the ICBT instruction is currently present, but limited to
embedded processors. This change adds a new FeatureICBT that can be used
to identify whether the ICBT instruction is available on a specific processor.

Two new tests are added:
 * Positive test to ensure the icbt instruction is present when using
-mcpu=pwr8
 * Negative test to ensure the icbt instruction is not generated when
using -mcpu=pwr7

Both test cases use the Prefetch opcode in LLVM. They are based on the
ppc64-prefetch.ll test case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226033 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 20:17:10 +00:00
Duncan P. N. Exon Smith
9e4a11f46c IR: Fix a use-after-free in RAUW
Happened pretty commonly during `LLVMContext` teardown when `clang -g`
hit an error.  This fixes the use-after-free.  Next I'll clean up
teardown so that it's not RAUW'ing when metadata-tracked values are
deleted (only really causes a problem if the graph is mid-construction
when teardown starts, but it's still unnecessary work).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226029 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 19:56:10 +00:00
David Majnemer
5e8cd99f55 InstCombine: Don't take A-B<0 into A<B if A-B has other uses
This fixes PR22226.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226023 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 19:26:56 +00:00
Rafael Espindola
8327f0bca1 Revert "Add r224985 back with two fixes."
This reverts commit r225644 while I debug a regression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226022 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 19:07:23 +00:00
Reid Kleckner
4350881a94 Emit the Itanium LSDA for unknown EH personalities on Win64
This fixes lots of generic CodeGen tests that use __gcc_personality_v0.
This suggests that using ExceptionHandling::MSVC was a mistake, and we
should instead classify each function by personality function. This
would, for example, allow us to LTO a binary containing uses of SEH and
Itanium EH.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226019 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 18:50:10 +00:00
Reid Kleckner
983125f9b4 Remove dead code for llvm.eh.selector in the old EH model
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226018 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 18:49:39 +00:00
Colin LeMahieu
77b1c04ef8 [Hexagon] Removing old versions of cmph and updating references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226013 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 18:26:14 +00:00
Rafael Espindola
ad946a868f Add support for comdats with names larger than 256 characters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226012 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 18:25:45 +00:00
Colin LeMahieu
c788b1f524 [Hexagon] Removing old versions of cmpb and updating references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226006 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 18:05:44 +00:00
Colin LeMahieu
8b869b4ae9 [Hexagon] Deleting versions of compare-not that don't have encoding information. Updating references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226003 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 16:49:12 +00:00
Tom Stellard
65e0a4d4da R600/SI: Use IMPLICIT_DEF and KILL when failing to spill VGPRs
This helps us avoid 'invalid register class for operand' verifier
errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225989 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 15:42:34 +00:00
Tom Stellard
33040cf56e R600/SI: Spill VGPRs to scratch space for compute shaders
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225988 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 15:42:31 +00:00
Olivier Sallenave
01cef58e6b Override the TLI callback enableAggressiveFMAFusion and return true. Indeed, fmul, fmadd and fadd nodes cost the same number of cycles, so we can enable more combining heuristics to produce more fmadd nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225984 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 14:47:24 +00:00
Erik Eckstein
d6238e7b7e reapply: 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.

Compared to the original commit, this re-applied commit contains a bug fix which ensures that there are
no incorrect collisions in the alias cache.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225977 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 11:24:47 +00:00
Chandler Carruth
1b279144ec [cleanup] Re-sort all the #include lines in LLVM using
utils/sort_includes.py.

I clearly haven't done this in a while, so more changed than usual. This
even uncovered a missing include from the InstrProf library that I've
added. No functionality changed here, just mechanical cleanup of the
include order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225974 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 11:23:27 +00:00
Jyoti Allur
fd06dd8efc Correct POP handling for v7m
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225972 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-14 10:48:16 +00:00
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