[PATCH] D38631: [SimplifyCFG] use pass options and remove the latesimplifycfg pass

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 18:45:27 PDT 2017


hfinkel added a comment.

Generally, I think this is the right thing to do.  I don't like the API, however. We have SimplifyCFGOptions, which is good, but here essentially all users pass something like `{1, false, false, true}`, which defeats the point because I'll never remember which boolean is which. Maybe we could use a "builder API" for this, something like

  SimplifyCFGOptions().enableForwardSwitchCondToPhi().enableConvertSwitchToLookupTable().disableNeedCanonicalLoop()

would be better (so that we can have names instead of just booleans and numbers)?



================
Comment at: include/llvm/Transforms/Scalar/SimplifyCFG.h:35
+  // TODO: Add default constructor with default options when we're confident
+  // that we're creating the intended functionality at all points in the
+  // optimization pipeline.
----------------
This seems like overkill. We do have a current set of defaults (whatever we use for canonicalization), and defaulting to canonicalization seems reasonable to me. We can change the defaults if we change what our canonical form is.


https://reviews.llvm.org/D38631





More information about the llvm-commits mailing list