Commit Graph

148364 Commits

Author SHA1 Message Date
Konstantin Zhuravlyov
c75cdfc65b AMDGPU: Fix ValueKind code object metadata for images
Differential Revision: https://reviews.llvm.org/D32504


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301360 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 20:38:26 +00:00
Sanjay Patel
bdf98d2542 [x86] regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301359 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 20:30:08 +00:00
Zachary Turner
5cec42afa4 [llvm-pdbdump] Allow sorting / filtering by immediate padding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301358 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 20:22:29 +00:00
Zachary Turner
a3ca9305b0 [llvm-pdbdump] Dump File / Line Info to YAML.
We were already parsing and dumping this to the human readable
format, but not to the YAML format.  This does so, in preparation
for reading it in and reconstructing the line information from
YAML.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301357 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 20:22:02 +00:00
Zachary Turner
3995e3e914 [StringExtras] Add a fromHex to complement toHex.
We already have a function toHex that will convert a string like
"\xFF\xFF" to the string "FFFF", but we do not have one that goes
the other way - i.e. to convert a textual string representing a
sequence of hexadecimal characters into the corresponding actual
bytes.  This patch adds such a function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 20:21:35 +00:00
Matthias Braun
953d6af0d1 SimplifyLibCalls: Fix crash on memset(notmalloc())
rdar://31520787

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301352 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 19:44:25 +00:00
Adrian Prantl
6ec3ecc68b Fix an assertion when skipping stack values in DWARF2 mode.
The fix consists of resetting LocationKind when addMachineRegExpression fails.

rdar://problem/31803010

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301351 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 19:40:53 +00:00
Petr Hosek
10cfd77597 [llvm-objdump] Don't attempt to print lines beyond the end of file
This may trigger a segfault in llvm-objdump when the line number stored
in debug infromation points beyond the end of file; lines in LineBuffer
are stored in std::vector which is allocated in chunks, so even if the
debug info points beyond the end of the file, this doesn't necessarily
trigger the segfault unless the line number points beyond the allocated
space.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 18:56:33 +00:00
Krzysztof Parzyszek
510dc244fe [Hexagon] Only increment debug counters if debug option is present
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301346 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 18:56:14 +00:00
Gil Rapaport
52d55b49a8 [LV] Make LIT test insensitive to basic block numbering
This patch is part of D28975's breakdown.

induction.ll encodes the specific (and rather arbitrary) numbers given to
predicated basic blocks by the unique naming mechanism, which makes it
sensitive to changes in LV's instruction generation order. This patch replaces
those specific numbers with a numeric pattern.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301345 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 18:14:24 +00:00
Stanislav Mekhanoshin
dff33b262e Skip bitcasts while looking for GEP in LoadStoreVectorizer
Differential Revisison: https://reviews.llvm.org/D32101

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301343 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 18:00:08 +00:00
Simon Pilgrim
410317e973 [X86][AVX2] Add shuffle test for PR27320 showing current codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301342 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 18:00:04 +00:00
Craig Topper
4b3dea8edf [InstCombine] Remove redundant code from SimplifyUsingDistributiveLaws
The code I've removed here exists in ExpandBinOp in InstSimplify which we call into before SimplifyUsingDistributiveLaws. The code in InstSimplify looks to have been copied from here.

I verified this code doesn't fire on any lit tests. Not that that proves its definitely dead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301341 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:54:12 +00:00
Craig Topper
21db70eaca [APInt] Use isSubsetOf, intersects, and bit counting methods to reduce temporary APInts
This patch uses various APInt methods to reduce temporary APInt creation.

This should be all of the unrelated cleanups that got buried in D32376(creating a KnownBits struct) as well as some pointed out by Simon during the review of that. Plus a few improvements to use counting instead of masking.

I've left out any places where we do something like (KnownZero & KnownOne) != 0 as I plan to add a helper method to KnownBits to ask that question and didn't want to thrash that code an additional time.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301338 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:46:30 +00:00
Craig Topper
4c75072695 [InstCombine] Fix CHECK-LABEL in two tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301337 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:40:58 +00:00
Simon Pilgrim
0000cef63b [X86][SSE] Add tests for PR14657 showing current codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301334 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:22:34 +00:00
Adrian Prantl
f88c05494c Print complete DIExpressions in the assembler output DEBUG_VALUE comments.
The previous code was complex, incorrect, and couldn't print everything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301333 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:22:09 +00:00
Sam Clegg
178cf77a73 [WebAssembly] Fix relocation count in wasm binaries with call_indirect
Subscribers: jfb, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301331 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:13:23 +00:00
Sam Clegg
2854ea835f [WebAssembly] Read global index in init expression as LEB
Subscribers: jfb, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301330 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:11:56 +00:00
Craig Topper
b3518390c1 [InstSimplify] Handle (~A & ~B) | (~A ^ B) -> ~A ^ B
The code Sanjay Patel moved over from InstCombine doesn't work properly if the 'and' has both inputs as nots because we used a commuted op matcher on the 'and' first. But this will bind to the first 'not' on 'and' when there could be two 'not's. InstCombine could rely on DeMorgan to ensure the 'and' wouldn't have two 'not's eventually, but InstSimplify can't rely on that.

