Skip to content

Commit 0b4b6e2

Browse files
committed
Fix assumptions in termination
1 parent 5ac4518 commit 0b4b6e2

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/symbioticpy/symbiotic/transform.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,8 @@ def run(self):
781781

782782
if self.options.property.memcleanup():
783783
passes.append('-remove-error-calls-use-exit')
784+
elif self.options.property.termination():
785+
passes.append('-remove-error-calls-use-silent-exit')
784786

785787
if not self.options.property.termination():
786788
passes.append('-remove-infinite-loops')

transforms/RemoveErrorCalls.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ llvm::cl::opt<bool> useExit("remove-error-calls-use-exit",
3636
llvm::cl::desc("Insert __VERIFIER_exit(0) instead of __VERIFIER_assume(0)\n"),
3737
llvm::cl::init(false));
3838

39+
llvm::cl::opt<bool> useSilentExit("remove-error-calls-use-silent-exit",
40+
llvm::cl::desc("Insert __VERIFIER_exit(0) instead of __VERIFIER_assume(0)\n"),
41+
llvm::cl::init(false));
42+
3943
class RemoveErrorCalls : public FunctionPass {
4044
public:
4145
static char ID;
@@ -70,11 +74,16 @@ bool RemoveErrorCalls::runOnFunction(Function &F)
7074
if (name.equals("__VERIFIER_error") ||
7175
name.equals("__assert_fail")) {
7276
if (!ext) {
77+
const char *fun = "__VERIFIER_assume";
78+
if (useExit) {
79+
fun = "__VERIFIER_exit";
80+
}
81+
if (useSilentExit) {
82+
fun = "__VERIFIER_silent_exit";
83+
}
7384
Type *argTy = Type::getInt32Ty(Ctx);
7485
auto extF
75-
= M->getOrInsertFunction(useExit ? "__VERIFIER_exit" :
76-
"__VERIFIER_assume",
77-
Type::getVoidTy(Ctx), argTy
86+
= M->getOrInsertFunction(fun, Type::getVoidTy(Ctx), argTy
7887
#if LLVM_VERSION_MAJOR < 5
7988
, nullptr
8089
#endif

0 commit comments

Comments
 (0)