Commit Graph

138565 Commits

Author SHA1 Message Date
Zachary Turner
0966627657 Fix build breakage due to typo in cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282183 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 19:21:32 +00:00
Nemanja Ivanovic
f2f9e2bcc5 [PowerPC] Sign extend sub-word values for atomic comparisons
Atomic comparison instructions use the sub-word load instruction on
Power8 and up but the value is not sign extended prior to the signed word
compare instruction. This patch adds that sign extension.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282182 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 19:06:38 +00:00
Nirav Dave
489cfe73c2 [DAG] Fix incorrect alignment of ext load.
Correctly use alignment size from loaded size not output value size.

Reviewers: jyknight, tstellarAMD, arsenm

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23356

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 17:28:43 +00:00
Sebastian Pop
7924acd64f GVN-hoist: do not dereference null pointers
there may be basic blocks without memory accesses, in which case the
list of accesses is a null pointer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282175 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 17:22:58 +00:00
Krzysztof Parzyszek
7b83fe6d98 [PPC] Set SP after loading data from stack frame, if no red zone is present
Follow-up to r280705: Make sure that the SP is only restored after all data
is loaded from the stack frame, if there is no red zone.

This completes the fix for https://llvm.org/bugs/show_bug.cgi?id=26519.

Differential Revision: https://reviews.llvm.org/D24466


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282174 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 17:22:43 +00:00
Zachary Turner
20bb0322fd Speculative fix for build failures due to consumeInteger.
A recent patch added support for consumeInteger() and made
getAsInteger delegate to this function.  A few buildbots are
failing as a result with an assertion failure.  On a hunch,
I tested what happens if I call getAsInteger() on an empty
string, and sure enough it crashes the same way that the
buildbots are crashing.

I confirmed that getAsInteger() on an empty string did not
crash before my patch, so I suspect this to be the cause.

I also added a unit test for the empty string.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282170 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 15:55:05 +00:00
Sebastian Pop
3e55f3d023 GVN-hoist: fix store past load dependence analysis (PR30216)
To hoist stores past loads, we used to search for potential
conflicting loads on the hoisting path by following a MemorySSA
def-def link from the store to be hoisted to the previous
defining memory access, and from there we followed the def-use
chains to all the uses that occur on the hoisting path. The
problem is that the def-def link may point to a store that does
not alias with the store to be hoisted, and so the loads that are
walked may not alias with the store to be hoisted, and even as in
the testcase of PR30216, the loads that may alias with the store
to be hoisted are not visited.

The current patch visits all loads on the path from the store to
be hoisted to the hoisting position and uses the alias analysis
to ask whether the store may alias the load. I was not able to
use the MemorySSA functionality to ask for whether load and
store are clobbered: I'm not sure which function to call, so I
used a call to AA->isNoAlias().

Store past store is still working as before using a MemorySSA
query: I added an extra test to pr30216.ll to make sure store
past store does not regress.

Differential Revision: https://reviews.llvm.org/D24517

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282168 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 15:33:51 +00:00
Sebastian Pop
3132c38344 GVN-hoist: fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282165 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 15:08:09 +00:00
Zachary Turner
fb27f55135 [Support] Add StringRef::consumeInteger.
StringRef::getInteger() exists and treats the entire string as
an integer of the specified radix, failing if any invalid characters
are encountered or the number overflows.

Sometimes you might have something like "123456foo" and you want
to get the number 123456 and leave the string "foo" remaining.
This is similar to what would be possible by using the standard
runtime library functions strtoul et al and specifying an end
pointer.

This patch adds consumeInteger(), which does exactly that.  It
consumes as much as possible until an invalid character is found,
and modifies the StringRef in place so that upon return only
the portion of the StringRef after the number remains.

