mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +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.
|
// Command-line settings override compile-time settings.
|
||||||
SimplifyCFGPass::SimplifyCFGPass(const SimplifyCFGOptions &Opts) {
|
static void applyCommandLineOverridesToOptions(SimplifyCFGOptions &Options) {
|
||||||
Options.BonusInstThreshold = UserBonusInstThreshold.getNumOccurrences()
|
if (UserBonusInstThreshold.getNumOccurrences())
|
||||||
? UserBonusInstThreshold
|
Options.BonusInstThreshold = UserBonusInstThreshold;
|
||||||
: Opts.BonusInstThreshold;
|
if (UserForwardSwitchCond.getNumOccurrences())
|
||||||
Options.ForwardSwitchCondToPhi = UserForwardSwitchCond.getNumOccurrences()
|
Options.ForwardSwitchCondToPhi = UserForwardSwitchCond;
|
||||||
? UserForwardSwitchCond
|
if (UserSwitchToLookup.getNumOccurrences())
|
||||||
: Opts.ForwardSwitchCondToPhi;
|
Options.ConvertSwitchToLookupTable = UserSwitchToLookup;
|
||||||
Options.ConvertSwitchToLookupTable = UserSwitchToLookup.getNumOccurrences()
|
if (UserKeepLoops.getNumOccurrences())
|
||||||
? UserSwitchToLookup
|
Options.NeedCanonicalLoop = UserKeepLoops;
|
||||||
: Opts.ConvertSwitchToLookupTable;
|
if (UserSinkCommonInsts.getNumOccurrences())
|
||||||
Options.NeedCanonicalLoop = UserKeepLoops.getNumOccurrences()
|
Options.SinkCommonInsts = UserSinkCommonInsts;
|
||||||
? UserKeepLoops
|
}
|
||||||
: Opts.NeedCanonicalLoop;
|
|
||||||
Options.SinkCommonInsts = UserSinkCommonInsts.getNumOccurrences()
|
SimplifyCFGPass::SimplifyCFGPass(const SimplifyCFGOptions &Opts)
|
||||||
? UserSinkCommonInsts
|
: Options(Opts) {
|
||||||
: Opts.SinkCommonInsts;
|
applyCommandLineOverridesToOptions(Options);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreservedAnalyses SimplifyCFGPass::run(Function &F,
|
PreservedAnalyses SimplifyCFGPass::run(Function &F,
|
||||||
@ -255,20 +255,7 @@ struct CFGSimplifyPass : public FunctionPass {
|
|||||||
initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry());
|
initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry());
|
||||||
|
|
||||||
// Check for command-line overrides of options for debug/customization.
|
// Check for command-line overrides of options for debug/customization.
|
||||||
if (UserBonusInstThreshold.getNumOccurrences())
|
applyCommandLineOverridesToOptions(Options);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runOnFunction(Function &F) override {
|
bool runOnFunction(Function &F) override {
|
||||||
|
Loading…
Reference in New Issue
Block a user