OSDN Git Service

android-x86/external-llvm.git
7 years agoGarbage collect HAVE_EXECINFO_H from config.h.cmake after r300062. NFCI.
Dimitry Andric [Sun, 16 Apr 2017 17:22:44 +0000 (17:22 +0000)]
Garbage collect HAVE_EXECINFO_H from config.h.cmake after r300062. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300425 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Constants] simplify get true/false code; NFCI
Sanjay Patel [Sun, 16 Apr 2017 17:00:21 +0000 (17:00 +0000)]
[Constants] simplify get true/false code; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300424 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][X86 intrinsics]Folding cmp(sub(a,b),0) into cmp(a,b) optimization
Michael Zuckerman [Sun, 16 Apr 2017 13:26:08 +0000 (13:26 +0000)]
[X86][X86 intrinsics]Folding cmp(sub(a,b),0) into cmp(a,b) optimization

This patch adds new optimization (Folding cmp(sub(a,b),0) into cmp(a,b))
to instCombineCall pass and was written specific for X86 CMP intrinsics.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300422 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[APInt] Fix a bug in lshr by a value more than 64 bits above the bit width.
Craig Topper [Sun, 16 Apr 2017 01:03:51 +0000 (01:03 +0000)]
[APInt] Fix a bug in lshr by a value more than 64 bits above the bit width.

This was throwing an assert because we determined the intra-word shift amount by subtracting the size of the full word shift from the total shift amount. But we failed to account for the fact that we clipped the full word shifts by total words first. To fix this just calculate the intra-word shift as the remainder of dividing by bits per word.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300405 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse correct registers for "A" inline asm constraint
Dimitry Andric [Sat, 15 Apr 2017 22:15:01 +0000 (22:15 +0000)]
Use correct registers for "A" inline asm constraint

Summary:
In PR32594, inline assembly using the 'A' constraint on x86_64 causes
llvm to crash with a "Cannot select" stack trace.  This is because
`X86TargetLowering::getRegForInlineAsmConstraint` hardcodes that 'A'
means the EAX and EDX registers.

However, on x86_64 it means the RAX and RDX registers, and on 16-bit x86
(ia16?) it means the old AX and DX registers.

Add new register classes in `X86RegisterInfo.td` to support these cases,
and amend the logic in `getRegForInlineAsmConstraint` to cope with
different subtargets.  Also add a test case, derived from PR32594.

Reviewers: craig.topper, qcolombet, RKSimon, ab

Reviewed By: ab

Subscribers: ab, emaste, royger, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300404 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] allow (X != C1 && X != C2) and similar patterns to match splat vector...
Sanjay Patel [Sat, 15 Apr 2017 17:55:06 +0000 (17:55 +0000)]
[InstCombine] allow (X != C1 && X != C2) and similar patterns to match splat vector constants

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300402 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] add tests to show missing transforms for vectors; NFC
Sanjay Patel [Sat, 15 Apr 2017 17:50:45 +0000 (17:50 +0000)]
[InstCombine] add tests to show missing transforms for vectors; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300401 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTidy checking for the soft float attribute.
Eric Christopher [Sat, 15 Apr 2017 06:14:52 +0000 (06:14 +0000)]
Tidy checking for the soft float attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300394 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCache the DataLayout rather than looking it up frequently.
Eric Christopher [Sat, 15 Apr 2017 06:14:50 +0000 (06:14 +0000)]
Cache the DataLayout rather than looking it up frequently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300393 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ProfileData] Unify getInstrProf*SectionName helpers
Vedant Kumar [Sat, 15 Apr 2017 00:09:57 +0000 (00:09 +0000)]
[ProfileData] Unify getInstrProf*SectionName helpers

This is a version of D32090 that unifies all of the
`getInstrProf*SectionName` helper functions. (Note: the build failures
which D32090 would have addressed were fixed with r300352.)

We should unify these helper functions because they are hard to use in
their current form. E.g we recently introduced more helpers to fix
section naming for COFF files. This scheme doesn't totally succeed at
hiding low-level details about section naming, so we should switch to an
API that is easier to maintain.

This is not an NFC commit because it fixes llvm-cov's testing support
for COFF files (this falls out of the API change naturally). This is an
area where we lack tests -- I will see about adding one as a follow up.

Testing: check-clang, check-profile, check-llvm.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300381 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGeneralize SCEV's unit testing helper a bit
Sanjoy Das [Fri, 14 Apr 2017 23:47:53 +0000 (23:47 +0000)]
Generalize SCEV's unit testing helper a bit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300379 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] MakeAnd/Or/Xor handling to reuse previous APInt computations
Craig Topper [Fri, 14 Apr 2017 22:34:14 +0000 (22:34 +0000)]
[InstCombine] MakeAnd/Or/Xor handling to reuse previous APInt computations

