@@ -2416,13 +2416,13 @@ static Instruction *foldTruncShuffle(ShuffleVectorInst &Shuf,
2416
2416
}
2417
2417
2418
2418
// / Match a shuffle-select-shuffle pattern where the shuffles are widening and
2419
- // / narrowing (concatenating with undef and extracting back to the original
2419
+ // / narrowing (concatenating with poison and extracting back to the original
2420
2420
// / length). This allows replacing the wide select with a narrow select.
2421
2421
static Instruction *narrowVectorSelect (ShuffleVectorInst &Shuf,
2422
2422
InstCombiner::BuilderTy &Builder) {
2423
2423
// This must be a narrowing identity shuffle. It extracts the 1st N elements
2424
2424
// of the 1st vector operand of a shuffle.
2425
- if (!match (Shuf.getOperand (1 ), m_Undef ()) || !Shuf.isIdentityWithExtract ())
2425
+ if (!match (Shuf.getOperand (1 ), m_Poison ()) || !Shuf.isIdentityWithExtract ())
2426
2426
return nullptr ;
2427
2427
2428
2428
// The vector being shuffled must be a vector select that we can eliminate.
@@ -2432,19 +2432,20 @@ static Instruction *narrowVectorSelect(ShuffleVectorInst &Shuf,
2432
2432
m_OneUse (m_Select (m_Value (Cond), m_Value (X), m_Value (Y)))))
2433
2433
return nullptr ;
2434
2434
2435
- // We need a narrow condition value. It must be extended with undef elements
2435
+ // We need a narrow condition value. It must be extended with poison elements
2436
2436
// and have the same number of elements as this shuffle.
2437
2437
unsigned NarrowNumElts =
2438
2438
cast<FixedVectorType>(Shuf.getType ())->getNumElements ();
2439
2439
Value *NarrowCond;
2440
- if (!match (Cond, m_OneUse (m_Shuffle (m_Value (NarrowCond), m_Undef ()))) ||
2440
+ if (!match (Cond, m_OneUse (m_Shuffle (m_Value (NarrowCond), m_Poison ()))) ||
2441
2441
cast<FixedVectorType>(NarrowCond->getType ())->getNumElements () !=
2442
2442
NarrowNumElts ||
2443
2443
!cast<ShuffleVectorInst>(Cond)->isIdentityWithPadding ())
2444
2444
return nullptr ;
2445
2445
2446
- // shuf (sel (shuf NarrowCond, undef, WideMask), X, Y), undef, NarrowMask) -->
2447
- // sel NarrowCond, (shuf X, undef, NarrowMask), (shuf Y, undef, NarrowMask)
2446
+ // shuf (sel (shuf NarrowCond, poison, WideMask), X, Y), poison, NarrowMask)
2447
+ // -->
2448
+ // sel NarrowCond, (shuf X, poison, NarrowMask), (shuf Y, poison, NarrowMask)
2448
2449
Value *NarrowX = Builder.CreateShuffleVector (X, Shuf.getShuffleMask ());
2449
2450
Value *NarrowY = Builder.CreateShuffleVector (Y, Shuf.getShuffleMask ());
2450
2451
return SelectInst::Create (NarrowCond, NarrowX, NarrowY);
0 commit comments