[polly] r194922 - factor out code in shouldEnablePolly
Sebastian Pop
spop at codeaurora.org
Sat Nov 16 07:28:49 PST 2013
Author: spop
Date: Sat Nov 16 09:28:49 2013
New Revision: 194922
URL: http://llvm.org/viewvc/llvm-project?rev=194922&view=rev
Log:
factor out code in shouldEnablePolly
to be able to call the same functionality from registerPollyEarlyAsPossiblePasses
and registerPollyOptLevel0Passes.
Modified:
polly/trunk/lib/RegisterPasses.cpp
Modified: polly/trunk/lib/RegisterPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/RegisterPasses.cpp?rev=194922&r1=194921&r2=194922&view=diff
==============================================================================
--- polly/trunk/lib/RegisterPasses.cpp (original)
+++ polly/trunk/lib/RegisterPasses.cpp Sat Nov 16 09:28:49 2013
@@ -310,12 +310,9 @@ static void registerPollyPasses(llvm::Pa
PM.add(llvm::createCFGPrinterPass());
}
-static void
-registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder,
- llvm::PassManagerBase &PM) {
-
- if (Builder.OptLevel == 0)
- return;
+static bool shouldEnablePolly(unsigned OptLevel) {
+ if (OptLevel == 0)
+ return false;
if (PollyOnlyPrinter || PollyPrinter || PollyOnlyViewer || PollyViewer)
PollyTrackFailures = true;
@@ -324,7 +321,14 @@ registerPollyEarlyAsPossiblePasses(const
ExportJScop || ImportJScop)
PollyEnabled = true;
- if (!PollyEnabled)
+ return PollyEnabled;
+}
+
+static void
+registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder,
+ llvm::PassManagerBase &PM) {
+
+ if (!shouldEnablePolly(Builder.OptLevel))
return;
// We only run Polly at optimization level '-O3'.
@@ -340,9 +344,10 @@ registerPollyEarlyAsPossiblePasses(const
registerPollyPasses(PM);
}
-static void registerPollyOptLevel0Passes(const llvm::PassManagerBuilder &,
+static void registerPollyOptLevel0Passes(const llvm::PassManagerBuilder &Builder,
llvm::PassManagerBase &PM) {
- registerCanonicalicationPasses(PM);
+ if (shouldEnablePolly(Builder.OptLevel))
+ registerCanonicalicationPasses(PM);
}
/// @brief Register Polly canonicalization passes at opt level '0'
More information about the llvm-commits
mailing list