Commit Graph

145903 Commits

Author SHA1 Message Date
Hans Wennborg
b03535ccf2 Revert r296366 "[InlineFunction] add nonnull assumptions based on argument attributes"
It causes miscompiles e.g. during self-host of Clang (PR32082).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296398 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:33:02 +00:00
Zachary Turner
533bd5a785 Add missing namespace qualifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296397 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:17:50 +00:00
Matt Arsenault
27f4f2f4bc AMDGPU: Support v2i16/v2f16 packed operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296396 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:15:25 +00:00
Arnold Schwaighofer
e4e218c802 ISel: We need to notify FastIS of the IMPLICIT_DEF we created in createSwiftErrorEntriesInEntryBlock
Otherwise, it will insert instructions before it.

rdar://30536186

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296395 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:12:06 +00:00
Zachary Turner
2219387eaf [PDB] Partial resubmit of r296215, which improved PDB Stream Library.
This was reverted because it was breaking some builds, and
because of incorrect error code usage.  Since the CL was
large and contained many different things, I'm resubmitting
it in pieces.

This portion is NFC, and consists of:

1) Renaming classes to follow a consistent naming convention.
2) Fixing the const-ness of the interface methods.
3) Adding detailed doxygen comments.
4) Fixing a few instances of passing `const BinaryStream& X`.  These
   are now passed as `BinaryStreamRef X`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296394 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:11:43 +00:00
Matt Arsenault
68c622048b Revert "DAG: Check if extract_vector_elt is legal or custom"
This reverts r295782. This could potentially result in some
legalization loops and I avoided the need for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296393 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:59:07 +00:00
Xin Tong
5784902db5 Empty line. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296392 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:51:48 +00:00
Rong Xu
676fd3131a [PGO] Fix a bug in reading text format value profile.
Summary: Should use the Valuekind read from the profile.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits, xur

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:42:39 +00:00
Sanjay Patel
2c5b9e376b [ARM] don't transform an add(ext Cond), C to select unless there's a setcc of the condition
The transform in question claims to be doing:

// fold (add (select cc, 0, c), x) -> (select cc, x, (add, x, c))

...starting in PerformADDCombineWithOperands(), but it wasn't actually checking for a setcc node
for the sext/zext patterns.

This is exactly the opposite of a transform I'd like to add to DAGCombiner's foldSelectOfConstants(),
so I was seeing infinite loops with my draft of a patch applied.

The changes in select_const.ll look positive (less instructions). The change in arm-and-tst-peephole.ll
is unrelated. We're changing the input IR in that test to preserve the intent of the test, but that's 
not affected by this code change.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296389 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:30:54 +00:00
Lang Hames
530cc1a7c8 [Support][Error] Add a 'cantFail' utility function for known-safe calls to
fallible functions.

Some fallible functions (those returning Error or Expected<T>) may only fail
for a subset of their inputs. For example, a "safe" square root function will
succeed for all finite positive inputs:

  Expected<double> safeSqrt(double d) {
    if (d < 0 && !isnan(d) && !isinf(d))
      return make_error<...>("Cannot sqrt -ve values, nans or infs");
    return sqrt(d);
  }

At a safe callsite for such a function, checking the error return value is
redundant:

  if (auto ValOrErr = safeSqrt(42.0)) {
    // use *ValOrErr.
  } else
    llvm_unreachable("safeSqrt should always succeed for +ve values");

The cantFail function wraps this check and extracts the contained value,
simplifying control flow:

  double Result = cantFail(safeSqrt(42.0));

This function should be used with care: it is a programmatic error to wrap a
call with cantFail if it can in fact fail. For debug builds this will
result in llvm_unreachable being called. For release builds the behavior is
undefined.

Use of this function is likely to be rare in library code, but more common
for tool and unit-test code where inputs and mock functions may be known to be
safe.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:09:47 +00:00
Matt Arsenault
563a987b91 AMDGPU: Add some of the new gfx9 VOP3 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296382 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:04:41 +00:00
Simon Pilgrim
e9bce87a93 [X86][SSE] Attempt to extract vector elements through target shuffles
DAGCombiner already supports peeking thorough shuffles to improve vector element extraction, but legalization often leaves us in situations where we need to extract vector elements after shuffles have already been lowered.

