44407 Commits

Author SHA1 Message Date
Sanjay Patel
8253e24b39 [DAGCombiner] add (sext i1 X), 1 --> zext (not i1 X)
Besides better codegen, the motivation is to be able to canonicalize this pattern 
in IR (currently we don't) knowing that the backend is prepared for that.

This may also allow removing code for special constant cases in 
DAGCombiner::foldSelectOfConstants() that was added in D30180.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301457 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 20:26:46 +00:00
Dmitry Preobrazhensky
559cd48144 [AMDGPU][MC] Added arg checks for vmcnt, expcnt, lgkmcnt helpers
Summary of changes:
- corrected vmcnt, expcnt, lgkmcnt helpers to checks their argument for truncation;
- added saturated versions of these helpers.

See bug 32711 for details: https://bugs.llvm.org//show_bug.cgi?id=32711

Reviewers: artem.tamazov, vpykhtin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301439 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 17:55:50 +00:00
Peter Collingbourne
052412f4f5 LTO: Mark undefined module asm symbols as used.
Marking them as used causes them to be considered visible outside of LTO. This
prevents the symbols from being internalized or discarded, either by GlobalDCE
or by summary-based dead stripping in ThinLTO.

This change makes it unnecessary to add these symbols to llvm.compiler.used
in the backend, as the symbols are kept alive by virtue of being external,
so remove the backend code that handles that.

Fixes PR32798.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 17:53:39 +00:00
Sanjoy Das
263da12ab2 Reverts commit r301424, r301425 and r301426
Commits were:

"Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts"
"Add a new WeakVH value handle; NFC"
"Rename WeakVH to WeakTrackingVH; NFC"

The changes assumed pointers are 8 byte aligned on all architectures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301429 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:37:05 +00:00
Matthew Simpson
86197951a0 [LV] Handle external uses of floating-point induction variables
Reference: https://bugs.llvm.org/show_bug.cgi?id=32758
Differential Revision: https://reviews.llvm.org/D32445

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301428 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:23:02 +00:00
Sanjoy Das
a7ff6d36af Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts
Summary:
In cases where an instruction (a call site, say) is RAUW'ed with some
other value (this is possible via the `returned` attribute, amongst
other things), we want the slot in UnknownInsts to point to the
original Instruction we wanted to track, not the value it got replaced
by.

Fixes PR32587.

Reviewers: davide

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301426 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 16:21:02 +00:00
Vedant Kumar
86d385f5e5 [sampleprof] Drop test dependency on the string hash func (NFC)
The SampleProfWriter emits function information in an order determined
by the string hash function. The situation is a bit brittle, because
changing the hash function can break the tests.

Instead of sorting the function samples to get a relaible ordering (that
might be too expensive), make the tests not depend on a particular
ordering of function samples.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301419 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 15:39:53 +00:00
Dmitry Preobrazhensky
5cc9392ddb [AMDGPU][MC] Added check for truncation of SOPK imm operand
See bug 30827: https://bugs.llvm.org//show_bug.cgi?id=30827

Reviewers: artem.tamazov, vpykhtin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301418 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 15:34:19 +00:00
Sanjay Patel
c36b154061 [x86] change tests to use sext, not zext; NFC
These are intended to exercise D31944, so we need sexts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301412 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 14:35:54 +00:00
Sanjay Patel
553bcb5841 [TargetLowering] fix isConstTrueVal to account for build vector truncation
Build vectors have magical truncation powers, so we have things like this:

v4i1 = BUILD_VECTOR Constant:i32<1>, Constant:i32<1>, Constant:i32<1>, Constant:i32<1>
v4i16 = BUILD_VECTOR Constant:i32<1>, Constant:i32<1>, Constant:i32<1>, Constant:i32<1>

If we don't truncate the splat node returned by getConstantSplatNode(), then we won't find 
truth when ZeroOrNegativeOneBooleanContent is the rule.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301408 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 14:05:42 +00:00
Ranjeet Singh
d530427b4a Fix signed multiplication with overflow fallback.
For targets that don't have ISD::MULHS or ISD::SMUL_LOHI for the type
and the double width type is illegal, then the two operands are
sign extended to twice their size then multiplied to check for overflow.
The extended upper halves were mismatched causing an incorrect result.
This fixes the mismatch.

A test was added for ARM V6-M where the bug was detected.

Patch by James Duley.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301404 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 13:41:43 +00:00
Simon Pilgrim
4886bbbe71 [X86] Added pointer math zext test case (PR22970)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301401 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 13:03:00 +00:00
Simon Pilgrim
2171b73607 [X86][SSE] Add test case for repeated vector insertions of the same element (PR15298)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301396 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 12:23:32 +00:00
Filipe Cabecinhas
70c9b6a6d8 Simplify the CFG after loop pass cleanup.
Summary:
Otherwise we might end up with some empty basic blocks or
single-entry-single-exit basic blocks.

This fixes PR32085

Reviewers: chandlerc, danielcdh

Subscribers: mehdi_amini, RKSimon, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301395 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 12:02:41 +00:00
Sagar Thakur
8bc6721525 [mips] Fix test mips64fpldst.ll with machine verifier enabled
Removed micro mips register classes for gp initialization because gp initialization uses pure mips64 instruction. Even when compiling for micro mips, gp initialization can be done with pure mips64 instructions.

Reviewed by Simon Dardis
Differential: D32286


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301394 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 11:40:12 +00:00
Ayman Musa
1ebb1b7a38 [X86][SSE2] Fix asm string for movq (Move Quadword) instruction.
Replace "mov{d|q}" with "movq".

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301386 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 07:08:44 +00:00
Craig Topper
4a48147c23 [InstCombine] Add test cases for opportunities to improve knownbits handling for cttz and ctlz intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301385 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 05:59:19 +00:00
Vadzim Dambrouski
ed89889572 [MSP430] Fix PR32769: Select8 and Select16 need to have SR in Uses.
If Select pseudo instruction doesn't have use SR, then
CMP instructions are being marked as dead and later can be
removed by MachineCSE pass. This leads to incorrect code
generation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301372 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 00:33:59 +00:00
Vedant Kumar
4bfa64aac5 [gcov] Sort file info before printing it
The order in which GCOV file info is printed depends on the string hash
function. This makes some GCOV tests brittle, because the tests must be
updated whenever the hash function changes.

Sort the filenames before printing out the file info to solve the
problem. This should be relatively cheap.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301371 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 00:16:10 +00:00
Sam Clegg
d420e40a96 [WebAssembly] Allow for signed relocation addends
Summary:
Addends are used as offsets to addresses of globals
and can be both positive and negative.  This change
prints libObject in line with the spec and the MC
layer.

Subscribers: jfb, dschuff

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301369 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-26 00:02:31 +00:00
Sanjay Patel
c2cc67a772 [x86] add more tests for potential change in bool math folding; NFC
Also, use AVX2 to show a potential difference for 256-bit vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301362 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 20:56:14 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
Sanjay Patel
9ecbcab4f4 [ARM, x86] add more vector tests for bool math; NFC
I'm proposing a fold for increment-of-sexted-bool in:
https://reviews.llvm.org/D31944
...so we need to know what happens in more cases like these.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301269 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 22:42:34 +00:00
Sanjay Patel
87f63fed93 [InstSimplify] use ConstantRange to simplify more and-of-icmps
We can simplify (and (icmp X, C1), (icmp X, C2)) to one of the icmps in many cases. 
I had to check some of these with Alive to prove to myself it's right, but everything 
seems to check out. Eg, the code in instcombine was completely ignoring predicates with 
mismatched signedness.

Handling or-of-icmps would be a follow-up step.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301260 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 21:52:39 +00:00
Artem Tamazov
0410a6ed65 [AMDGPU][mc][tests][NFC] Bulk ISA tests: update for Gfx7/Gfx8, add for Gfx9.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:42:27 +00:00