Skip to content

Commit 221c3b1

Browse files
committed
[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.
1 parent d042f2d commit 221c3b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4631,7 +4631,7 @@ static Value *SimplifyShuffleVectorInst(Value *Op0, Value *Op1,
46314631
Indices.assign(Mask.begin(), Mask.end());
46324632

46334633
// Canonicalization: If mask does not select elements from an input vector,
4634-
// replace that input vector with undef.
4634+
// replace that input vector with poison.
46354635
if (!Scalable) {
46364636
bool MaskSelects0 = false, MaskSelects1 = false;
46374637
unsigned InVecNumElts = InVecEltCount.getKnownMinValue();
@@ -4644,9 +4644,9 @@ static Value *SimplifyShuffleVectorInst(Value *Op0, Value *Op1,
46444644
MaskSelects1 = true;
46454645
}
46464646
if (!MaskSelects0)
4647-
Op0 = UndefValue::get(InVecTy);
4647+
Op0 = PoisonValue::get(InVecTy);
46484648
if (!MaskSelects1)
4649-
Op1 = UndefValue::get(InVecTy);
4649+
Op1 = PoisonValue::get(InVecTy);
46504650
}
46514651

46524652
auto *Op0Const = dyn_cast<Constant>(Op0);

0 commit comments

Comments
 (0)