Fix a shufflevector instcombine that was emitting invalid masks indices
when it meant to be emitting undef indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54417 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 3a74c7f..eebb7cf 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11259,11 +11259,13 @@
Elts.push_back(UndefValue::get(Type::Int32Ty));
else {
if ((Mask[i] >= e && isa<UndefValue>(RHS)) ||
- (Mask[i] < e && isa<UndefValue>(LHS)))
+ (Mask[i] < e && isa<UndefValue>(LHS))) {
Mask[i] = 2*e; // Turn into undef.
- else
+ Elts.push_back(UndefValue::get(Type::Int32Ty));
+ } else {
Mask[i] &= (e-1); // Force to LHS.
- Elts.push_back(ConstantInt::get(Type::Int32Ty, Mask[i]));
+ Elts.push_back(ConstantInt::get(Type::Int32Ty, Mask[i]));
+ }
}
}
SVI.setOperand(0, SVI.getOperand(1));