mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
Fix a type mismatch assert in SCEV division
An assert was triggered when attempting to create a new SCEV with operands of different types in the visitAddRecExpr. In this test case, the operand types of the numerator and denominator are different. The SCEV division code should generate a conservative answer when this happens. Differential Revision: http://reviews.llvm.org/D9021 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -795,6 +795,14 @@ public:
|
||||
assert(Numerator->isAffine() && "Numerator should be affine");
|
||||
divide(SE, Numerator->getStart(), Denominator, &StartQ, &StartR);
|
||||
divide(SE, Numerator->getStepRecurrence(SE), Denominator, &StepQ, &StepR);
|
||||
// Bail out if the types do not match.
|
||||
Type *Ty = Denominator->getType();
|
||||
if (Ty != StartQ->getType() || Ty != StartR->getType() ||
|
||||
Ty != StepQ->getType() || Ty != StepR->getType()) {
|
||||
Quotient = Zero;
|
||||
Remainder = Numerator;
|
||||
return;
|
||||
}
|
||||
Quotient = SE.getAddRecExpr(StartQ, StepQ, Numerator->getLoop(),
|
||||
Numerator->getNoWrapFlags());
|
||||
Remainder = SE.getAddRecExpr(StartR, StepR, Numerator->getLoop(),
|
||||
|
Reference in New Issue
Block a user