When checking if we should return a constant, we create some temporary APInts to see if we know all bits. But the exact computations we do are needed in several other locations in the same code.

This patch moves them to named temporaries so we can reuse them.

Ideally we'd write directly to KnownZero/One, but we currently seem to only write those variables after all the simplifications checks and I didn't want to change that with this patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300376 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RDF] No longer ignore implicit defs or uses on any instructions
Krzysztof Parzyszek [Fri, 14 Apr 2017 21:19:17 +0000 (21:19 +0000)]
[RDF] No longer ignore implicit defs or uses on any instructions

This used to be a Hexagon-specific treatment, but is no longer needed
since it's switched to subregister liveness tracking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300369 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RDF] Correctly enumerate reg units for reg masks
Krzysztof Parzyszek [Fri, 14 Apr 2017 21:17:36 +0000 (21:17 +0000)]
[RDF] Correctly enumerate reg units for reg masks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300368 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IR] Make paramHasAttr to use arg indices instead of attr indices
Reid Kleckner [Fri, 14 Apr 2017 20:19:02 +0000 (20:19 +0000)]
[IR] Make paramHasAttr to use arg indices instead of attr indices

This avoids the confusing 'CS.paramHasAttr(ArgNo + 1, Foo)' pattern.

Previously we were testing return value attributes with index 0, so I
introduced hasReturnAttr() for that use case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300367 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] more trophies
Kostya Serebryany [Fri, 14 Apr 2017 20:11:16 +0000 (20:11 +0000)]
[libFuzzer] more trophies

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300366 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssembly] Improve readobj and nm support for wasm
Sam Clegg [Fri, 14 Apr 2017 19:50:44 +0000 (19:50 +0000)]
[WebAssembly] Improve readobj and nm support for wasm

Now that the libObect support for wasm is better we can
have readobj and nm produce more useful output too.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300365 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] (X != C1 && X != C2) --> (X | (C1 ^ C2)) != C2
Sanjay Patel [Fri, 14 Apr 2017 19:23:50 +0000 (19:23 +0000)]
[InstCombine] (X != C1 && X != C2) --> (X | (C1 ^ C2)) != C2
...when C1 differs from C2 by one bit and C1 <u C2:
http://rise4fun.com/Alive/Vuo

And move related folds to a helper function. This reduces code duplication and
will make it easier to remove the scalar-only restriction as a follow-up step.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300364 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Support folding a subtract with a constant LHS into a phi node
Craig Topper [Fri, 14 Apr 2017 19:20:12 +0000 (19:20 +0000)]
[InstCombine] Support folding a subtract with a constant LHS into a phi node

We currently only support folding a subtract into a select but not a PHI. This fixes that.

I had to fix an assumption in FoldOpIntoPhi that assumed the PHI node was always in operand 0. Now we pass it in like we do for FoldOpIntoSelect. But we still require some dancing to find the Constant when we create the BinOp or ConstantExpr. This is based code is similar to what we do for selects.

Since I touched all call sites, this also renames FoldOpIntoPhi to foldOpIntoPhi to match coding standards.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300363 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] set read_only access qualifier for pointers
Stanislav Mekhanoshin [Fri, 14 Apr 2017 19:11:40 +0000 (19:11 +0000)]
[AMDGPU] set read_only access qualifier for pointers

If a kernel's pointer argument is known to be readonly
set access qualifier accordingly. This allows RT not to
flush caches before dispatches.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300362 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Test commit] Cleanup some whitespace in a test file
Sam Clegg [Fri, 14 Apr 2017 18:43:57 +0000 (18:43 +0000)]
[Test commit] Cleanup some whitespace in a test file

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300361 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Regenerate test checks using script. NFC
Craig Topper [Fri, 14 Apr 2017 18:42:55 +0000 (18:42 +0000)]
[InstCombine] Regenerate test checks using script. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300360 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] add/move tests for and/or-of-icmps equality folds; NFC
Sanjay Patel [Fri, 14 Apr 2017 18:19:27 +0000 (18:19 +0000)]
[InstCombine] add/move tests for and/or-of-icmps equality folds; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300357 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Avoid undefined behavior in unittest by not making a named ArrayRef...
Craig Topper [Fri, 14 Apr 2017 17:59:19 +0000 (17:59 +0000)]
[ValueTracking] Avoid undefined behavior in unittest by not making a named ArrayRef from a std::initializer_list

