Skip to content

Commit

Permalink
[ConstraintElim] Fix miscompilation
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcxzyw committed Dec 3, 2024
1 parent b8bae44 commit 37f3623
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,8 +1619,8 @@ void ConstraintInfo::addFact(CmpInst::Predicate Pred, Value *A, Value *B,
int64_t MinVal = CR->getSignedMin().getSExtValue();
if (MaxVal != MaxConstraintValue) {
ConstraintTy VarPos(
SmallVector<int64_t, 8>(Value2Index.size() + 1, 0), false,
false, false);
SmallVector<int64_t, 8>(Value2Index.size() + 1, 0), true, false,
false);
VarPos.Coefficients[0] = MaxVal;
VarPos.Coefficients[Value2Index[V]] = 1;
CSToUse.addVariableRow(VarPos.Coefficients);
Expand All @@ -1629,9 +1629,9 @@ void ConstraintInfo::addFact(CmpInst::Predicate Pred, Value *A, Value *B,
}
if (MinVal != MinSignedConstraintValue) {
ConstraintTy VarPos(
SmallVector<int64_t, 8>(Value2Index.size() + 1, 0), false,
false, false);
VarPos.Coefficients[0] = MinVal;
SmallVector<int64_t, 8>(Value2Index.size() + 1, 0), true, false,
false);
VarPos.Coefficients[0] = -MinVal;
VarPos.Coefficients[Value2Index[V]] = -1;
CSToUse.addVariableRow(VarPos.Coefficients);
DFSInStack.emplace_back(NumIn, NumOut, R.IsSigned,
Expand All @@ -1655,7 +1655,7 @@ void ConstraintInfo::addFact(CmpInst::Predicate Pred, Value *A, Value *B,
ConstraintTy VarPos(
SmallVector<int64_t, 8>(Value2Index.size() + 1, 0), false, false,
false);
VarPos.Coefficients[0] = MinVal;
VarPos.Coefficients[0] = -MinVal;
VarPos.Coefficients[Value2Index[V]] = -1;
CSToUse.addVariableRow(VarPos.Coefficients);
DFSInStack.emplace_back(NumIn, NumOut, R.IsSigned,
Expand Down

0 comments on commit 37f3623

Please sign in to comment.