Commit Graph

110574 Commits

Author SHA1 Message Date
Hal Finkel
d281f1443a Consider subregs when calling MI::registerDefIsDead for phys deps
The scheduling dependency graph is built bottom-up within each scheduling
region, and ScheduleDAGInstrs::addPhysRegDeps is called to add output/anti
dependencies, based on physical registers, to the SUs for instructions
based on those that come before them.

In the test case, we start before post-RA scheduling with a block that looks
like this:

...
	INLINEASM <...
andc $0,$0,$2
stdcx. $0,0,$3
bne- 1b
> [sideeffect] [mayload] [maystore] [attdialect], $0:[regdef-ec:G8RC], %X6<earlyclobber,def,dead>, $1:[mem], %X3<kill>, $2:[reguse:G8RC], %X5<kill>, $3:[reguse:G8RC], %X3, $4:[mem], %X3, $5:[clobber], %CC<earlyclobber,imp-def,dead>, <<badref>>
	...
	%X4<def,dead> = ANDIo8 %X4<kill>, 1, %CR0<imp-def,dead>, %CR0GT<imp-def>
	...
	%R29<def> = ISEL %R3<undef>, %R4<kill>, %CR0GT<kill>

where it is relevant that %CC is an alias to %CR0, and that %CR0GT is a
subregister of %CR0. However, for post-RA scheduling, no dependency was added
to prevent the INLINEASM from being scheduled in between the ANDIo8 and the
ISEL (which communicate via the %CR0GT register).

In ScheduleDAGInstrs::addPhysRegDeps, when called for the %CC operand, we'd
iterate over all of its aliases (which include %CC itself and also %CR0), and
look for previously-encountered defs of those registers. We'd find the ANDIo8,
but decide not to add a dependency between the INLINEASM and the ANDIo8 because
both the INLINEASM's def of %CC is dead, and also the ANDIo8 def of %CR0 is
dead. This ignores, however, that ANDIo8 has a non-dead def of %CR0GT, a
subregister of %CR0, and thus a dependency still must exist.

To fix this problem, when calling registerDefIsDead on the SU with the def, we
also check all subregisters for possible non-dead defs, and add the dependency
if any are found.

Fixes PR21742.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223440 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 01:57:22 +00:00
Duncan P. N. Exon Smith
afcbfb40fb ADT: Remove GetStringMapEntryFromValue()
It relies on undefined behaviour, since `StringMapEntry<>` is not
a standard layout type.  There are no users anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223439 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 01:41:36 +00:00
Duncan P. N. Exon Smith
397b575f81 IR: Stop relying on GetStringMapEntryFromValue()
It relies on undefined behaviour.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223438 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 01:41:34 +00:00
Adrian Prantl
74fb019dd0 Cleanup: Calls to getDwarfRegNum() may actually fail, if there is
no DWARF register number mapping, or if the register was a virtual
register that was never materialized. Previously, we would just emit a
bogus location, after this patch we don't emit a location at all by
doing an early exit.

After my bugfix in r223401 today, this doesn't actually happen on any
target that I tested this with, but it's still preferable to make the
possibility of a failure explicit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223428 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 01:02:46 +00:00
Adrian Prantl
af25a5d9b7 Add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223427 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 01:02:36 +00:00
Paul Robinson
ebde7405a7 Make GetSVN.cmake do its VCS queries with native CMake code.
This lets the queries work on Windows as well as Linux.

