Skip to content

Commit

Permalink
Document check for overflow and remove dead include
Browse files Browse the repository at this point in the history
Signed-off-by: Hernan Ponce de Leon <[email protected]>
  • Loading branch information
hernan-poncedeleon committed Dec 16, 2023
1 parent 848f99b commit ba21b54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,17 @@ private List<Event> inlineLLVMSOpWithOverflow(ValueFunctionCall call, IOpBin op)
final Expression y = arguments.get(1);
assert x.getType() == y.getType();

// The flag expression defined below has the form A & B.
// A is only relevant for integer encoding, B is only relevant for BV encoding.
// Here we do not yet know yet which encoding will be used and thus use both A & B.
// This probably has no noticeable impact on performance.

// Check for integer encoding
final IntegerType iType = (IntegerType) x.getType();
final Expression result = expressions.makeBinary(x, op, y);
final Expression rangeCheck = checkIfValueInRangeOfType(result, iType, true);

// From LLVM's language manual:
// Check for BV encoding. From LLVM's language manual:
// "An operation overflows if, for any values of its operands A and B and for any N larger than
// the operands’ width, ext(A op B) to iN is not equal to (ext(A) to iN) op (ext(B) to iN) where
// ext is sext for signed overflow and zext for unsigned overflow, and op is the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.dat3m.dartagnan.encoding.EncodingContext;
import com.dat3m.dartagnan.program.Register;
import com.dat3m.dartagnan.program.event.Tag;
import com.dat3m.dartagnan.program.event.core.Assert;
import org.sosy_lab.java_smt.api.BooleanFormula;
import org.sosy_lab.java_smt.api.BooleanFormulaManager;
Expand Down

0 comments on commit ba21b54

Please sign in to comment.