[InstSimplify] Canonicalize non-demanded shuffle op to poison (NFCI)

I don't believe this has an observable effect, because the only
thing we care about here is replacing the operand with a constant
so following folds can apply. This change is just to make the
representation follow canonical unary shuffle form.
This commit is contained in:
Nikita Popov 2021-01-06 21:22:27 +01:00
parent d042f2db5b
commit 221c3b174b
1 changed files with 3 additions and 3 deletions
llvm/lib/Analysis

View File

@ -4631,7 +4631,7 @@ static Value *SimplifyShuffleVectorInst(Value *Op0, Value *Op1,
Indices.assign(Mask.begin(), Mask.end());
// Canonicalization: If mask does not select elements from an input vector,
// replace that input vector with undef.
// replace that input vector with poison.
if (!Scalable) {
bool MaskSelects0 = false, MaskSelects1 = false;
unsigned InVecNumElts = InVecEltCount.getKnownMinValue();
@ -4644,9 +4644,9 @@ static Value *SimplifyShuffleVectorInst(Value *Op0, Value *Op1,
MaskSelects1 = true;
}
if (!MaskSelects0)
Op0 = UndefValue::get(InVecTy);
Op0 = PoisonValue::get(InVecTy);
if (!MaskSelects1)
Op1 = UndefValue::get(InVecTy);
Op1 = PoisonValue::get(InVecTy);
}
auto *Op0Const = dyn_cast<Constant>(Op0);