This does mean make and cmake aren't using the same scripts to do the
queries (again), but at least GetSVN.cmake understands git and git-svn
as well as svn now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223425 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:50:15 +00:00
Rafael Espindola
7eaee304ab linkGlobalVariableProto never returns null. Simplify the caller. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223424 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:30:47 +00:00
Eric Christopher
52978c2adf Rename the x86 isTargetMacho to isTargetMachO for uniformity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223421 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:22:38 +00:00
Eric Christopher
62b1007007 Both of these subtargets have functions that check whether or
not the target is mach-o. Use them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223420 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:22:35 +00:00
Rafael Espindola
aa8cddcd3a Move merging of alignment to a central location. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223418 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:09:02 +00:00
Rafael Espindola
d3c3235ab3 Add a few extra cases to the test. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223417 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:02:42 +00:00
Kevin Enderby
543abe4906 Re-add support to llvm-objdump for Mach-O universal files and archives with -macho
with fixes.  Includes the move of tests for llvm-objdump for universal files to an X86
directory.  And the fix where it was failing on linux Rafael tracked down with asan.
I had both Jim Grosbach and Adam Hemet look over the second fix since I could not
set up asan to reproduce with the old version but not with the fix.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223416 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 23:56:27 +00:00
Ahmed Bougacha
3d5af84aa6 [X86] Delete dead code in fcopysign lowering. NFC.
r32900 introduced custom lowering for fcopysign, with two checks to
change the magnitude value's type if it's larger/smaller than the sign
value's type.  r32932 replaced that code for the smaller case.
r43205 did the same for the larger case, but left the old code, now dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223415 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 23:52:15 +00:00
Rafael Espindola
fe137022a5 Convert test to use an extra Input file. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223414 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 23:31:21 +00:00
Alexey Samsonov
59d867405a Revert "Fix UBSan report in StringMap implementation."
This reverts commit r223402. Some bots fail with -Winvalid-offsetof
warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 23:00:50 +00:00
Adrian Prantl
9e8083744d Simplify implementation and testcase of r223401 based on feedback from dblaikie.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223405 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 22:58:41 +00:00
Alexey Samsonov
8bc0067071 Fix UBSan report in StringMap implementation.
Use offsetof() instead of a member access within null pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223402 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 22:45:31 +00:00
Adrian Prantl
fb8dcb45c6 Debug info: If the RegisterCoalescer::reMaterializeTrivialDef() is
eliminating all uses of a vreg, update any DBG_VALUE describing that vreg
to point to the rematerialized register instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223401 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 22:29:04 +00:00
Hans Wennborg
76b1313e75 Add some tests for SimplifyCFG's TurnSwitchRangeIntoICmp(). NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223396 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 22:19:28 +00:00
Hans Wennborg
8de6d3e510 Add some tests for SimplifyCFG's ConstantFoldTerminator(). NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223395 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 22:19:25 +00:00
Rafael Espindola
838e18116d Also use --icf=safe if we are being linked by gold.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223394 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 22:16:08 +00:00
Roman Divacky
924476a79d Add a FIXME as requested by Renato Golin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223390 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 21:39:24 +00:00
Yaron Keren
499e74c3cd Silence warning: variable 'buffer' set but not used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223389 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 21:36:38 +00:00
Bruno Cardoso Lopes
9eb2a386c7 [x86] Fix isOffsetSuitableForCodeModel kernel code model offset
Offset == 0 is a valid offset for kernel code model according to the
x86_64 System V ABI. Found by inspection, no testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223383 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 20:36:06 +00:00
Weiming Zhao
1b77bb5628 [AArch64] Combining Load and IntToFp should check for neon availability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223382 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 20:25:50 +00:00
Asiri Rathnayake
61f3193001 Fix yet another unseen regression caused by r223113
r223113 added support for ARM modified immediate assembly syntax. Which
assumes all immediate operands are prefixed with a '#'. This assumption
is wrong as per the ARMARM - which recommends that all '#' characters be
treated optional. The current patch fixes this regression and adds a test
case. A follow-up patch will expand the test coverage to other instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223381 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 19:34:59 +00:00
Jonathan Roelofs
3d47855394 Fix thumbv4t indirect calls
So there are a couple of issues with indirect calls on thumbv4t. First, the most
'obvious' instruction, 'blx' isn't available until v5t. And secondly, the
next-most-obvious sequence: 'mov lr, pc; bx rN' doesn't DTRT in thumb code
because the saved off pc has its thumb bit cleared, so when the callee returns
we end up in ARM mode.... yuck.

The solution is to 'bl' to a nearby landing pad with a 'bx rN' in it.

We could cut down on code size by sharing the landing pads between call sites
that are close enough, but for the moment let's do correctness first and look at
performance later.


