aboutsummaryrefslogtreecommitdiff
path: root/llvm_mode/split-compares-pass.so.cc
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2019-10-26 09:03:46 +0200
committerAndrea Fioraldi <andreafioraldi@gmail.com>2019-10-26 09:03:46 +0200
commit3eaf5560beaf5b3cb79f9a58bc986027935b7a3b (patch)
tree9165b370a4468457cc80503c5e688ebf571c3be1 /llvm_mode/split-compares-pass.so.cc
parenta2f911dbb1ac177f4e633f4e667bbf4f8c578895 (diff)
downloadafl++-3eaf5560beaf5b3cb79f9a58bc986027935b7a3b.tar.gz
AFL_LLVM_LAF_SPLIT_FLOATS
Diffstat (limited to 'llvm_mode/split-compares-pass.so.cc')
-rw-r--r--llvm_mode/split-compares-pass.so.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm_mode/split-compares-pass.so.cc b/llvm_mode/split-compares-pass.so.cc
index f1a0f94e..4248b238 100644
--- a/llvm_mode/split-compares-pass.so.cc
+++ b/llvm_mode/split-compares-pass.so.cc
@@ -50,6 +50,8 @@ class SplitComparesTransform : public ModulePass {
}
private:
+ int enableFPSplit;
+
size_t splitIntCompares(Module &M, unsigned bitw);
size_t splitFPCompares(Module &M);
bool simplifyCompares(Module &M);
@@ -101,10 +103,11 @@ bool SplitComparesTransform::simplifyCompares(Module &M) {
}
- if (selectcmpInst->getPredicate() == CmpInst::FCMP_OGE ||
+ if (enableFPSplit && (
+ selectcmpInst->getPredicate() == CmpInst::FCMP_OGE ||
selectcmpInst->getPredicate() == CmpInst::FCMP_UGE ||
selectcmpInst->getPredicate() == CmpInst::FCMP_OLE ||
- selectcmpInst->getPredicate() == CmpInst::FCMP_ULE) {
+ selectcmpInst->getPredicate() == CmpInst::FCMP_ULE)) {
auto op0 = selectcmpInst->getOperand(0);
auto op1 = selectcmpInst->getOperand(1);
@@ -1039,6 +1042,8 @@ bool SplitComparesTransform::runOnModule(Module &M) {
char *bitw_env = getenv("LAF_SPLIT_COMPARES_BITW");
if (!bitw_env) bitw_env = getenv("AFL_LLVM_LAF_SPLIT_COMPARES_BITW");
if (bitw_env) { bitw = atoi(bitw_env); }
+
+ enableFPSplit = getenv("AFL_LLVM_LAF_SPLIT_FLOATS") != NULL;
simplifyCompares(M);
@@ -1048,8 +1053,9 @@ bool SplitComparesTransform::runOnModule(Module &M) {
errs() << "Split-compare-pass by laf.intel@gmail.com, extended by "
"heiko@hexco.de\n";
- errs() << "Split-floatingpoint-compare-pass: " << splitFPCompares(M)
- << " FP comparisons splitted\n";
+ if (enableFPSplit)
+ errs() << "Split-floatingpoint-compare-pass: " << splitFPCompares(M)
+ << " FP comparisons splitted\n";
switch (bitw) {