One of the ValueTracking unittests creates a named ArrayRef initialized by a std::initializer_list. The underlying array for an std::initializer_list is only guaranteed to have a lifetime as long as the initializer_list object itself. So this can leave the ArrayRef pointing at an array that no long exists.

This fixes this to just create an explicit array instead of an ArrayRef.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300354 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Refactor SimplifyUsingDistributiveLaws to more explicitly skip code...
Craig Topper [Fri, 14 Apr 2017 17:55:41 +0000 (17:55 +0000)]
[InstCombine] Refactor SimplifyUsingDistributiveLaws to more explicitly skip code when LHS/RHS aren't BinaryOperators

Currently this code always makes 2 or 3 calls to tryFactorization regardless of whether the LHS/RHS are BinaryOperators. We make 3 calls when both operands are BinaryOperators with the same opcode. Or surprisingly, when neither are BinaryOperators. This is because getBinOpsForFactorization returns Instruction::BinaryOpsEnd when the operand is not a BinaryOperator. If both LHS and RHS are not BinaryOperators then they both have an Opcode of Instruction::BinaryOpsEnd. When this happens we rely on tryFactorization to early out due to A/B/C/D being null. Similar behavior occurs for the other calls, we rely on getBinOpsForFactorization having made A/B or C/D null to get tryFactorization to early out.

We also rely on these null checks to check the result of getIdentityValue and early out for it.

This patches refactors this to pull these checks up to SimplifyUsingDistributiveLaws so we don't rely on BinaryOpsEnd as a sentinel or this A/B/C/D null behavior. I think this makes this code easier to reason about. Should also give a tiny performance improvement for cases where the LHS or RHS isn't a BinaryOperator.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300353 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Profile] Make host tool aware of object format when quering prof section names
Xinliang David Li [Fri, 14 Apr 2017 17:48:40 +0000 (17:48 +0000)]
[Profile] Make host tool aware of object format when quering prof section names

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300352 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate tests for the patch.
Alexey Bataev [Fri, 14 Apr 2017 17:47:07 +0000 (17:47 +0000)]
Update tests for the patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300351 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse range-for in a few places
Sanjoy Das [Fri, 14 Apr 2017 17:42:12 +0000 (17:42 +0000)]
Use range-for in a few places

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300350 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRewrite SCEV Normalization using SCEVRewriteVisitor; NFC
Sanjoy Das [Fri, 14 Apr 2017 17:42:10 +0000 (17:42 +0000)]
Rewrite SCEV Normalization using SCEVRewriteVisitor; NFC

Removes all of the boilerplate, cache management etc. from
ScalarEvolutionNormalization, and keeps only the interesting bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300349 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake SCEVRewriteVisitor smarter about when it trys to create SCEVs
Sanjoy Das [Fri, 14 Apr 2017 17:42:08 +0000 (17:42 +0000)]
Make SCEVRewriteVisitor smarter about when it trys to create SCEVs

This change really saves just one foldingset lookup, but makes
SCEVRewriteVisitor "feature compatible" with the handwritten logic in
ScalarEvolutionNormalization, so that I can change
ScalarEvolutionNormalization to use SCEVRewriteVisitor in a next step.

This is a non-functional change, but _may_ improve performance in some
pathological cases, but that's unlikely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300348 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd missing #include
Sanjoy Das [Fri, 14 Apr 2017 17:25:23 +0000 (17:25 +0000)]
Add missing #include

Again, caught by the modules build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300346 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RDF] Switch RegisterAggr to a bit vector of register units
Krzysztof Parzyszek [Fri, 14 Apr 2017 17:25:13 +0000 (17:25 +0000)]
[RDF] Switch RegisterAggr to a bit vector of register units

This avoids many complications related to the complex register
aliasing schemes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300345 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[FunctionImport] assert(false) -> llvm_unreachable(). NFCI.
Davide Italiano [Fri, 14 Apr 2017 17:22:02 +0000 (17:22 +0000)]
[FunctionImport] assert(false) -> llvm_unreachable(). NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300344 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove "#if 0"ed out assert
Sanjoy Das [Fri, 14 Apr 2017 16:47:15 +0000 (16:47 +0000)]
Remove "#if 0"ed out assert

It won't compile after the recent changes I've made, and I think
keeping it in provides very little value.

Instead I've added (in an earlier commit) a C++ unit test to check the
Denormalize(Normalized(X)) == X property for specific instances of X,
which is what the assert was trying to do anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300339 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDelete some unnecessary boilerplate
Sanjoy Das [Fri, 14 Apr 2017 16:47:12 +0000 (16:47 +0000)]
Delete some unnecessary boilerplate

The PostIncTransform class was not pulling its weight, so delete it
and use free functions instead.

