forked from OSchip/llvm-project
InstCombine: Use the InstSimplify hook for shufflevector
Summary: Start using the recently added InstSimplify hook for shuffles in the respective InstCombine visitor. Reviewers: spatel, RKSimon, craig.topper, majnemer Reviewed By: majnemer Subscribers: majnemer, llvm-commits Differential Revision: https://reviews.llvm.org/D31526 llvm-svn: 299412
This commit is contained in:
parent
61329522af
commit
82bf48d8b9
|
@ -1140,12 +1140,11 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
|
||||||
SmallVector<int, 16> Mask = SVI.getShuffleMask();
|
SmallVector<int, 16> Mask = SVI.getShuffleMask();
|
||||||
Type *Int32Ty = Type::getInt32Ty(SVI.getContext());
|
Type *Int32Ty = Type::getInt32Ty(SVI.getContext());
|
||||||
|
|
||||||
|
if (auto *V = SimplifyShuffleVectorInst(LHS, RHS, SVI.getMask(),
|
||||||
|
SVI.getType(), DL, &TLI, &DT, &AC))
|
||||||
|
return replaceInstUsesWith(SVI, V);
|
||||||
|
|
||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
|
|
||||||
// Undefined shuffle mask -> undefined value.
|
|
||||||
if (isa<UndefValue>(SVI.getOperand(2)))
|
|
||||||
return replaceInstUsesWith(SVI, UndefValue::get(SVI.getType()));
|
|
||||||
|
|
||||||
unsigned VWidth = SVI.getType()->getVectorNumElements();
|
unsigned VWidth = SVI.getType()->getVectorNumElements();
|
||||||
|
|
||||||
APInt UndefElts(VWidth, 0);
|
APInt UndefElts(VWidth, 0);
|
||||||
|
|
Loading…
Reference in New Issue