Skip to content

Commit

Permalink
Fix bug in Simplifier
Browse files Browse the repository at this point in the history
  • Loading branch information
adam committed Apr 11, 2024
1 parent e62704b commit 11889ff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Simplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,12 @@ void Simplifier::subtract_coefficient(const llvm::APInt &coeff, int firstStart,
// The first variable is true by design of the for loops.
if (i != firstStart && (variables.size() == 1 ||
this->are_variables_true(i, variables, 1))) {
this->resultVector[i] -= coeff;
if (coeff.getBitWidth() == this->resultVector[i].getBitWidth()) {
this->resultVector[i] -= coeff;
} else {
this->resultVector[i] -=
coeff.sextOrTrunc(this->resultVector[i].getBitWidth());
}
}
}
}
Expand Down

0 comments on commit 11889ff

Please sign in to comment.