[PATCH] Add a callback to FunctionPass to enable skipping execution on a per-function basis

Chandler Carruth chandlerc at gmail.com
Wed Apr 8 19:31:15 PDT 2015


I feel like we could do something much simpler than this. This feeling is predicated on one primary theory: most passes will run for most subtargets. Put another way, there will only be a small number of passes that we actually want to opt out of on a per-subtarget basis.

If we think that's likely to be the case, here is an alternative suggestion:

- Add bool-returning predicates for each pass to the subtarget base class (eg, "isIfConversionProfitable()") with the expected default ("true").
- Override these for the subtargets that want to opt out.
- Change the pass to directly get the subtarget, query it, and bail without doing anything if it gets "false".

>From looking at and thinking about if-conversion at least, this seems nicer to me. It makes someone working on the pass aware that there are subtarget profitability concerns, and it makes it very clear that we are *running* all of the passes, just that some have no effect on certain subtargets.

This also matches how an optimization pass should query the function for the 'noopt' attribute and bail.

Thoughts?


http://reviews.llvm.org/D8717

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list