Differential Revision: https://reviews.llvm.org/D24778

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282164 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 15:05:19 +00:00
Etienne Bergeron
3abbc4d854 [compiler-rt] fix typo in option description [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282163 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 14:57:24 +00:00
Sebastian Pop
69580509c8 GVN-hoist: move hoist testcase to GVNHoist dir
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282161 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 14:45:46 +00:00
Sebastian Pop
afaf6ad3a7 GVN-hoist: only hoist relevant scalar instructions
Without this patch, GVN-hoist would think that a branch instruction is a scalar instruction
and would try to value number it. The patch filters out all such kind of irrelevant instructions.

A bit frustrating is that there is no easy way to discard all those very infrequent instructions,
a bit like isa<TerminatorInst> that stands for a large family of instructions. I'm thinking that
checking for those very infrequent other instructions would cost us more in compilation time
than just letting those instructions getting numbered, so I'm still thinking that a simpler check:

  if (isa<TerminatorInst>(I))
    return false;

is better than listing all the other less frequent instructions.

Differential Revision: https://reviews.llvm.org/D23929

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282160 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 14:45:40 +00:00
Keith Walker
523c933b4c Reapplying r281895 (and follow-up r281964) after fixing pr30468.
The additional fix is:

When adding debug information to a lowered phi node in mem2reg
check that we have a valid insertion point after the phi for adding
the debug information.

This change addresses the issue in pr30468 where a lowered phi was
added before a catchswitch and no debug information should be added
after the phi in this case.

Differential Revision: https://reviews.llvm.org/D24797



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282155 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 14:13:25 +00:00
Tim Northover
c63e7f7506 GlobalISel: handle stack-based parameters on AArch64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282153 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 13:49:25 +00:00
Anna Thomas
4bbf4cb69b [RS4GC] Remat in presence of phi and use live value
Summary:

Reviewers:

Subscribers:

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282150 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 13:13:06 +00:00
Artem Tamazov
c228fe8466 [AMDGPU][mc] Add support for absolute expressions in DPP modifiers.
Also added range checking for DPP attributes.
Assembler tests added as well.

Differential Revision: https://reviews.llvm.org/D24755

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282145 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 11:47:21 +00:00
Nemanja Ivanovic
11508f0614 [PowerPC] Remove LE patterns matching generic stores/loads to VSX permuting ops
This patch corresponds to:
https://reviews.llvm.org/D21409

The LXVD2X, LXVW4X, STXVD2X and STXVW4X instructions permute the two doublewords
in the vector register when in little-endian mode. Custom code ensures that the
necessary swaps are inserted for these. This patch simply removes the possibilty
that a load/store node will match one of these instructions in the SDAG as that
would not insert the necessary swaps.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282144 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 10:32:03 +00:00
Nemanja Ivanovic
a941fe247e [Power9] Add exploitation of non-permuting memory ops
This patch corresponds to review:
https://reviews.llvm.org/D19825

The new lxvx/stxvx instructions do not require the swaps to line the elements
up correctly. In order to select them over the lxvd2x/lxvw4x instructions which
require swaps, the patterns for the old instruction have a predicate that
ensures they won't be selected on Power9 and newer CPUs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282143 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 09:52:19 +00:00
Sagar Thakur
5b1a39068c [EfficiencySanitizer] Using '$' instead of '#' for struct counter name
For MIPS '#' is the start of comment line. Therefore we get assembler errors if # is used in the structure names.

Differential: D24334
Reviewed by: zhaoqin


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282141 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 08:33:06 +00:00
Dorit Nuzman
f2986e2ed1 Fix revision 281960
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282139 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 07:56:23 +00:00
Craig Topper
c7cbba03a9 [AVX-512] Add support for commuting VPTERNLOG instructions.
VPTERNLOG is a ternary instruction with an immediate specifying the logical operation to perform. For each bit position in the 3 source vectors the bit from each source is concatenated together and the resulting 3-bit value is used to select a bit in the immediate. This bit value is written to the result vector.

We can commute this by swapping operands and modifying the immediate. To modify the immediate we need to swap two pairs of bits. The pairs correspond to the locations in the immediate where the commuted operands bits have opposite values and the uncommuted operand has the same value. Bits 0 and 7 will never be swapped since the relevant bits from all sources are the same value.

This refactors and reuses parts of the FMA3 commuting code which is also a three operand instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282132 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 03:00:50 +00:00
Quentin Colombet
e6b78fd6c5 [RegisterBankInfo] Move to statically allocated RegisterBank.
This commit is basically the first step toward what will
RegisterBankInfo look when it gets TableGen'ed.

It introduces a XXXGenRegisterBankInfo.def file that is what TableGen
will issue at some point. Moreover, the RegBanks field in
RegisterBankInfo changed to reflect the static (compile time) aspect of
the information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282131 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 02:10:37 +00:00
Quentin Colombet
22bb41e797 [RegisterBankInfo] Take advantage of the extra argument of SmallVector::resize.
When initializing an instance of OperandsMapper, instead of using
SmallVector::resize followed by std::fill, use the function that
directly does that in SmallVector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282130 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 02:10:32 +00:00
Kostya Serebryany
e9b850b5c5 [libFuzzer] add 'features' to the corpus elements, allow mutations with Size > MaxSize, fix sha1 in corpus stats; various refactorings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282129 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 01:34:58 +00:00
Kostya Serebryany
3f3f2cd606 [libFuzzer] one more test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282127 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22 00:57:29 +00:00
Kostya Serebryany
e4977b2b7e [libFuzzer] add stats to the corpus; more refactoring
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282121 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 22:42:17 +00:00
Zachary Turner
ecdd589ea6 =delete the StringRef(nullptr_t) constructor.
It's a guaranteed crash if you construct a StringRef with
nullptr, so might as well delete the constructor that allows
it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282116 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 22:29:36 +00:00
Kostya Serebryany
a6b3c30ea2 [libFuzzer] more refactoring; don't compute sha1sum every time we mutate a unit from the corpus, use the stored one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282115 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 21:41:48 +00:00
Kostya Serebryany
e52f15bf1a [libFuzzer] more refactoring
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282113 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 21:17:23 +00:00
Kevin Enderby
e10e0e3121 Next set of additional error checks for invalid Mach-O files for bad LC_UUID
load commands.  Added a missing check and made the check for more than
one like other other “more than one” checks.  And of course added test cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282104 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 20:03:09 +00:00
Chad Rosier
799bfde098 [LoopInterchange] Track all dependencies, not just anti dependencies.
Currently, we give up on loop interchange if we encounter a flow dependency
anywhere in the loop list. Worse yet, we don't even track output dependencies.

This patch updates the dependency matrix computation to track flow and output
dependencies in the same way we track anti dependencies.

This improves an internal workload by 2.2x.

Note the loop interchange pass is off by default and it can be enabled with
'-mllvm -enable-loopinterchange'

Differential Revision: https://reviews.llvm.org/D24564

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282101 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 19:16:47 +00:00
Teresa Johnson
b81a1e9028 [ThinLTO] Emit files for distributed builds for all modules
With the new LTO API in r278338, we stopped emitting the individual
index files and imports files for some modules in the distributed backend
case (thinlto-index-only plugin option).

Specifically, this is when the linker decides not to include a module in the
link, because it was in an archive library and did not have a strong
reference to it. Not creating the expected output files makes the
distributed build system implementation more difficult, in terms of
checking for the expected outputs of the thin link, and scheduling the
backend jobs. To address this, the gold-plugin will write dummy empty
.thinlto.bc and .imports files for modules not included in the link
(which LTO never sees).

Augmented a gold v1.12+ test, since that version of gold has the handling
for notifying on modules not being included in the link.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282100 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 19:12:05 +00:00
Davide Italiano
648d6ac61e [MIRParser] Delete dead code. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282098 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 18:26:08 +00:00
Nico Weber
5f630a9121 revert 281908 because 281909 got reverted
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282097 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 18:25:43 +00:00
Etienne Bergeron
1ff6b12017 fix typo in comment [NFC]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282091 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 17:15:23 +00:00
Arnold Schwaighofer
ad6572b3dd Disable tail calls if there is an swifterror argument
ISel does not handle them correctly yet i.e we crash trying to emit tail call
code.

radar://28407842

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 16:53:36 +00:00
Matthew Simpson
653eafda13 [LV] Don't emit unused scalars for uniform instructions
If we identify an instruction as uniform after vectorization, we know that we
should only use the value corresponding to the first vector lane of each unroll
iteration. However, when scalarizing such instructions, we still produce values
for the other vector lanes. This patch prevents us from generating the unused
scalars.

Differential Revision: https://reviews.llvm.org/D24275

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282087 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 16:50:24 +00:00
Artem Tamazov
4836a1b361 [AMDGPU][mc] Add support for ds_add_[rtn_]f32.
Lit tests added.
Resolves https://github.com/RadeonOpenCompute/hcc/issues/122.

Differential Revision: https://reviews.llvm.org/D24765

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282086 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 16:35:44 +00:00
Dehao Chen
aa30d2cf71 Change the basic block weight calculation algorithm to use max instead of voting.
Summary: Now that we have more precise debug info, we should change back to use maximum to get basic block weight.

Reviewers: dnovillo

Subscribers: andreadb, llvm-commits

Differential Revision: https://reviews.llvm.org/D24788

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282084 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 16:26:51 +00:00
Matthew Simpson
8f80e9f11f [LV] Rename "Width" to "Lane" (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282083 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 16:09:23 +00:00
Cameron McInally
3d9ce2bac8 [AVX512] Fix return types on int_x86_avx512_gatherXXX_di intrinsics
The return type should match the pass through vector type.

Differential Revision: https://reviews.llvm.org/D24744



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282081 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 16:06:10 +00:00
Hans Wennborg
a613eb13a3 Revert r281895 "Add @llvm.dbg.value entries for the phi node created by -mem2reg"
(And follow-up r281964.)

It caused PR30468.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 15:55:53 +00:00
Nico Weber
f83ecb0d7e Revert r281715, it caused PR30475
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282076 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 15:33:24 +00:00
Arnold Schwaighofer
e9993d5a21 DeadArgElim: Don't mark swifterror arguments as unused
Replacing swifterror arguments with undef creates invalid IR.

rdar://28300490

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282075 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 15:29:08 +00:00
Chad Rosier
cbe1f9e0e2 [LoopInterchange] Various cleanup. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282071 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 13:28:41 +00:00
Tim Northover
c297159d2f GlobalISel: produce correct code for signext/zeroext ABI flags.
We still don't really have an equivalent of "AssertXExt" in DAG, so we don't
exploit the guarantees on the receiving side yet, but this should produce
conservatively correct code on iOS ABIs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282069 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 12:57:45 +00:00
Tim Northover
d79f714b0b GlobalISel: pass Function to lowerFormalArguments directly (NFC).
The only implementation that exists immediately looks it up anyway, and the
information is needed to handle various parameter attributes (stored on the
function itself).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 12:57:35 +00:00
Sam Kolton
d5fca758fa [AMDGPU] Assembler: remove unused AMDGPUMCObjectWriter.
Summary: It is replaced by AMDGPUELFObjectWriter

Reviewers: tstellarAMD, vpykhtin, artem.tamazov

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl

Differential Revision: https://reviews.llvm.org/D24654

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282065 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 10:33:32 +00:00
Simon Dardis
abc7f410e9 [mips] LLVM PR/30197 - Tail call incorrectly clobbers arguments for mips
The postRA scheduler performs alias analysis to determine if stores and loads
can moved past each other. When a function has more arguments than argument
registers for the calling convention used, excess arguments are spilled onto the
stack. LLVM by default assumes that argument slots are immutable, unless the
function contains a tail call. Without the knowledge of that a function contains
a tail call site, stores and loads to fixed stack slots may be re-ordered
causing the out-going arguments to clobber the incoming arguments before the
incoming arguments are supposed to be dead.

Reviewers: vkalintiris

Differential Review: https://reviews.llvm.org/D24077



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 09:43:40 +00:00
Diana Picus
2c37c7740e Revert "AArch64: Set shift bit of TLSLE HI12 add instruction"
This reverts commit r282057 because it broke the buildbots - see e.g.
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/12063

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282058 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21 08:24:41 +00:00