Skip to content

Commit 5d2e57e

Browse files
committed
Model the llvm.assume intrinsic as a no-op
Currently we don't do anything with LLVM's assume statement. This is because we need to be sure that the assumption provided to the function is correct. At best it might help with verification, but it could also lead SMACK to report erroneous bugs. For now, this removes this intrinsic, preventing a warning about an unsound call to this function.
1 parent c5f8613 commit 5d2e57e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/smack/SmackInstGenerator.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,14 @@ void SmackInstGenerator::generateUnModeledCall(llvm::CallInst *ci) {
887887
void SmackInstGenerator::visitIntrinsicInst(llvm::IntrinsicInst &ii) {
888888
processInstruction(ii);
889889

890+
// The llvm.assume intrinsic currently has no use in SMACK. This is an
891+
// optimization hint for LLVM. If we ever want to exploit this function,
892+
// we need to make sure that it is used soundly.
893+
//
894+
// Nothing is done with this to prevent warnings about this intrinsic
895+
// being unsoundly modeled.
896+
static const auto assume = [this](CallInst *ci) { return; };
897+
890898
//(CallInst -> Void) -> [Flags] -> (CallInst -> Void)
891899
static const auto conditionalModel =
892900
[this](std::function<void(CallInst *)> modelGenFunc,
@@ -1132,6 +1140,7 @@ void SmackInstGenerator::visitIntrinsicInst(llvm::IntrinsicInst &ii) {
11321140

11331141
static const std::map<llvm::Intrinsic::ID, std::function<void(CallInst *)>>
11341142
stmtMap{
1143+
{llvm::Intrinsic::assume, assume},
11351144
{llvm::Intrinsic::bitreverse, assignBvExpr(bitreverse)},
11361145
{llvm::Intrinsic::bswap, assignBvExpr(bswap)},
11371146
{llvm::Intrinsic::convert_from_fp16, f16UpCast},

0 commit comments

Comments
 (0)