We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 493071c commit eb8c2e1Copy full SHA for eb8c2e1
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2257,9 +2257,8 @@ Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) {
2257
}
2258
if (MayChange) {
2259
Constant *NewC = ConstantVector::get(NewVecC);
2260
- // It may not be safe to execute a binop on a vector with poison elements
2261
- // because the entire instruction can be folded to undef or create poison
2262
- // that did not exist in the original code.
+ // Lanes of NewC not used by the shuffle will be poison which will cause
+ // UB for div/rem. Mask them with a safe constant.
2263
if (Inst.isIntDivRem())
2264
NewC = getSafeVectorConstantForBinop(Opcode, NewC, ConstOp1);
2265
0 commit comments