[llvm] ff2f5c3 - Revert "[NFC] SimplifyCFG: refactor/deduplicate command-line settings override handling"
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 04:27:59 PDT 2020
Author: Roman Lebedev
Date: 2020-07-16T14:27:07+03:00
New Revision: ff2f5c3e58a9dfcea19eddeb8894284838df0379
URL: https://github.com/llvm/llvm-project/commit/ff2f5c3e58a9dfcea19eddeb8894284838df0379
DIFF: https://github.com/llvm/llvm-project/commit/ff2f5c3e58a9dfcea19eddeb8894284838df0379.diff
LOG: Revert "[NFC] SimplifyCFG: refactor/deduplicate command-line settings override handling"
Seems to be breaking the bots.
This reverts commit 740a1da108ab9097268b509c85ed9ede7f4d5df5.
Added:
Modified:
llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
index 9d810a1ecfa6..d48d5408dd3c 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
@@ -213,21 +213,22 @@ static bool simplifyFunctionCFG(Function &F, const TargetTransformInfo &TTI,
}
// Command-line settings override compile-time settings.
-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) {
- applyCommandLineOverridesToOptions(Options);
+ 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;
}
PreservedAnalyses SimplifyCFGPass::run(Function &F,
@@ -254,7 +255,20 @@ struct CFGSimplifyPass : public FunctionPass {
initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry());
// Check for command-line overrides of options for debug/customization.
- applyCommandLineOverridesToOptions(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;
}
bool runOnFunction(Function &F) override {
More information about the llvm-commits
mailing list