This patch adds support for VECTOR_EXTRACT_ELEMENT/PEXTRW/PEXTRB instructions to attempt to handle target shuffles as well. I've covered some basic scenarios including handling shuffle mask scaling and the implicit zero-extension of PEXTRW/PEXTRB, there is more that could be done here (that I've mentioned in TODOs) but I haven't found many cases where its worth it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296381 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 21:01:57 +00:00
Matt Arsenault
a4e4156e12 AMDGPU: Support inlineasm for packed instructions
Add packed types as legal so they may be used with inlineasm.
Keep all operations expanded for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 20:52:10 +00:00
Alexey Bataev
5c641cd1c6 [SLP] Use different flags in tests for reduction ops and extra args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296376 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 20:22:44 +00:00
Matt Arsenault
132ab30572 AMDGPU: Don't fold immediate if clamp/omod are set
Doesn't fix any practical problems because clamp/omod
are currently folded after peephole optimizer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296375 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 20:21:31 +00:00
Matt Arsenault
dd23defd5c AMDGPU: Fold omod into instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296372 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 19:35:42 +00:00
Taewook Oh
6a73128f15 [TailDuplicator] Maintain DebugLoc for branch instructions
Summary: Existing implementation of duplicateSimpleBB function drops DebugLoc metadata of branch instructions during the transformation. This patch addresses this issue by making newly created branch instructions to keep the metadata of replaced branch instructions.

Reviewers: qcolombet, craig.topper, aprantl, MatzeB, sanjoy, dblaikie

Reviewed By: dblaikie

Subscribers: dblaikie, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296371 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 19:30:01 +00:00
Matt Arsenault
29df731fe5 AMDGPU: Add f16 to shader calling conventions
Mostly useful for writing tests for f16 features.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296370 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 19:24:47 +00:00
Alexey Bataev
724703a79a [SLP] Modify test to check IR flags propagation for extra args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296369 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 19:16:09 +00:00
Matt Arsenault
87fd70245a AMDGPU: Add VOP3P instruction format
Add a few non-VOP3P but instructions related to packed.

Includes hack with dummy operands for the benefit of the assembler

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296368 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 18:49:11 +00:00
Amaury Sechet
6cc2c9efb9 Refactor xaluo.ll and xmulo.ll tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296367 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 18:32:54 +00:00
Sanjay Patel
8a5552eaac [InlineFunction] add nonnull assumptions based on argument attributes
This was suggested in D27855: have the inliner add assumptions, so we don't 
lose nonnull info provided by argument attributes.

This still doesn't solve PR28430 (dyn_cast), but this gets us closer.

https://reviews.llvm.org/D29999


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296366 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 18:13:48 +00:00
Krzysztof Parzyszek
6b5b29ed7d [Hexagon] Defs and clobbers can overlap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 18:03:35 +00:00
Xin Tong
2122edebb8 Fix a bug when unswitching on partial LIV for SwitchInst
Summary: Fix a bug when unswitching on partial LIV for SwitchInst.

Reviewers: hfinkel, efriedma, sanjoy

Reviewed By: sanjoy

Subscribers: david2050, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296363 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 18:00:13 +00:00
Rong Xu
8c896211a1 Fix comments. NFC.
Change "Thin-LTO" to "ThinLTO" in the comments for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296362 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 17:59:01 +00:00
Steven Wu
2b63dffde5 Fix LLVM module build
Add WasmRelocs/WebAssembly.def to textual include header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296356 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 16:56:37 +00:00
Craig Topper
6ebb4a91d5 [X86] Use APInt instead of SmallBitVector tracking undef elements from getTargetConstantBitsFromNode and getConstVector.
Summary:
SmallBitVector uses a malloc for more than 58 bits on a 64-bit target and more than 27 bits on a 32-bit target. Some of the vector types we deal with here use more than those number of elements and therefore cause a malloc.

