HomePhabricator

[gicombiner] Allow disable-rule option to disable all-except-...

Authored by dsanders on Jun 16 2020, 2:52 PM.

Description

[gicombiner] Allow disable-rule option to disable all-except-...

Summary:
Adds two features to the generated rule disable option:

  • '*' - Disable all rules
  • '!<foo>' - Re-enable rule(s)
    • '!foo' - Enable rule named 'foo'
    • '!5' - Enable rule five
    • '!4-9' - Enable rule four to nine
    • '!foo-bar' - Enable rules from 'foo' to (and including) 'bar'

(the '!' is available to the generated disable option but is not part of the underlying and determines whether to call setRuleDisabled() or setRuleEnabled())

This is intended to support unit testing of combine rules so
that you can do:

GeneratedCfg.setRuleDisabled("*")
GeneratedCfg.setRuleEnabled("foo")

to ensure only a specific rule is in effect. The rule is still
required to be included in a combiner though

Also added --...-only-enable-rule=X,Y which is effectively an
alias for --...-disable-rule=*,!X,!Y and as such interacts
properly with disable-rule.

Reviewers: aditya_nandakumar, bogner, volkan, aemerson, paquette, arsenm

Subscribers: wdng, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81889