[PATCH] D105284: Greedy set cover implementation of `Merger::Merge`

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 12:45:19 PDT 2021


morehouse added inline comments.


================
Comment at: compiler-rt/lib/fuzzer/FuzzerFork.cpp:324
     CrashResistantMerge(Env.Args, {}, SeedFiles, &Env.Files, Env.Features,
-                        &NewFeatures, Env.Cov, &NewCov, CFPath, false);
+                        &NewFeatures, Env.Cov, &NewCov, CFPath, false, false);
     Env.Features.insert(NewFeatures.begin(), NewFeatures.end());
----------------



================
Comment at: compiler-rt/lib/fuzzer/FuzzerMerge.cpp:358
+    if (MaxNumFeatures == 0)
+      continue;
+
----------------
Could this continue cause an infinite loop?  i.e. when `Remaining` is empty


================
Comment at: compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp:953
+                      "",
+                      true));
+  EXPECT_EQ(M.SetCoverMerge(Features, &NewFeatures, Cov, &NewCov, &NewFiles),
----------------
IIUC, this test doesn't quite do what's intended.

We choose input C because it has the most unique features, but after that A only has `{0}` as a unique feature while B has `{4, 5}`.  So we do in fact choose B, but not because it is smaller.


================
Comment at: compiler-rt/test/fuzzer/set_cover_merge.test:48
+CHECK_OVERLAP: MERGE-OUTER: 10 files, 1 in the initial corpus
+CHECK_OVERLAP: MERGE-OUTER: 2 new files with 6 new features added
+# Make sure that we are prefering smaller files (T3/3 over T3/a).
----------------
I think we would get the same results with `-merge`.  Perhaps we should make some feature-poor inputs smaller so that `-merge` would pick those first, while `-set_cover_merge` picks the feature-rich ones.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105284/new/

https://reviews.llvm.org/D105284



More information about the llvm-commits mailing list