mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Reland "[NFC] SimplifyCFG: refactor/deduplicate command-line settings override handling"
Initially i forgot to stage the SimplifyCFGPass::SimplifyCFGPass() change to actually take the passed params..
This commit is contained in:
parent
22c19a3e72
commit
f174aef3be
@ -213,22 +213,22 @@ static bool simplifyFunctionCFG(Function &F, const TargetTransformInfo &TTI,
|
||||
}
|
||||
|
||||
// Command-line settings override compile-time settings.
|
||||
SimplifyCFGPass::SimplifyCFGPass(const SimplifyCFGOptions &Opts) {
|
||||
Options.BonusInstThreshold = UserBonusInstThreshold.getNumOccurrences()
|
||||
? UserBonusInstThreshold
|
||||
: Opts.BonusInstThreshold;
|
||||
Options.ForwardSwitchCondToPhi = UserForwardSwitchCond.getNumOccurrences()
|
||||
? UserForwardSwitchCond
|
||||
: Opts.ForwardSwitchCondToPhi;
|
||||
Options.ConvertSwitchToLookupTable = UserSwitchToLookup.getNumOccurrences()
|
||||
? UserSwitchToLookup
|
||||
: Opts.ConvertSwitchToLookupTable;
|
||||
Options.NeedCanonicalLoop = UserKeepLoops.getNumOccurrences()
|
||||
? UserKeepLoops
|
||||
: Opts.NeedCanonicalLoop;
|
||||
Options.SinkCommonInsts = UserSinkCommonInsts.getNumOccurrences()
|
||||
? UserSinkCommonInsts
|
||||
: Opts.SinkCommonInsts;
|
||||
static void applyCommandLineOverridesToOptions(SimplifyCFGOptions &Options) {
|
||||
if (UserBonusInstThreshold.getNumOccurrences())
|
||||
Options.BonusInstThreshold = UserBonusInstThreshold;
|
||||
if (UserForwardSwitchCond.getNumOccurrences())
|
||||
Options.ForwardSwitchCondToPhi = UserForwardSwitchCond;
|
||||
if (UserSwitchToLookup.getNumOccurrences())
|
||||
Options.ConvertSwitchToLookupTable = UserSwitchToLookup;
|
||||
if (UserKeepLoops.getNumOccurrences())
|
||||
Options.NeedCanonicalLoop = UserKeepLoops;
|
||||
if (UserSinkCommonInsts.getNumOccurrences())
|
||||
Options.SinkCommonInsts = UserSinkCommonInsts;
|
||||
}
|
||||
|
||||
SimplifyCFGPass::SimplifyCFGPass(const SimplifyCFGOptions &Opts)
|
||||
: Options(Opts) {
|
||||
applyCommandLineOverridesToOptions(Options);
|
||||
}
|
||||
|
||||
PreservedAnalyses SimplifyCFGPass::run(Function &F,
|
||||
@ -255,20 +255,7 @@ struct CFGSimplifyPass : public FunctionPass {
|
||||
initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry());
|
||||
|
||||
// Check for command-line overrides of options for debug/customization.
|
||||
if (UserBonusInstThreshold.getNumOccurrences())
|
||||
Options.BonusInstThreshold = UserBonusInstThreshold;
|
||||
|
||||
if (UserForwardSwitchCond.getNumOccurrences())
|
||||
Options.ForwardSwitchCondToPhi = UserForwardSwitchCond;
|
||||
|
||||
if (UserSwitchToLookup.getNumOccurrences())
|
||||
Options.ConvertSwitchToLookupTable = UserSwitchToLookup;
|
||||
|
||||
if (UserKeepLoops.getNumOccurrences())
|
||||
Options.NeedCanonicalLoop = UserKeepLoops;
|
||||
|
||||
if (UserSinkCommonInsts.getNumOccurrences())
|
||||
Options.SinkCommonInsts = UserSinkCommonInsts;
|
||||
applyCommandLineOverridesToOptions(Options);
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &F) override {
|
||||
|
Loading…
Reference in New Issue
Block a user