This patch matches the xor first then checks for the ands and allows a not of either operand of the xor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301329 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 17:01:32 +00:00
Davide Italiano
41042eb456 [PM] Run IndirectCallPromotion only when PGO is enabled.
Differential Revision:  https://reviews.llvm.org/D32465

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301327 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:54:45 +00:00
Craig Topper
65c40b4fba [InstCombine] Remove superfluous curly braces around a single line if body. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301326 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:48:19 +00:00
Craig Topper
c4708bac0e [ValueTracking] Use APInt::operator|=(uint64_t) instead of creating a temporary APInt. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301325 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:48:14 +00:00
Craig Topper
a14d021e5a [ValueTracking] Use APInt instead of auto. NFC
This is a pre-commit for a patch I'm working on to turn KnownZero/One into a struct. Once I do that the type here will be less obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301324 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:48:09 +00:00
Craig Topper
0a2cedfdb9 [ValueTracking] Use BitWidth local variable instead of re-reading it from KnownZero. NFC
This is a pre-commit for a patch that I'm working on to merge KnownZero/KnownOne into a KnownBits struct which would have had to touch this line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301323 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:48:03 +00:00
Simon Pilgrim
ea5eba046b [SelectionDAG] Added getBuildVector(ArrayRef<SDUse>) helper.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:41:28 +00:00
Simon Pilgrim
21b590cebc [DAGCombiner] Refactor to make it easy to add support for vectors in a future patch. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301320 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 16:16:03 +00:00
Andrew Ng
d8be4bf95c Resubmit r301309: [DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler.
This patch reapplies r301309 with the fix to the MIR test to fix the assertion
triggered by r301309. Had trimmed a little bit too much from the MIR!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301317 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 15:39:57 +00:00
Craig Topper
1276764736 [InstCombine] Add missing commute handling to (A | B) & (B ^ (~A)) -> (A & B)
The matching here wasn't able to handle all the possible commutes. It always assumed the not would be on the left of the xor, but that's not guaranteed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301316 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 15:19:04 +00:00
Simon Pilgrim
05711fea06 [SelectionDAG] Use getBuildVector helper where possible. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301314 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 15:10:47 +00:00
Dylan McKay
0226ba2373 [AVR] Support the LDWRdPtr instruction with the same Src+Dst register
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301313 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 15:09:04 +00:00
Andrew Ng
e9fd8c5001 Revert "[DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler."
This reverts commit r301309 which is causing buildbot assertion failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301312 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 14:36:01 +00:00
Daniel Sanders
ac1a2173c6 Bring back the ability opt out of padding zero-byte functions by not providing a nop instruction.
Summary: No test case since I'm not aware of an in-tree target that needs this.

Reviewers: hans

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301311 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 14:27:27 +00:00
Andrew Ng
7198047ec4 [DebugInfo][X86] Fix handling of DBG_VALUE's in post-RA scheduler.
This patch fixes a bug with the updating of DBG_VALUE's in
BreakAntiDependencies. Previously, it would only attempt to update the first
DBG_VALUE following the instruction whose register is being changed,
potentially leaving DBG_VALUE's referring to the wrong register. Now the code
will update all DBG_VALUE's that immediately follow the instruction.

This issue was detected as a result of an optimized codegen difference with
"-g" where an X86 byte/word fixup was not performed due to a DBG_VALUE
referencing the wrong register.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301309 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 13:39:49 +00:00
Simon Pilgrim
70ad9d96e1 [SelectionDAG] Pull out repeated getValueType calls. NFCI.
Noticed in D32391.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301308 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 13:39:07 +00:00
Simon Pilgrim
cda4399247 [DAGCombiner] Add vector support for (srl (trunc (srl x, c1)), c2) combine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301305 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 12:40:45 +00:00
Andrew Ng
055a715ed6 [SimplifyLibCalls] Fix infinite loop with fast-math optimization.
One of the fast-math optimizations is to replace calls to standard double
functions with their float equivalents, e.g. exp -> expf. However, this can
cause infinite loops for the following:

  float expf(float val) { return (float) exp((double) val); }

A similar inline declaration exists in the MinGW-w64 math.h header file which
when compiled with -O2/3 and fast-math generates infinite loops.

So this fix checks that the calling function to the standard double function
that is being replaced does not match the float equivalent.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301304 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 12:36:14 +00:00
Simon Pilgrim
5c072c6410 [SelectionDAG] Recognise splat vector isKnownToBeAPowerOfTwo one/sign bit shift cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301303 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 12:29:07 +00:00
Simon Pilgrim
1ef6a945eb [DAGCombiner] Use SDValue::getConstantOperandVal helper where possible. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301300 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 10:47:35 +00:00
Sanjoy Das
390033473c [IVUsers] Don't bail out of normalizing non-affine add recs
Summary:
In a previous change I changed SCEV's normalization / denormalization
to work with non-affine add recs.  So the bailout in IVUsers can be
removed.

Reviewers: atrick, efriedma

Reviewed By: atrick

Subscribers: davide, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301298 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:53:25 +00:00
Craig Topper
3c9711dbf2 [InstCombine] Add test cases for missing commute handling in ((A ^ C) ^ B) & (B ^ A) -> (B ^ A) & ~C
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301297 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:47:49 +00:00
Craig Topper
17d26f1cbf [InstCombine] Add test cases showing failures to handle commuted patterns after tricking the operand complexity sorting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301296 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:22:17 +00:00
Craig Topper
0e5fc34d70 [InstCombine] Use commutable matchers to reduce some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301294 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:02:11 +00:00
Gil Rapaport
e9d7fd8bfe [LV] Remove redundant basic block split
This patch is part of D28975's breakdown.

Genreating the control-flow to guard predicated instructions modified to
only use SplitBlockAndInsertIfThen() for producing the if-then construct.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301293 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 05:57:22 +00:00
Serge Guelton
42e83493f6 Update doc of the variadic version of getOrInsertFunction
It no longer needs a null terminator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301292 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 05:45:37 +00:00
Xinliang David Li
844c74b49d [CodeExtractor]: Fixup use refs of the old phi.
Differential Revision: http://reviews.llvm.org/D32468


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301291 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 04:51:19 +00:00
Akira Hatanaka
b86291cfa7 [ObjCARC] Do not sink an objc_retain past a clang.arc.use.
We need to do this to prevent a miscompile which sinks an objc_retain
past an objc_release that releases the object objc_retain retains. This
happens because the top-down and bottom-up traversals each determines
the insert point for retain or release individually without knowing
where the other instruction is moved.

For example, when the following IR is fed to the ARC optimizer, the
top-down traversal decides to insert objc_retain right before
objc_release and the bottom-up traversal decides to insert objc_release
right after clang.arc.use.

(IR before ARC optimizer)
%11 = call i8* @objc_retain(i8* %10)
call void (...) @clang.arc.use(%0* %5)
call void @llvm.dbg.value(...)
call void @objc_release(i8* %6)

This reverses the order of objc_release and objc_retain, which causes
the object to be destructed prematurely.

(IR after ARC optimizer)
call void (...) @clang.arc.use(%0* %5)
call void @objc_release(i8* %6)
call void @llvm.dbg.value(...)
%11 = call i8* @objc_retain(i8* %10)

rdar://problem/30530580

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301289 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 04:06:35 +00:00
Davide Italiano
3c385a613b [SimplifyLibCalls] Remove a cl::opt that's been true for a long time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301288 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 03:48:47 +00:00
Sanjoy Das
79b9222927 Teach SCEV normalization to de/normalize non-affine add recs
Summary:
Before this change, SCEV Normalization would incorrectly normalize
non-affine add recurrences.  To work around this there was (still is)
a check in place to make sure we only tried to normalize affine add
recurrences.

We recently found a bug in aforementioned check to bail out of
normalizing non-affine add recurrences.  However, instead of fixing
the bailout, I have decided to teach SCEV normalization to work
correctly with non-affine add recurrences, making the bailout
unnecessary (I'll remove it in a subsequent change).

I've also added some unit tests (which would have failed before this
change).

Reviewers: atrick, sunfish, efriedma

Reviewed By: atrick

Subscribers: mcrosier, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301281 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 00:09:19 +00:00
Matt Arsenault
d9abaa1e08 InferAddressSpaces: Use reference arguments instead of pointers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 23:42:41 +00:00