Closed
Description
DivRemPairs-L207
The newly created binary operator RealRem
, which replaces original rem instruction RemInst
, has no debug location update.
Instruction *RealRem = E.isSigned() ? BinaryOperator::CreateSRem(X, Y)
: BinaryOperator::CreateURem(X, Y);
RealRem->setName(RemInst->getName() + ".recomposed");
RealRem->insertAfter(RemInst);
Instruction *OrigRemInst = RemInst;
RemInst = RealRem;
OrigRemInst->replaceAllUsesWith(RealRem);
OrigRemInst->eraseFromParent();
DivRemPairs-L333, L334
New mul (Mul
) and sub (Sub
) instructions, which replace the original rem instruction (RemInst
), have no debug location update.
Instruction *Mul = BinaryOperator::CreateMul(DivInst, Y);
Instruction *Sub = BinaryOperator::CreateSub(X, Mul);
Mul->insertAfter(RemInst);
Sub->insertAfter(Mul);
Instruction *OrigRemInst = RemInst;
// Update AssertingVH<> with new instruction so it doesn't assert.
RemInst = Sub;
// And replace the original instruction with the new one.
OrigRemInst->replaceAllUsesWith(Sub);
OrigRemInst->eraseFromParent();
DivRemPairs-L385, L393
Two new freeze instruction (FrX
and FrY
) used by other instructions have no debug location.
if (!isGuaranteedNotToBeUndef(X, nullptr, DivInst, &DT)) {
auto *FrX =
new FreezeInst(X, X->getName() + ".frozen", DivInst->getIterator());
DivInst->setOperand(0, FrX);
Sub->setOperand(0, FrX);
}
if (!isGuaranteedNotToBeUndef(Y, nullptr, DivInst, &DT)) {
auto *FrY =
new FreezeInst(Y, Y->getName() + ".frozen", DivInst->getIterator());
DivInst->setOperand(1, FrY);
Mul->setOperand(1, FrY);
}