This is an archive of the discontinued LLVM Phabricator instance.

[libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer.
ClosedPublic

Authored by morehouse on Mar 22 2018, 12:08 PM.

Details

Summary

Disables certain CMP optimizations to improve fuzzing signal under -O1
and -O2.

Switches all fuzzer tests to -O2 except for a few leak tests where the
leak is optimized out under -O2.

Event Timeline

morehouse created this revision.Mar 22 2018, 12:08 PM

16-bit variables are switched to 32-bit variables in SwapCmpTest.cpp and SimpleCmpTest.cpp. This is because those tests rely on libFuzzer's TraceCMP heuristic to pass, but 16-bit compares are not considered for the heuristic.

The only reason the test used to pass was because under -O0 16-bit compares are promoted to 32-bit compares.

vitalybuka accepted this revision.Mar 22 2018, 1:58 PM
vitalybuka added inline comments.
compiler-rt/test/fuzzer/lit.cfg
88

Maybe instead of new substitutions, better just explicitly add -O0 into tests

This revision is now accepted and ready to land.Mar 22 2018, 1:58 PM
morehouse updated this revision to Diff 139673.Mar 23 2018, 4:36 PM
  • Remove new substitutions. Use -O0 to avoid optimization.
morehouse marked an inline comment as done.Mar 23 2018, 4:36 PM
This revision was automatically updated to reflect the committed changes.