diff options
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 9 | 
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index c29d3276526..e89b400a4af 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -1140,12 +1140,11 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {    SmallVector<int, 16> Mask = SVI.getShuffleMask();    Type *Int32Ty = Type::getInt32Ty(SVI.getContext()); -  bool MadeChange = false; - -  // Undefined shuffle mask -> undefined value. -  if (isa<UndefValue>(SVI.getOperand(2))) -    return replaceInstUsesWith(SVI, UndefValue::get(SVI.getType())); +  if (auto *V = SimplifyShuffleVectorInst(LHS, RHS, SVI.getMask(), +                                          SVI.getType(), DL, &TLI, &DT, &AC)) +    return replaceInstUsesWith(SVI, V); +  bool MadeChange = false;    unsigned VWidth = SVI.getType()->getVectorNumElements();    APInt UndefElts(VWidth, 0);  | 