This also makes the use of `function_ref` more idiomatic.  We were
storing an instance of function_ref in the PostIncTransform class
before, which was fine in that specific case, but the usage after this
change is more obviously okay.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300338 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RDF] Refine propagation of reached uses in liveness computation
Krzysztof Parzyszek [Fri, 14 Apr 2017 16:33:54 +0000 (16:33 +0000)]
[RDF] Refine propagation of reached uses in liveness computation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300337 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd missing #include for STLExtras
Sanjoy Das [Fri, 14 Apr 2017 16:28:12 +0000 (16:28 +0000)]
Add missing #include for STLExtras

Looks like earlier I was relying on #include ordering in files that
used ScalarEvolutionNormalization.h.

Found thanks to the selfhost modules buildbot!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300336 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix a latent problem with interpreting live-in lane masks
Krzysztof Parzyszek [Fri, 14 Apr 2017 16:21:55 +0000 (16:21 +0000)]
[Hexagon] Fix a latent problem with interpreting live-in lane masks

A non-zero lane mask on a register with no subregister means that the
whole register is live-in. It is equivalent to a full mask.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300335 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse range for
Sanjoy Das [Fri, 14 Apr 2017 15:50:19 +0000 (15:50 +0000)]
Use range for

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300334 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSimplify PostIncTransform further; NFC
Sanjoy Das [Fri, 14 Apr 2017 15:50:07 +0000 (15:50 +0000)]
Simplify PostIncTransform further; NFC

Instead of having two ways to check if an add recurrence needs to be
normalized, just pass in one predicate to decide that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300333 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd a unit test for SCEV Normalization
Sanjoy Das [Fri, 14 Apr 2017 15:50:04 +0000 (15:50 +0000)]
Add a unit test for SCEV Normalization

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300332 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTighten the API for ScalarEvolutionNormalization
Sanjoy Das [Fri, 14 Apr 2017 15:49:59 +0000 (15:49 +0000)]
Tighten the API for ScalarEvolutionNormalization

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300331 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove NormalizeAutodetect; NFC
Sanjoy Das [Fri, 14 Apr 2017 15:49:53 +0000 (15:49 +0000)]
Remove NormalizeAutodetect; NFC

It is cleaner to have a callback based system where the logic of
whether an add recurrence is normalized or not lives on IVUsers.

This is one step in a multi-step cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300330 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Make a couple of passes compliant with -opt-bisect-limit
Krzysztof Parzyszek [Fri, 14 Apr 2017 15:26:34 +0000 (15:26 +0000)]
[Hexagon] Make a couple of passes compliant with -opt-bisect-limit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300329 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Bugpoint] Use boolean AND instead of bitwise AND (PR32660)
Simon Pilgrim [Fri, 14 Apr 2017 15:21:15 +0000 (15:21 +0000)]
[Bugpoint] Use boolean AND instead of bitwise AND (PR32660)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300327 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (LLVM)
Simon Pilgrim [Fri, 14 Apr 2017 15:05:35 +0000 (15:05 +0000)]
[X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (LLVM)

MOVNTDQA non-temporal aligned vector loads can be correctly represented using generic builtin loads, allowing us to remove the existing x86 intrinsics.

Clang companion patch: D31766.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300325 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix missing virtual destructor to silence build warning.
Nirav Dave [Fri, 14 Apr 2017 13:34:33 +0000 (13:34 +0000)]
Fix missing virtual destructor to silence build warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300322 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReorder StoreMergeCandidates to run faster. NFCI.
Nirav Dave [Fri, 14 Apr 2017 13:34:30 +0000 (13:34 +0000)]
Reorder StoreMergeCandidates to run faster. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300321 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU][MC] Corrected ds_write_src2_* to require one offset instead of two.
Dmitry Preobrazhensky [Fri, 14 Apr 2017 12:28:07 +0000 (12:28 +0000)]
[AMDGPU][MC] Corrected ds_write_src2_* to require one offset instead of two.

Fixed bug 32551: https://bugs.llvm.org//show_bug.cgi?id=32551

Reviewers: vpykhtin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300319 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU][MC] Enabled constants for src operands of s_cbranch_g_fork
Dmitry Preobrazhensky [Fri, 14 Apr 2017 11:52:26 +0000 (11:52 +0000)]
[AMDGPU][MC] Enabled constants for src operands of s_cbranch_g_fork

Fixed bug 32619: https://bugs.llvm.org//show_bug.cgi?id=32619

