mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-09 08:41:32 +00:00
disable cmplog vector FP cmp hooking
This commit is contained in:
parent
ee10461f48
commit
5f70bc5404
@ -41,6 +41,7 @@
|
|||||||
(LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
|
(LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
|
||||||
#include "llvm/IR/Verifier.h"
|
#include "llvm/IR/Verifier.h"
|
||||||
#include "llvm/IR/DebugInfo.h"
|
#include "llvm/IR/DebugInfo.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#else
|
#else
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/DebugInfo.h"
|
#include "llvm/DebugInfo.h"
|
||||||
@ -285,7 +286,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
|||||||
IntegerType *intTyOp0 = NULL;
|
IntegerType *intTyOp0 = NULL;
|
||||||
IntegerType *intTyOp1 = NULL;
|
IntegerType *intTyOp1 = NULL;
|
||||||
unsigned max_size = 0, cast_size = 0;
|
unsigned max_size = 0, cast_size = 0;
|
||||||
unsigned attr = 0, vector_cnt = 0;
|
unsigned attr = 0, vector_cnt = 0, is_fp = 0;
|
||||||
CmpInst * cmpInst = dyn_cast<CmpInst>(selectcmpInst);
|
CmpInst * cmpInst = dyn_cast<CmpInst>(selectcmpInst);
|
||||||
|
|
||||||
if (!cmpInst) { continue; }
|
if (!cmpInst) { continue; }
|
||||||
@ -370,6 +371,8 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
attr += 8;
|
attr += 8;
|
||||||
|
is_fp = 1;
|
||||||
|
// fprintf(stderr, "HAVE FP %u!\n", vector_cnt);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -453,6 +456,9 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX FIXME BUG TODO
|
||||||
|
if (is_fp && vector_cnt) { continue; }
|
||||||
|
|
||||||
uint64_t cur = 0, last_val0 = 0, last_val1 = 0, cur_val;
|
uint64_t cur = 0, last_val0 = 0, last_val1 = 0, cur_val;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -464,6 +470,36 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
|||||||
|
|
||||||
op0 = IRB.CreateExtractElement(op0_saved, cur);
|
op0 = IRB.CreateExtractElement(op0_saved, cur);
|
||||||
op1 = IRB.CreateExtractElement(op1_saved, cur);
|
op1 = IRB.CreateExtractElement(op1_saved, cur);
|
||||||
|
/*
|
||||||
|
std::string errMsg;
|
||||||
|
raw_string_ostream os(errMsg);
|
||||||
|
op0_saved->print(os);
|
||||||
|
fprintf(stderr, "X: %s\n", os.str().c_str());
|
||||||
|
*/
|
||||||
|
if (is_fp) {
|
||||||
|
|
||||||
|
ConstantFP *i0 = dyn_cast<ConstantFP>(op0);
|
||||||
|
ConstantFP *i1 = dyn_cast<ConstantFP>(op1);
|
||||||
|
// BUG FIXME TODO: this is null ... but why?
|
||||||
|
// fprintf(stderr, "%p %p\n", i0, i1);
|
||||||
|
if (i0) {
|
||||||
|
|
||||||
|
cur_val = (uint64_t)i0->getValue().convertToDouble();
|
||||||
|
if (last_val0 && last_val0 == cur_val) { skip = 1; }
|
||||||
|
last_val0 = cur_val;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i1) {
|
||||||
|
|
||||||
|
cur_val = (uint64_t)i1->getValue().convertToDouble();
|
||||||
|
if (last_val1 && last_val1 == cur_val) { skip = 1; }
|
||||||
|
last_val1 = cur_val;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
ConstantInt *i0 = dyn_cast<ConstantInt>(op0);
|
ConstantInt *i0 = dyn_cast<ConstantInt>(op0);
|
||||||
ConstantInt *i1 = dyn_cast<ConstantInt>(op1);
|
ConstantInt *i1 = dyn_cast<ConstantInt>(op1);
|
||||||
if (i0 && i0->uge(0xffffffffffffffff) == false) {
|
if (i0 && i0->uge(0xffffffffffffffff) == false) {
|
||||||
@ -484,6 +520,8 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
|
|
||||||
// errs() << "[CMPLOG] cmp " << *cmpInst << "(in function " <<
|
// errs() << "[CMPLOG] cmp " << *cmpInst << "(in function " <<
|
||||||
@ -557,6 +595,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
|||||||
|
|
||||||
++cur;
|
++cur;
|
||||||
if (cur >= vector_cnt) { break; }
|
if (cur >= vector_cnt) { break; }
|
||||||
|
skip = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user