aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2023-06-24 10:27:10 +0300
committerGitHub <noreply@github.com>2023-06-24 10:27:10 +0300
commit2106738d6b7593f18aab87d03e493ea3a86adeee (patch)
treee7373793dfdaeca2abc78c31fd89b1bf7c3f7630
parentb28b63f8736d39eeb949a0ca47ba89071c511b61 (diff)
parent0616f368c83189ef5559f64d2053129d329aaefe (diff)
downloadafl++-2106738d6b7593f18aab87d03e493ea3a86adeee.tar.gz
Merge pull request #1783 from AFLplusplus/toka_laf_fix
laf-intel fix
-rw-r--r--instrumentation/split-compares-pass.so.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/instrumentation/split-compares-pass.so.cc b/instrumentation/split-compares-pass.so.cc
index aec6758e..3cfd1964 100644
--- a/instrumentation/split-compares-pass.so.cc
+++ b/instrumentation/split-compares-pass.so.cc
@@ -463,8 +463,9 @@ bool SplitComparesTransform::simplifyOrEqualsCompare(CmpInst *IcmpInst,
#else
ReplaceInstWithInst(IcmpInst->getParent()->getInstList(), ii, PN);
#endif
-
- worklist.push_back(icmp_np);
+ if (new_pred == CmpInst::ICMP_SGT || new_pred == CmpInst::ICMP_SLT) {
+ simplifySignedCompare(icmp_np, M, worklist);
+ }
worklist.push_back(icmp_eq);
return true;
@@ -740,18 +741,22 @@ bool SplitComparesTransform::splitCompare(CmpInst *cmp_inst, Module &M,
CmpInst *icmp_inv_cmp = nullptr;
BasicBlock *inv_cmp_bb =
BasicBlock::Create(C, "inv_cmp", end_bb->getParent(), end_bb);
- if (pred == CmpInst::ICMP_UGT || pred == CmpInst::ICMP_SGT ||
- pred == CmpInst::ICMP_UGE || pred == CmpInst::ICMP_SGE) {
+ if (pred == CmpInst::ICMP_UGT) {
icmp_inv_cmp = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_ULT,
op0_high, op1_high);
- } else {
+ } else if (pred == CmpInst::ICMP_ULT) {
icmp_inv_cmp = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_UGT,
op0_high, op1_high);
}
+ else {
+ // Never gonna appen
+ if (!be_quiet)
+ fprintf(stderr, "Error: split-compare: Equals or signed not removed: %d\n", pred);
+ }
#if LLVM_MAJOR >= 16
icmp_inv_cmp->insertInto(inv_cmp_bb, inv_cmp_bb->end());