Reviewers: artem.tamazov, vpykhtin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300318 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix for PR#30562: Selection DAG error: Detected cycle in SelectionDAG.
Andrew V. Tischenko [Fri, 14 Apr 2017 09:17:09 +0000 (09:17 +0000)]
Fix for PR#30562: Selection DAG error: Detected cycle in SelectionDAG.
Patch by Dinar Temirbulatov

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300314 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd more test cases for StringRef::edit_distance
Alex Denisov [Fri, 14 Apr 2017 08:34:32 +0000 (08:34 +0000)]
Add more test cases for StringRef::edit_distance

Example strings taken from here: http://www.let.rug.nl/~kleiweg/lev/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300312 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoThis patch closes PR#32216: Better testing of schedule model instruction latencies...
Andrew V. Tischenko [Fri, 14 Apr 2017 07:44:23 +0000 (07:44 +0000)]
This patch closes PR#32216: Better testing of schedule model instruction latencies/throughputs.
The details are here: https://reviews.llvm.org/D30941

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300311 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LV] Remove implicit single basic block assumption
Gil Rapaport [Fri, 14 Apr 2017 07:30:23 +0000 (07:30 +0000)]
[LV] Remove implicit single basic block assumption

This patch is part of D28975's breakdown - no change in output intended.

LV's code currently assumes the vectorized loop is a single basic block up
until predicateInstructions() is called. This patch removes two manifestations
of this assumption (loop phi incoming values, dominator tree update) by
replacing the use of vectorLoopBody with the vectorized loop's latch/header.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300310 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Calculate the KnownZeros for Intrinsic::ctpop without using a tempora...
Craig Topper [Fri, 14 Apr 2017 06:43:34 +0000 (06:43 +0000)]
[ValueTracking] Calculate the KnownZeros for Intrinsic::ctpop without using a temporary APInt to count leading zeros on.

The APInt was created from an 'unsigned' and we just wanted to know how many bits the value needed to represent it. We can just use Log2_32 from MathExtras.h to get the info.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300309 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Use APInt::isNegative(). NFC
Craig Topper [Fri, 14 Apr 2017 06:43:32 +0000 (06:43 +0000)]
[ValueTracking] Use APInt::isNegative(). NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300308 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Use APInt::sext instead of zext and setBitsFrom. NFC
Craig Topper [Fri, 14 Apr 2017 06:43:29 +0000 (06:43 +0000)]
[ValueTracking] Use APInt::sext instead of zext and setBitsFrom. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300307 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Use APInt::setSignBit and APInt::isNegative(). NFC
Craig Topper [Fri, 14 Apr 2017 05:09:04 +0000 (05:09 +0000)]
[InstCombine] Use APInt::setSignBit and APInt::isNegative(). NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300305 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix test failure on windows: pass module to getInstrProfXXName calls
Xinliang David Li [Fri, 14 Apr 2017 03:03:24 +0000 (03:03 +0000)]
Fix test failure on windows: pass module to getInstrProfXXName calls

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300302 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoObject, LTO: Add target triple to irsymtab and LTO API.
Peter Collingbourne [Fri, 14 Apr 2017 02:55:06 +0000 (02:55 +0000)]
Object, LTO: Add target triple to irsymtab and LTO API.

Start using it in LLD to avoid needing to read bitcode again just to get the
target triple, and in llvm-lto2 to avoid printing symbol table information
that is inappropriate for the target.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300300 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNewGVN: Don't propagate over phi backedges where undef causes us to
Daniel Berlin [Fri, 14 Apr 2017 02:53:37 +0000 (02:53 +0000)]
NewGVN: Don't propagate over phi backedges where undef causes us to
have >1 value, unless we can prove the phi node is cycle free.

Fixes PR 32607.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300299 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse range-for; NFC
Sanjoy Das [Fri, 14 Apr 2017 01:33:15 +0000 (01:33 +0000)]
Use range-for; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300292 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse transform instead of manual loop; NFC
Sanjoy Das [Fri, 14 Apr 2017 01:33:13 +0000 (01:33 +0000)]
Use transform instead of manual loop; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300291 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLLVMCodeGen: Add ProfileData into deps corresponding to r300277.
NAKAMURA Takumi [Fri, 14 Apr 2017 00:36:06 +0000 (00:36 +0000)]
LLVMCodeGen: Add ProfileData into deps corresponding to r300277.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300289 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] added SIInstrInfo::getAddNoCarry() helper
Stanislav Mekhanoshin [Fri, 14 Apr 2017 00:33:44 +0000 (00:33 +0000)]
[AMDGPU] added SIInstrInfo::getAddNoCarry() helper

Addressed rest of post submit comments from D31993.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300288 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ORC] Re-enable the Error/Expected unit tests that were disabled in r300177.
Lang Hames [Fri, 14 Apr 2017 00:06:12 +0000 (00:06 +0000)]
[ORC] Re-enable the Error/Expected unit tests that were disabled in r300177.