Patch by: Iain Sandoe

http://reviews.llvm.org/D6519


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223380 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 19:34:50 +00:00
Philip Reames
ef7c2ff0f3 Add a test case for argument type coercion in an invoke of a vararg function
This would have caught the bug I fixed in 223370.  



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223378 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 19:13:45 +00:00
Philip Reames
327f2434da Add a section to Statepoint docs mentioning shared bugzilla search and standard mailing lists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223374 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 18:33:28 +00:00
Rafael Espindola
89f1920565 Detect if the linker is gold and if so always use --gc-sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223372 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 17:54:35 +00:00
Hal Finkel
efbb95a1be Revert "r223364 - Revert r223347 which has caused crashes on bootstrap bots."
Reapply r223347, with a fix to not crash on uninserted instructions (or more
precisely, instructions in uninserted blocks). bugpoint was able to reduce the
test case somewhat, but it is still somewhat large (and relies on setting
things up to be simplified during inlining), so I've not included it here.
Nevertheless, it is clear what is going on and why.

Original commit message:

Restrict somewhat the memory-allocation pointer cmp opt from r223093

Based on review comments from Richard Smith, restrict this optimization from
applying to globals that might resolve lazily to other dynamically-loaded
modules, and also from dynamic allocas (which might be transformed into malloc
calls). In short, take extra care that the compared-to pointer is really
simultaneously live with the memory allocation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223371 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 17:45:19 +00:00
Philip Reames
ad90e3ad14 Fix a typo: use of cast where dyn_cast was intended
This bug has the effect of converting a test of isGCRelocate(InvokeInst*) from a false return to a crash.  

This may be the root cause of the crash Joerg reported against r223137, but I'm still waiting for a clean build of clang to complete to be able to confirm.  Once I've confirmed the issue, I'll submit a test case separately.  



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223370 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 17:27:58 +00:00
Daniel Sanders
86bf88145b test-release.sh: Add a way to specify --build to configure
Summary:
I currently have to specify --build=mips-linux-gnu or --build=mipsel-linux-gnu
to configure in order to successfully recurse a 32-bit build of the compiler on
my mips64-linux-gnu and mips64el-linux-gnu targets. This is a bug and will be
fixed but in the meantime it will be useful to have a way to work around this.

Reviewers: tstellarAMD

Subscribers: llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223369 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 17:15:35 +00:00
Rafael Espindola
3f598f77bd Remove dead code. NFC.
This interface was added 2 years ago but users never developed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223368 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 16:59:36 +00:00
Asiri Rathnayake
9571274787 Fix a minor regression introduced in r223113
r223113 added support for ARM modified immediate assembly syntax. That patch
has broken support for immediate expressions, as in:
    add r0, #(4 * 4)
It wasn't caught because we don't have any tests for this feature. This patch
fixes this regression and adds test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223366 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 14:49:07 +00:00
Rafael Espindola
a300b8d7e4 Use size_type in the interface exposed by SmallVector.
This matches std::vector and should avoid unnecessary masking to 32 bits
when calling them on o 64 bits system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223365 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 14:40:35 +00:00
Alexander Potapenko
182d9aaccb Revert r223347 which has caused crashes on bootstrap bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223364 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 14:22:27 +00:00
Rafael Espindola
7e32ae6cf7 Revert "[Thumb/Thumb2] Added restrictions on PC, LR, SP in the register list for PUSH/POP/LDM/STM. <Differential Revision: http://reviews.llvm.org/D6090>"
This reverts commit r223356.

