[llvm] [InstCombine] Let shrinkSplatShuffle act on vectors of different lengths (PR #148593)
Adar Dagan via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 16 22:18:54 PDT 2025
================
@@ -708,10 +708,14 @@ static Instruction *shrinkSplatShuffle(TruncInst &Trunc,
auto *Shuf = dyn_cast<ShuffleVectorInst>(Trunc.getOperand(0));
if (Shuf && Shuf->hasOneUse() && match(Shuf->getOperand(1), m_Undef()) &&
all_equal(Shuf->getShuffleMask()) &&
- Shuf->getType() == Shuf->getOperand(0)->getType()) {
+ ElementCount::isKnownGE(Shuf->getType()->getElementCount(),
+ cast<VectorType>(Shuf->getOperand(0)->getType())
+ ->getElementCount())) {
// trunc (shuf X, Undef, SplatMask) --> shuf (trunc X), Poison, SplatMask
// trunc (shuf X, Poison, SplatMask) --> shuf (trunc X), Poison, SplatMask
- Value *NarrowOp = Builder.CreateTrunc(Shuf->getOperand(0), Trunc.getType());
+ Type *const NewTruncTy = Shuf->getOperand(0)->getType()->getWithNewType(
----------------
Adar-Dagan wrote:
Done
https://github.com/llvm/llvm-project/pull/148593
More information about the llvm-commits
mailing list