The tests were failing due to an occasional deadlock in SerializationTraits
for Error: Both serializers and deserializers were protected by a single
mutex and in the unit test (where both ends of the RPC are in the same
process) one side might obtain the mutex, then block waiting for input,
leaving the other side of the connection unable to obtain the mutex to
write the data the first side was waiting for. Splitting the mutex into
two (one for serialization, one for deserialization) appears to have fixed the
issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300286 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSimplify some Verifier attribute checks with AttributeSet
Reid Kleckner [Fri, 14 Apr 2017 00:06:06 +0000 (00:06 +0000)]
Simplify some Verifier attribute checks with AttributeSet

Now that we have a type that can represent the attributes on a single
return, function, or parameter, we can pass it around directly rather
than passing around AttributeList and Idx. Removes some more one-based
argument attribute index counting.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300285 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMIRLangRef: Add a section on simplifying .mir tests
Matthias Braun [Thu, 13 Apr 2017 23:45:14 +0000 (23:45 +0000)]
MIRLangRef: Add a section on simplifying .mir tests

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300282 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:12 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300277 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Avoid partial register writes on lane 0 of BUILD_VECTOR for i8/i16/f16
Adam Nemet [Thu, 13 Apr 2017 23:32:47 +0000 (23:32 +0000)]
[AArch64] Avoid partial register writes on lane 0 of BUILD_VECTOR for i8/i16/f16

This further improves Ahmed's change in rL299482.  See the new comment for the
rationale.

The patch recovers most of the regression for bzip2 after D31965. We're down
to +2.68% from +6.97%.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300276 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU/GFX9: Do not use v_pack_b32_f16 when packing
Konstantin Zhuravlyov [Thu, 13 Apr 2017 23:17:00 +0000 (23:17 +0000)]
AMDGPU/GFX9: Do not use v_pack_b32_f16 when packing

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300275 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agobuild_llvm_package.bat: Move to VS2017
Hans Wennborg [Thu, 13 Apr 2017 23:13:23 +0000 (23:13 +0000)]
build_llvm_package.bat: Move to VS2017

It's required for building the clang-format plugin after r300225.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300273 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IR] Make getParamAttributes take argument numbers, not ArgNo+1
Reid Kleckner [Thu, 13 Apr 2017 23:12:13 +0000 (23:12 +0000)]
[IR] Make getParamAttributes take argument numbers, not ArgNo+1

Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1,
Kind) everywhere.

The fact that the AttributeList index for an argument is ArgNo+1 should
be a hidden implementation detail.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300272 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[bpf] Fix memory offset check for loads and stores
Alexei Starovoitov [Thu, 13 Apr 2017 22:24:13 +0000 (22:24 +0000)]
[bpf] Fix memory offset check for loads and stores

If the offset cannot fit into the instruction, an addition to the
pointer is emitted before the actual access. However, BPF offsets are
16-bit but LLVM considers them to be, for the matter of this check,
to be 32-bit long.

This causes the following program:

int bpf_prog1(void *ign)
{

volatile unsigned long t = 0x8983984739ull;
return *(unsigned long *)((0xffffffff8fff0002ull) + t);

}

To generate the following (wrong) code:

0: 18 01 00 00 39 47 98 83 00 00 00 00 89 00 00 00

r1 = 590618314553ll

2: 7b 1a f8 ff 00 00 00 00 *(u64 *)(r10 - 8) = r1
3: 79 a1 f8 ff 00 00 00 00 r1 = *(u64 *)(r10 - 8)
4: 79 10 02 00 00 00 00 00 r0 = *(u64 *)(r1 + 2)
5: 95 00 00 00 00 00 00 00 exit

Fix it by changing the offset check to 16-bit.

Patch by Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Differential Revision: https://reviews.llvm.org/D32055

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300269 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMIRLangRef: Simplify/update documentation
Matthias Braun [Thu, 13 Apr 2017 22:14:45 +0000 (22:14 +0000)]
MIRLangRef: Simplify/update documentation

- Refer to options by `-option` instead of `option`
- Use `-mtriple=` instead of `-march` in the example (-march will still
  target the default operating system which is usually not what you want
  in a test)
- Rephrase sentence because output does not go to stdout by default (you
  need -o - for that as should be expected).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300268 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.
