This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Create attribute to disable simplifyCFG.
AbandonedPublic

Authored by morehouse on Mar 2 2018, 4:48 PM.

Details

Summary

When building with libFuzzer, simplifyCFG reduces the coverage signal
available to libFuzzer when trying to find new inputs. This patch
provides a way to disable simplifyCFG when building with libFuzzer.

Previous attempt https://reviews.llvm.org/D43423 received push-back
regarding the frontend flag.

Event Timeline

morehouse created this revision.Mar 2 2018, 4:48 PM

LGTM, but I'd wait a little for others inputs

llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp
46

no_simplify_cfg->nosimplifycfg ?

hfinkel added a subscriber: hfinkel.Mar 2 2018, 6:56 PM

Do you actually want to disable all CFG simplifications, or do you just need to disable things that convert from control flow to something else (e.g., select formation)?

arsenm added a subscriber: arsenm.Mar 2 2018, 7:23 PM

I think the concept of an attribute to specially disable a specific pass is concerning. This is actually more aggressive since it will also disable it if a pass attempts to use the utility function on a specific block

arsenm added a comment.Mar 2 2018, 7:33 PM

I think the concept of an attribute to specially disable a specific pass is concerning. This is actually more aggressive since it will also disable it if a pass attempts to use the utility function on a specific block

More specifically I think if a pass wants to call simplifyCFG the utility function, it should be able to rely on some of the expected canonicalizations so it would not be OK for anything to just disable this

Do you actually want to disable all CFG simplifications, or do you just need to disable things that convert from control flow to something else (e.g., select formation)?

Yes, what we need is to keep things as control flow so that our edge coverage picks up when a new condition is met. Is there a better way to do this?

More specifically I think if a pass wants to call simplifyCFG the utility function, it should be able to rely on some of the expected canonicalizations so it would not be OK for anything to just disable this

An alternative would be to find every pass that calls simplifyCFG and disable them, but that may result in many optimizations unnecessarily disabled. Considering simplifyCFG can return false, shouldn't passes already be handling the case where simplification does not occur?

Do you actually want to disable all CFG simplifications, or do you just need to disable things that convert from control flow to something else (e.g., select formation)?

Less aggressive alternative: https://reviews.llvm.org/D44232.

morehouse abandoned this revision.Mar 22 2018, 10:12 AM