APInt on the other hand supports up to 64 bits without a malloc. That's the maximum number of bits we need here so we can avoid a malloc for all cases by using APInt.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296355 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 16:15:32 +00:00
Craig Topper
b84e77adb3 [X86] Use APInt instead of SmallBitVector for tracking Zeroable elements in shuffle lowering
Summary:
SmallBitVector uses a malloc for more than 58 bits on a 64-bit target and more than 27 bits on a 32-bit target. Some of the vector types we deal with here use more than those number of elements and therefore cause a malloc.

APInt on the other hand supports up to 64 bits without a malloc. That's the maximum number of bits we need here so we can avoid a malloc for all cases by using APInt.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296354 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 16:15:30 +00:00
Craig Topper
72dbe0cc0e [X86] Fix SmallVector sizes in constant pool shuffle decoding to avoid heap allocation
Some of the vectors are under sized to avoid heap allocation. In one case the vector was oversized.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296353 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 16:15:27 +00:00
Craig Topper
4b7fe0758a [X86] Use APInt instead of SmallBitVector for tracking undef elements in constant pool shuffle decoding
Summary:
SmallBitVector uses a malloc for more than 58 bits on a 64-bit target and more than 27 bits on a 32-bit target. Some of the vector types we deal with here use more than those number of elements and therefore cause a malloc.

APInt on the other hand supports up to 64 bits without a malloc. That's the maximum number of bits we need here so we can avoid a malloc for all cases by using APInt. This will incur a minor increase in stack usage due to APInt storing the bit count separately from the data bits unlike SmallBitVector, but that should be ok.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296352 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 16:15:25 +00:00
Amaury Sechet
71bb1882b1 Remove an empty line in icmp-illegal.ll . NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296350 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 16:09:44 +00:00
Alexey Bataev
d222965b6b [SLP] A test for a fix of PR32038.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296349 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 16:07:10 +00:00
Artur Pilipenko
7e587ddfd9 Loop predication expand both sides of the widened condition
This is a fix for a loop predication bug which resulted in malformed IR generation.

Loop invariant side of the widened condition is not guaranteed to be available in the preheader as is, so we need to expand it as well. See added unsigned_loop_0_to_n_hoist_length test for example.

Reviewed By: sanjoy, mkazantsev

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296345 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 15:44:49 +00:00
Sjoerd Meijer
c0dc1a30a6 AArch64InstPrinter: rewrite of printSysAlias
This is a cleanup/rewrite of the printSysAlias function. This was not using the
tablegen instruction descriptions, but was "manually" decoding the
instructions. This has been replaced with calls to lookup_XYZ_ByEncoding
tablegen calls.

This revealed several problems. First, instruction IVAU had the wrong encoding.
This was cancelled out by the parser that incorrectly matched the wrong
encoding. Second, instruction CVAP was missing from the SystemOperands tablegen
descriptions, so this has been added. And third, the required target features
were not captured in the tablegen descriptions, so support for this has also
been added.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296343 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 14:45:34 +00:00
John Brawn
4042b8120e [ARM] LSL #0 is an alias of MOV
Currently we handle this correctly in arm, but in thumb we don't which leads to
an unpredictable instruction being emitted for LSL #0 in an IT block and SP not
being permitted in some cases when it should be.

For the thumb2 LSL we can handle this by making LSL #0 an alias of MOV in the
.td file, but for thumb1 we need to handle it in checkTargetMatchPredicate to
get the IT handling right. We also need to adjust the handling of
MOV rd, rn, LSL #0 to avoid generating the 16-bit encoding in an IT block. We
should also adjust it to allow SP in the same way that it is allowed in
MOV rd, rn, but I haven't done that here because it looks like it would take
quite a lot of work to get right.