Teresa Johnson [Thu, 13 Apr 2017 21:51:49 +0000 (21:51 +0000)]
[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.

The ErrorOr should not be dereferenced on the error path.

Patch by Jacob Young

Reviewers: tejohnson

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300267 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBits...
Craig Topper [Thu, 13 Apr 2017 21:49:48 +0000 (21:49 +0000)]
[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBitsSet. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300265 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake][runtimes] Use -nodefaultlibs for the runtimes build
Petr Hosek [Thu, 13 Apr 2017 21:29:03 +0000 (21:29 +0000)]
[CMake][runtimes] Use -nodefaultlibs for the runtimes build

We may not have a working C++ standard library at this point so we
shouldn't rely on it when running CMake checks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300260 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-pdbdump] Recursively dump class layout.
Zachary Turner [Thu, 13 Apr 2017 21:11:00 +0000 (21:11 +0000)]
[llvm-pdbdump] Recursively dump class layout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300258 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.
Craig Topper [Thu, 13 Apr 2017 20:39:37 +0000 (20:39 +0000)]
[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.

We call it unconditionally on the operands of the select. Then decide if its a min/max and call it on the min/max operands or on the select operands again. Either of those second calls will overwrite the results of the initial call so we can just delete the first call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300256 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LCSSA] Efficiently compute blocks dominating at least one exit.
Davide Italiano [Thu, 13 Apr 2017 20:36:59 +0000 (20:36 +0000)]
[LCSSA] Efficiently compute blocks dominating at least one exit.

For LCSSA purposes, loop BBs not dominating any of the exits aren't
interesting, as none of the values defined in these blocks can be
used outside the loop.

The way the code computed this information was by comparing each
BB of the loop with each of the exit blocks and ask the dominator tree
about their dominance relation. This is slow.

A more efficient way, implemented here, is that of starting from the
exit blocks and walking the dom upwards until we hit an header. By
transitivity, all the blocks we encounter in our path dominate an exit.

For the testcase provided in PR31851, this reduces compile time on
`opt -O2` by ~25%, going from 1m47s to 1m22s.

Thanks to Dan/MichaelZ for discussions/suggesting the approach/review.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300255 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix -Wunused-value warning
Reid Kleckner [Thu, 13 Apr 2017 20:32:58 +0000 (20:32 +0000)]
Fix -Wunused-value warning

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300254 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert accidentally-committed files in r300252.
Richard Smith [Thu, 13 Apr 2017 20:31:21 +0000 (20:31 +0000)]
Revert accidentally-committed files in r300252.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300253 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove all allocation and divisions from GreatestCommonDivisor
Richard Smith [Thu, 13 Apr 2017 20:29:59 +0000 (20:29 +0000)]
Remove all allocation and divisions from GreatestCommonDivisor

Switch from Euclid's algorithm to Stein's algorithm for computing GCD. This
avoids the (expensive) APInt division operation in favour of bit operations.
Remove all memory allocation from within the GCD loop by tweaking our `lshr`
implementation so it can operate in-place.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300252 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Fix !prof metadata preservation for invokes
Reid Kleckner [Thu, 13 Apr 2017 20:26:38 +0000 (20:26 +0000)]
[InstCombine] Fix !prof metadata preservation for invokes

Summary:
Bug noticed by inspection.

Extend the test to handle invokes as well as calls, and rewrite it to
not depend on the inliner and other passes.

Also simplify the call site replacement code with CallSite, similar to
what I did to dead arg elimination and arg promotion (rL300235 and
rL300229).

Reviewers: danielcdh, davidxl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300251 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LCSSA] Assert that we always have a valid loop.
Davide Italiano [Thu, 13 Apr 2017 20:05:37 +0000 (20:05 +0000)]
[LCSSA] Assert that we always have a valid loop.

We could otherwise add BBs not belonging to a loop in `formLCSSA`
and later crash when trying to iterate the loop blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300244 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LCSSA] Remove spurious whitespaces. NFCI.
Davide Italiano [Thu, 13 Apr 2017 20:02:27 +0000 (20:02 +0000)]
[LCSSA] Remove spurious whitespaces. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300243 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LCSSA] Use `auto` when the type is obvious. NFCI.
Davide Italiano [Thu, 13 Apr 2017 20:01:30 +0000 (20:01 +0000)]
[LCSSA] Use `auto` when the type is obvious. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300242 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAG] Fold away temporary vector in store candidate merge NFC.
Nirav Dave [Thu, 13 Apr 2017 20:00:27 +0000 (20:00 +0000)]
[DAG] Fold away temporary vector in store candidate merge NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300241 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSamplePGO: convert callsite samples map key from callsite_location to callsite_locati...
Dehao Chen [Thu, 13 Apr 2017 19:52:10 +0000 (19:52 +0000)]
SamplePGO: convert callsite samples map key from callsite_location to callsite_location+callee_name

