summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerTraceState.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-09-08 20:40:10 +0000
committerKostya Serebryany <kcc@google.com>2015-09-08 20:40:10 +0000
commit4b82de2e473b08f1dba951b042ca7f1f9c427763 (patch)
tree19278ff626854b22bbde98ebe6f2c46357d440eb /llvm/lib/Fuzzer/FuzzerTraceState.cpp
parent9cdea94f66df4cce367ff67823dbd8fac7b6ff1e (diff)
downloadbcm5719-llvm-4b82de2e473b08f1dba951b042ca7f1f9c427763.tar.gz
bcm5719-llvm-4b82de2e473b08f1dba951b042ca7f1f9c427763.zip
[libFuzzer] remove a piece of stale code
llvm-svn: 247067
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerTraceState.cpp')
-rw-r--r--llvm/lib/Fuzzer/FuzzerTraceState.cpp42
1 files changed, 1 insertions, 41 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerTraceState.cpp b/llvm/lib/Fuzzer/FuzzerTraceState.cpp
index b7ed66fdfc6..34a98d1a20b 100644
--- a/llvm/lib/Fuzzer/FuzzerTraceState.cpp
+++ b/llvm/lib/Fuzzer/FuzzerTraceState.cpp
@@ -166,38 +166,6 @@ struct LabelRange {
}
};
-// A passport for a CMP site. We want to keep track of where the given CMP is
-// and how many times it is evaluated to true or false.
-struct CmpSitePassport {
- uintptr_t PC;
- size_t Counter[2];
-
- bool IsInterestingCmpTarget() {
- static const size_t kRareEnough = 50;
- size_t C0 = Counter[0];
- size_t C1 = Counter[1];
- return C0 > kRareEnough * (C1 + 1) || C1 > kRareEnough * (C0 + 1);
- }
-};
-
-// For now, just keep a simple imprecise hash table PC => CmpSitePassport.
-// Potentially, will need to have a compiler support to have a precise mapping
-// and also thread-safety.
-struct CmpSitePassportTable {
- static const size_t kSize = 99991; // Prime.
- CmpSitePassport Passports[kSize];
-
- CmpSitePassport *GetPassport(uintptr_t PC) {
- uintptr_t Idx = PC & kSize;
- CmpSitePassport *Res = &Passports[Idx];
- if (Res->PC == 0) // Not thread safe.
- Res->PC = PC;
- return Res->PC == PC ? Res : nullptr;
- }
-};
-
-static CmpSitePassportTable CSPTable; // Zero initialized.
-
// For now, very simple: put Size bytes of Data at position Pos.
struct TraceBasedMutation {
size_t Pos;
@@ -349,16 +317,8 @@ void TraceState::TraceCmpCallback(uintptr_t PC, size_t CmpSize, size_t CmpType,
uint64_t Arg1, uint64_t Arg2) {
if (!RecordingTraces) return;
int Added = 0;
- CmpSitePassport *CSP = CSPTable.GetPassport(PC);
- if (!CSP) return;
- CSP->Counter[ComputeCmp(CmpSize, CmpType, Arg1, Arg2)]++;
- size_t C0 = CSP->Counter[0];
- size_t C1 = CSP->Counter[1];
- // FIXME: is this a good idea or a bad?
- // if (!CSP->IsInterestingCmpTarget())
- // return;
if (Options.Verbosity >= 3)
- Printf("TraceCmp: %p %zd/%zd; %zd %zd\n", CSP->PC, C0, C1, Arg1, Arg2);
+ Printf("TraceCmp %zd/%zd: %p %zd %zd\n", CmpSize, CmpType, PC, Arg1, Arg2);
Added += TryToAddDesiredData(Arg1, Arg2, CmpSize);
Added += TryToAddDesiredData(Arg2, Arg1, CmpSize);
if (!Added && CmpSize == 4 && IsTwoByteData(Arg1) && IsTwoByteData(Arg2)) {
OpenPOWER on IntegriCloud