Additionally correct the selection of the 16-bit shift instructions in
processInstruction, where it was checking if the two registers were equal when
it should have been checking if they were low. It appears that previously this
code was never executed and the 16-bit encoding was selected by default, but
the other changes I've done here have somehow made it start being used.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296342 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 14:40:51 +00:00
Artur Pilipenko
85f508cd9d [DAGCombine] Fix for a load combine bug with non-zero offset patterns on BE targets
This pattern is essentially a i16 load from p+1 address:

  %p1.i16 = bitcast i8* %p to i16*
  %p2.i8 = getelementptr i8, i8* %p, i64 2
  %v1 = load i16, i16* %p1.i16
  %v2.i8 = load i8, i8* %p2.i8
  %v2 = zext i8 %v2.i8 to i16
  %v1.shl = shl i16 %v1, 8
  %res = or i16 %v1.shl, %v2

Current implementation would identify %v1 load as the first byte load and would mistakenly emit a i16 load from %p1.i16 address. This patch adds a check that the first byte is loaded from a non-zero offset of the first load address. This way this address can be used as the base address for the combined value. Otherwise just give up combining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296336 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 13:04:23 +00:00
Artur Pilipenko
f85432589b [DAGCombine] NFC. MatchLoadCombine extract MemoryByteOffset lambda helper
This refactoring will simplify the upcoming change to fix the bug in folding patterns with non-zero offsets on BE targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296332 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 11:42:54 +00:00
Artur Pilipenko
0003ac947f [DAGCombine] NFC. MatchLoadCombine remember the first byte provider, not the load node
This refactoring will simplify the upcoming change to fix a bug in folding patterns with non-zero offsets on BE targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296331 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 11:40:14 +00:00
Sjoerd Meijer
b9ae988ece AArch64AsmParser: don't try to parse “[1]” for non-vector register operands
There are no instructions that have "[1]" as part of the assembly string;
FMOVXDhighr is out of date. This removes dead code.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296327 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 10:51:11 +00:00
Konstantin Zhuravlyov
9995ddddac [AMDGPU] Runtime metadata fixes:
- Verify that runtime metadata is actually valid runtime metadata when assembling, otherwise we could accept the following when assembling, but ocl runtime will reject it:
    .amdgpu_runtime_metadata
    { amd.MDVersion: [ 2, 1 ], amd.RandomUnknownKey, amd.IsaInfo: ...
  - Make IsaInfo optional, and always emit it.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296324 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 07:55:17 +00:00
Brian Cain
f54e7aac32 llvm-mc-fuzzer: add support for assembly
This creates an llvm-mc-disassemble-fuzzer from the existing llvm-mc-fuzzer
and finishing the assemble support in llvm-mc-assemble-fuzzer.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296323 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 06:22:17 +00:00
Craig Topper
34270516e1 [APInt] Use UINT64_MAX instead of ~integerPart(0). NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 06:05:33 +00:00
Craig Topper
08d480dc77 [X86] Check for less than 0 rather than explicit compare with -1. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296321 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 06:05:30 +00:00
Amaury Sechet
df8980ea70 Do full codegen for various tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296305 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 01:15:57 +00:00
Craig Topper
f9be4a2c06 [APInt] Use UINT64_MAX instead of ~uint64_t(0ULL). NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296301 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-26 21:15:18 +00:00
Craig Topper
e87a9a6253 [APInt] Use UINT64_MAX instead of ~0ULL. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296300 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-26 19:28:48 +00:00
Craig Topper
d1973fd95b [APInt] Remove unnecessary early out from getLowBitsSet. The same case is handled equally well by the next check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296299 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-26 19:28:45 +00:00
Xin Tong
e76fd06806 Update comments. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296298 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-26 19:08:44 +00:00
Daniel Jasper
e5e8f2aec1 Revert "[CGP] Split some critical edges coming out of indirect branches"
This reverts commit r296149 as it leads to crashes when compiling for
PPC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296295 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-26 11:09:12 +00:00
Davide Italiano
1aaf55cfbf [LoopDeletion] Modernize and simplify a bit. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296294 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-26 07:08:20 +00:00