Summary: For iterative SamplePGO, an indirect call can be speculatively promoted to multiple direct calls and get inlined. All these promoted direct calls will share the same callsite location (offset+discriminator). With the current implementation, we cannot distinguish between different promotion candidates and its inlined instance. This patch adds callee_name to the key of the callsite sample map. And added helper functions to get all inlined callee samples for a given callsite location. This helps the profile annotator promote correct targets and inline it before annotation, and ensures all indirect call targets to be annotated correctly.

Reviewers: davidxl, dnovillo

Reviewed By: davidxl

Subscribers: andreadb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300240 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Prevent a call to computeKnownBits if we already know the state of...
Craig Topper [Thu, 13 Apr 2017 19:04:45 +0000 (19:04 +0000)]
[ValueTracking] Prevent a call to computeKnownBits if we already know the state of the bit we would calculate. Also reuse a temporary APInt instead of creating a new one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300239 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LV] Fix the vector code generation for first order recurrence
Anna Thomas [Thu, 13 Apr 2017 18:59:25 +0000 (18:59 +0000)]
[LV] Fix the vector code generation for first order recurrence

Summary:
In first order recurrences where phi's are used outside the loop,
we should generate an additional vector.extract of the second last element from
the vectorized phi update.
This is because we require the phi itself (which is the value at the second last
iteration of the vector loop) and not the phi's update within the loop.
Also fix the code gen when we just unroll, but don't vectorize.
Fixes PR32396.

Reviewers: mssimpso, mkuper, anemet

Subscribers: llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300238 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] fold X == 0 || X == -1 to one compare (PR32524)
Sanjay Patel [Thu, 13 Apr 2017 18:47:06 +0000 (18:47 +0000)]
[InstCombine] fold X == 0 || X == -1 to one compare (PR32524)

This is effectively a retry of:
https://reviews.llvm.org/rL299851
but now we have tests and an assert to make sure the bug
that was exposed with that attempt will not happen again.

I'll fix the code duplication and missing sibling fold next,
but I want to make this change as small as possible to reduce
risk since I messed it up last time.

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=32524

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300236 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAE] Simplify call site replacement code with CallSite NFC
Reid Kleckner [Thu, 13 Apr 2017 18:42:03 +0000 (18:42 +0000)]
[DAE] Simplify call site replacement code with CallSite NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300235 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ValueTracking] Move a temporary APInt instead of copying it.
Craig Topper [Thu, 13 Apr 2017 18:25:53 +0000 (18:25 +0000)]
[ValueTracking] Move a temporary APInt instead of copying it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300233 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Simplify attribute code with new AttributeList::get NFC
Reid Kleckner [Thu, 13 Apr 2017 18:11:03 +0000 (18:11 +0000)]
[InstCombine] Simplify attribute code with new AttributeList::get NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300230 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ArgPromotion] Don't drop !prof metadata on promoted calls
Reid Kleckner [Thu, 13 Apr 2017 18:10:30 +0000 (18:10 +0000)]
[ArgPromotion] Don't drop !prof metadata on promoted calls

Noticed by inspection while doing attribute work. DAE, InstCombineCalls,
and ArgPromotion have a fair amount of duplicated code for hacking on
call sites, and you can find bugs by comparing them.

Add a test case for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300229 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Combine DS operations with offsets bigger than byte
Stanislav Mekhanoshin [Thu, 13 Apr 2017 17:53:07 +0000 (17:53 +0000)]
[AMDGPU] Combine DS operations with offsets bigger than byte

In many cases ds operations can be combined even if offsets do not
fit into 8 bit encoding. What it takes is to adjust base address.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300227 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[APSInt] Remove named And/Or/Xor methods.
Craig Topper [Thu, 13 Apr 2017 17:39:46 +0000 (17:39 +0000)]
[APSInt] Remove named And/Or/Xor methods.

No one uses them and I may improve the operator&, operator|, and operator^ to better reuse memory allocations like APInt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300224 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] use similar ops for related folds; NFCI
Sanjay Patel [Thu, 13 Apr 2017 17:36:24 +0000 (17:36 +0000)]
[InstCombine] use similar ops for related folds; NFCI

It's less efficient to produce 'ule' than 'ult' since we know we're going to
canonicalize to 'ult', but we shouldn't have duplicated code for these folds.

As a trade-off, this was a pretty terrible way to make a '2'. :)
       if (LHSC == SubOne(RHSC))
         AddC = ConstantExpr::getSub(AddOne(RHSC), LHSC);

The next steps are to share the code to fix PR32524 and add the missing 'and'
fold that was left out when PR14708 was fixed:
https://bugs.llvm.org/show_bug.cgi?id=14708

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300222 91177308-0d34-0410-b5e6-96231b3b80d8