It was failing check-all (MC/ARM/thumb.s in particular).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223363 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 14:10:20 +00:00
Michael Kuperstein
5e343e6fd0 [X86] Improve a dag-combine that handles a vector extract -> zext sequence.
The current DAG combine turns a sequence of extracts from <4 x i32> followed by zexts into a store followed by scalar loads.
According to measurements by Martin Krastev (see PR 21269) for x86-64, a sequence of an extract, movs and shifts gives better performance. However, for 32-bit x86, the previous sequence still seems better.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223360 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 13:49:51 +00:00
Jyoti Allur
996b683a9f [Thumb/Thumb2] Added restrictions on PC, LR, SP in the register list for PUSH/POP/LDM/STM. <Differential Revision: http://reviews.llvm.org/D6090>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223356 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 11:52:49 +00:00
Andrea Di Biagio
e6cb70164e [X86] Simplify code. NFC.
Replaced some logic that checked if a build_vector node is doing a splat of a
non-undef value with a call to method BuildVectorSDNode::getSplatValue().
No functional change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223354 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 11:21:44 +00:00
Daniel Sanders
d27b0b9489 test-release.sh: Correct the logged configure command to match the one actually issued.
--disable-timestamps was added to the configure command way back in r142647 but
the command that echos this command to the log was not updated at the time.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223351 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 11:00:09 +00:00
Patrik Hagglund
cfb121f286 Use DomTree in MachineSink to sink over diamonds.
According to a previous FIXME comment we now not only look at MBB
successors, but also handle code sinking past them:

  x = computation
  if () {} else {}
  use x

The instruction could be sunk over the whole diamond for the
if/then/else (or loop, etc), allowing it to be sunk into other blocks
after that.

Modified test added in r204522, due to one spill less present.

Minor fixes in comments.

Patch provided by Jonas Paulsson. Reviewed by Hal Finkel.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223350 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 10:36:42 +00:00
Simon Pilgrim
94590ca4cf [InstCombine] Minor optimization for bswap with binary ops
Added instcombine optimizations for BSWAP with AND/OR/XOR ops:

OP( BSWAP(x), BSWAP(y) ) -> BSWAP( OP(x, y) )
OP( BSWAP(x), CONSTANT ) -> BSWAP( OP(x, BSWAP(CONSTANT) ) )

Since its just a one liner, I've also added BSWAP to the DAGCombiner equivalent as well:

fold (OP (bswap x), (bswap y)) -> (bswap (OP x, y))

Refactored bswap-fold tests to use FileCheck instead of just checking that the bswaps had gone.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223349 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 09:44:01 +00:00
Elena Demikhovsky
73ae1df82c Masked Load / Store Intrinsics - the CodeGen part.
I'm recommiting the codegen part of the patch.
The vectorizer part will be send to review again.

Masked Vector Load and Store Intrinsics.
Introduced new target-independent intrinsics in order to support masked vector loads and stores. The loop vectorizer optimizes loops containing conditional memory accesses by generating these intrinsics for existing targets AVX2 and AVX-512. The vectorizer asks the target about availability of masked vector loads and stores.
Added SDNodes for masked operations and lowering patterns for X86 code generator.
Examples:
<16 x i32> @llvm.masked.load.v16i32(i8* %addr, <16 x i32> %passthru, i32 4 /* align */, <16 x i1> %mask)
declare void @llvm.masked.store.v8f64(i8* %addr, <8 x double> %value, i32 4, <8 x i1> %mask)

Scalarizer for other targets (not AVX2/AVX-512) will be done in a separate patch.

http://reviews.llvm.org/D6191



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223348 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 09:40:44 +00:00
Hal Finkel
d70d5148a6 Restrict somewhat the memory-allocation pointer cmp opt from r223093
Based on review comments from Richard Smith, restrict this optimization from
applying to globals that might resolve lazily to other dynamically-loaded
modules, and also from dynamic allocas (which might be transformed into malloc
calls). In short, take extra care that the compared-to pointer is really
simultaneously live with the memory allocation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223347 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 09:22:28 +00:00
Jean-Daniel Dupas
9ce01153e0 Add missing test file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223346 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 09:20:13 +00:00
Yaron Keren
ba8180b436 clang-formatted ranged loops and assignment, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223344 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 08:30:39 +00:00
Jean-Daniel Dupas
206b84f324 Add mach-o LC_RPATH support to llvm-objdump
Summary: Add rpath load command support in Mach-O object and update llvm-objdump to use it.

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223343 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 07:37:02 +00:00
Michael Liao
d3c452a506 [X86] Clean up whitespace as well as minor coding style
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223339 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 05:20:33 +00:00