summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-04-12 18:39:53 +0000
committerSanjay Patel <spatel@rotateright.com>2017-04-12 18:39:53 +0000
commit6e410189421190343a742c8e7513ef10f53fc0f0 (patch)
tree95e8d79fd710bb1f6fcbfde00445e0b668a91e06 /llvm/lib/Transforms/InstCombine
parent8b459c24f34c6772bd637090b118859b154d5da3 (diff)
downloadbcm5719-llvm-6e410189421190343a742c8e7513ef10f53fc0f0.tar.gz
bcm5719-llvm-6e410189421190343a742c8e7513ef10f53fc0f0.zip
[InstCombine] fix wrong undef handling when converting select to shuffle
As discussed in: https://bugs.llvm.org/show_bug.cgi?id=32486 ...the canonicalization of vector select to shufflevector does not hold up when undef elements are present in the condition vector. Try to make the undef handling clear in the code and the LangRef. Differential Revision: https://reviews.llvm.org/D31980 llvm-svn: 300092
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 84dace5db76..b7099bec380 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -1053,8 +1053,10 @@ static Instruction *canonicalizeSelectToShuffle(SelectInst &SI) {
// If the select condition element is false, choose from the 2nd vector.
Mask.push_back(ConstantInt::get(Int32Ty, i + NumElts));
} else if (isa<UndefValue>(Elt)) {
- // If the select condition element is undef, the shuffle mask is undef.
- Mask.push_back(UndefValue::get(Int32Ty));
+ // Undef in a select condition (choose one of the operands) does not mean
+ // the same thing as undef in a shuffle mask (any value is acceptable), so
+ // give up.
+ return nullptr;
} else {
// Bail out on a constant expression.
return nullptr;
OpenPOWER on IntegriCloud