Skip to content

Commit 5fb7819

Browse files
committed
Don't accept shuffles that reference the second operand if its an undef arg.
1 parent 2f758b7 commit 5fb7819

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,9 +1436,9 @@ bool VectorCombine::foldPermuteOfBinops(Instruction &I) {
14361436

14371437
unsigned NumSrcElts = BinOpTy->getNumElements();
14381438

1439-
// Don't accept shuffles that reference the second (undef/poison) operand in
1440-
// div/rem..
1441-
if (BinOp->isIntDivRem() &&
1439+
// Don't accept shuffles that reference the second operand in
1440+
// div/rem or if its an undef arg.
1441+
if ((BinOp->isIntDivRem() || !isa<PoisonValue>(I.getOperand(1))) &&
14421442
any_of(OuterMask, [NumSrcElts](int M) { return M >= (int)NumSrcElts; }))
14431443
return false;
14441444

0 commit comments

Comments
 (0)