Skip to content

Commit fbc798e

Browse files
committed
[InstCombine] Use m_Poison instead of m_Undef (NFCI)
In this case, isIdentityWithExtract() should already ensure that this is a single-source shuffle. This just makes things more explicit.
1 parent a53e568 commit fbc798e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,7 +2549,7 @@ static Instruction *foldCastShuffle(ShuffleVectorInst &Shuf,
25492549
/// Try to fold an extract subvector operation.
25502550
static Instruction *foldIdentityExtractShuffle(ShuffleVectorInst &Shuf) {
25512551
Value *Op0 = Shuf.getOperand(0), *Op1 = Shuf.getOperand(1);
2552-
if (!Shuf.isIdentityWithExtract() || !match(Op1, m_Undef()))
2552+
if (!Shuf.isIdentityWithExtract() || !match(Op1, m_Poison()))
25532553
return nullptr;
25542554

25552555
// Check if we are extracting all bits of an inserted scalar:
@@ -2578,10 +2578,10 @@ static Instruction *foldIdentityExtractShuffle(ShuffleVectorInst &Shuf) {
25782578
// not allow arbitrary shuffle mask creation as a target-independent transform
25792579
// (because we can't guarantee that will lower efficiently).
25802580
//
2581-
// If the extracting shuffle has an undef mask element, it transfers to the
2581+
// If the extracting shuffle has an poison mask element, it transfers to the
25822582
// new shuffle mask. Otherwise, copy the original mask element. Example:
2583-
// shuf (shuf X, Y, <C0, C1, C2, undef, C4>), undef, <0, undef, 2, 3> -->
2584-
// shuf X, Y, <C0, undef, C2, undef>
2583+
// shuf (shuf X, Y, <C0, C1, C2, poison, C4>), poison, <0, poison, 2, 3> -->
2584+
// shuf X, Y, <C0, poison, C2, poison>
25852585
unsigned NumElts = cast<FixedVectorType>(Shuf.getType())->getNumElements();
25862586
SmallVector<int, 16> NewMask(NumElts);
25872587
assert(NumElts < Mask.size() &&

0 commit comments

Comments
 (0)