Skip to content

Commit fc31b58

Browse files
committed
[InstCombine] simplify code for shuffle mask canonicalization; NFC
We never use the local 'Mask' before returning, so that was dead code.
1 parent 847aabf commit fc31b58

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,13 +1900,11 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
19001900
continue;
19011901
}
19021902

1903-
if (Mask[i] < (int)LHSWidth && isa<UndefValue>(LHS)) {
1904-
Mask[i] = -1; // Turn into undef.
1903+
// Change select of undef to undef mask element or force to LHS.
1904+
if (Mask[i] < (int)LHSWidth && isa<UndefValue>(LHS))
19051905
Elts.push_back(UndefValue::get(Int32Ty));
1906-
} else {
1907-
Mask[i] = Mask[i] % LHSWidth; // Force to LHS.
1908-
Elts.push_back(ConstantInt::get(Int32Ty, Mask[i]));
1909-
}
1906+
else
1907+
Elts.push_back(ConstantInt::get(Int32Ty, Mask[i] % LHSWidth));
19101908
}
19111909
SVI.setOperand(0, SVI.getOperand(1));
19121910
SVI.setOperand(1, UndefValue::get(RHS->getType()));

0 commit comments

Comments
 (0)