diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2018-07-29 16:13:26 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2018-10-24 14:15:25 +0300 |
commit | e70783b86bf3427bccd3d0b8cec858b888b8c887 (patch) | |
tree | 116f8b152f9fa074cd5815c6f1d4e1bdc2110221 | |
parent | cdff297692a1edbf9159d1c998648c6e609025ef (diff) | |
download | klee-e70783b86bf3427bccd3d0b8cec858b888b8c887.tar.gz |
DivCheck Skip unneeded checks
Do not instrument divisions which do have a constant non-zero value.
-rw-r--r-- | lib/Module/Checks.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp index a9ef0dd4..b6aadce4 100644 --- a/lib/Module/Checks.cpp +++ b/lib/Module/Checks.cpp @@ -47,6 +47,12 @@ bool DivCheckPass::runOnModule(Module &M) { if (opcode != Instruction::SDiv && opcode != Instruction::UDiv && opcode != Instruction::SRem && opcode != Instruction::URem) continue; + + // Check if the operand is constant and not zero, skip in that case. + const auto &operand = binOp->getOperand(1); + if (const auto &coOp = dyn_cast<llvm::Constant>(operand)) { + if (!coOp->isZeroValue()) + continue; } } } |