summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp7
-rw-r--r--llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll8
2 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 1c2de6352fa..7be6dd02794 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -1379,13 +1379,6 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
// Canonicalize shuffle(x ,x,mask) -> shuffle(x, undef,mask')
// Canonicalize shuffle(undef,x,mask) -> shuffle(x, undef,mask').
if (LHS == RHS || isa<UndefValue>(LHS)) {
- if (isa<UndefValue>(LHS) && LHS == RHS) {
- // shuffle(undef,undef,mask) -> undef.
- Value *Result = (VWidth == LHSWidth)
- ? LHS : UndefValue::get(SVI.getType());
- return replaceInstUsesWith(SVI, Result);
- }
-
// Remap any references to RHS to use LHS.
SmallVector<Constant*, 16> Elts;
for (unsigned i = 0, e = LHSWidth; i != VWidth; ++i) {
diff --git a/llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll b/llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll
index f6969d83fce..ab1e8c1e436 100644
--- a/llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll
+++ b/llvm/test/Analysis/ConstantFolding/vector-undef-elts.ll
@@ -59,3 +59,11 @@ define <3 x float> @fadd_commute() {
ret <3 x float> %c
}
+define <4 x i32> @shuffle_of_undefs(<4 x i32> %v1, <4 x i32> %v2) {
+; CHECK-LABEL: @shuffle_of_undefs(
+; CHECK-NEXT: ret <4 x i32> undef
+;
+ %r = shufflevector <4 x i32> undef, <4 x i32> undef, <4 x i32> <i32 5, i32 1, i32 2, i32 3>
+ ret <4 x i32> %r
+}
+
OpenPOWER on IntegriCloud