diff options
author | Anna Thomas <anna@azul.com> | 2017-02-21 14:40:28 +0000 |
---|---|---|
committer | Anna Thomas <anna@azul.com> | 2017-02-21 14:40:28 +0000 |
commit | ec36f3b79a2e5c67624cae5aa2658d2caba8c990 (patch) | |
tree | b598466c93521fbb8c8c0e19a49e1e46c956c5d3 /llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | |
parent | 812f3197945c6994ba393579636639a76f2b2e9b (diff) | |
download | bcm5719-llvm-ec36f3b79a2e5c67624cae5aa2658d2caba8c990.tar.gz bcm5719-llvm-ec36f3b79a2e5c67624cae5aa2658d2caba8c990.zip |
[InstCombine] Do not exercise nested max/min pattern on abs
Summary:
This is a fix for assertion failure in
`getInverseMinMaxSelectPattern` when ABS is passed in as a select pattern.
We should not be invoking the simplification rule for
ABS(MIN(~ x,y))) or ABS(MAX(~x,y)) combinations.
Added a test case which would cause an assertion failure without the patch.
Reviewers: sanjoy, majnemer
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D30051
llvm-svn: 295719
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index b5718c3a9e0..dcfacc2e7d9 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -785,7 +785,9 @@ Instruction *InstCombiner::foldSPFofSPF(Instruction *Inner, // This transform is performance neutral if we can elide at least one xor from // the set of three operands, since we'll be tacking on an xor at the very // end. - if (IsFreeOrProfitableToInvert(A, NotA, ElidesXor) && + if (SelectPatternResult::isMinOrMax(SPF1) && + SelectPatternResult::isMinOrMax(SPF2) && + IsFreeOrProfitableToInvert(A, NotA, ElidesXor) && IsFreeOrProfitableToInvert(B, NotB, ElidesXor) && IsFreeOrProfitableToInvert(C, NotC, ElidesXor) && ElidesXor) { if (!NotA) |