[polly] r283671 - Turn cl::values() (for enum) from a vararg function to using C++ variadic template

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 8 12:41:09 PDT 2016


Author: mehdi_amini
Date: Sat Oct  8 14:41:06 2016
New Revision: 283671

URL: http://llvm.org/viewvc/llvm-project?rev=283671&view=rev
Log:
Turn cl::values() (for enum) from a vararg function to using C++ variadic template

The core of the change is supposed to be NFC, however it also fixes
what I believe was an undefined behavior when calling:

 va_start(ValueArgs, Desc);

with Desc being a StringRef.

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

Modified:
    polly/trunk/lib/Analysis/DependenceInfo.cpp
    polly/trunk/lib/CodeGen/IslExprBuilder.cpp
    polly/trunk/lib/Support/RegisterPasses.cpp

Modified: polly/trunk/lib/Analysis/DependenceInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/DependenceInfo.cpp?rev=283671&r1=283670&r2=283671&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/DependenceInfo.cpp (original)
+++ polly/trunk/lib/Analysis/DependenceInfo.cpp Sat Oct  8 14:41:06 2016
@@ -65,8 +65,7 @@ static cl::opt<enum AnalysisType> OptAna
     cl::values(clEnumValN(VALUE_BASED_ANALYSIS, "value-based",
                           "Exact dependences without transitive dependences"),
                clEnumValN(MEMORY_BASED_ANALYSIS, "memory-based",
-                          "Overapproximation of dependences"),
-               clEnumValEnd),
+                          "Overapproximation of dependences")),
     cl::Hidden, cl::init(VALUE_BASED_ANALYSIS), cl::ZeroOrMore,
     cl::cat(PollyCategory));
 
@@ -80,8 +79,7 @@ static cl::opt<Dependences::AnalyisLevel
                           " accessed references in the same statement"),
                clEnumValN(Dependences::AL_Access, "access-wise",
                           "Memory reference level analysis that distinguish"
-                          " access instructions in the same statement"),
-               clEnumValEnd),
+                          " access instructions in the same statement")),
     cl::Hidden, cl::init(Dependences::AL_Statement), cl::ZeroOrMore,
     cl::cat(PollyCategory));
 

Modified: polly/trunk/lib/CodeGen/IslExprBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslExprBuilder.cpp?rev=283671&r1=283670&r2=283671&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslExprBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslExprBuilder.cpp Sat Oct  8 14:41:06 2016
@@ -35,8 +35,7 @@ static cl::opt<OverflowTrackingChoice> O
                clEnumValN(OT_REQUEST, "request",
                           "Track the overflow bit if requested."),
                clEnumValN(OT_ALWAYS, "always",
-                          "Always track the overflow bit."),
-               clEnumValEnd),
+                          "Always track the overflow bit.")),
     cl::Hidden, cl::init(OT_REQUEST), cl::ZeroOrMore, cl::cat(PollyCategory));
 
 IslExprBuilder::IslExprBuilder(Scop &S, PollyIRBuilder &Builder,

Modified: polly/trunk/lib/Support/RegisterPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/RegisterPasses.cpp?rev=283671&r1=283670&r2=283671&view=diff
==============================================================================
--- polly/trunk/lib/Support/RegisterPasses.cpp (original)
+++ polly/trunk/lib/Support/RegisterPasses.cpp Sat Oct  8 14:41:06 2016
@@ -67,16 +67,14 @@ static cl::opt<PassPositionChoice> PassP
         clEnumValN(POSITION_AFTER_LOOPOPT, "after-loopopt",
                    "After the loop optimizer (but within the inline cycle)"),
         clEnumValN(POSITION_BEFORE_VECTORIZER, "before-vectorizer",
-                   "Right before the vectorizer"),
-        clEnumValEnd),
+                   "Right before the vectorizer")),
     cl::Hidden, cl::init(POSITION_EARLY), cl::ZeroOrMore,
     cl::cat(PollyCategory));
 
 static cl::opt<OptimizerChoice> Optimizer(
     "polly-optimizer", cl::desc("Select the scheduling optimizer"),
     cl::values(clEnumValN(OPTIMIZER_NONE, "none", "No optimizer"),
-               clEnumValN(OPTIMIZER_ISL, "isl", "The isl scheduling optimizer"),
-               clEnumValEnd),
+               clEnumValN(OPTIMIZER_ISL, "isl", "The isl scheduling optimizer")),
     cl::Hidden, cl::init(OPTIMIZER_ISL), cl::ZeroOrMore,
     cl::cat(PollyCategory));
 
@@ -85,18 +83,17 @@ static cl::opt<CodeGenChoice> CodeGenera
     "polly-code-generation", cl::desc("How much code-generation to perform"),
     cl::values(clEnumValN(CODEGEN_FULL, "full", "AST and IR generation"),
                clEnumValN(CODEGEN_AST, "ast", "Only AST generation"),
-               clEnumValN(CODEGEN_NONE, "none", "No code generation"),
-               clEnumValEnd),
+               clEnumValN(CODEGEN_NONE, "none", "No code generation")),
     cl::Hidden, cl::init(CODEGEN_FULL), cl::ZeroOrMore, cl::cat(PollyCategory));
 
 enum TargetChoice { TARGET_CPU, TARGET_GPU };
 static cl::opt<TargetChoice>
     Target("polly-target", cl::desc("The hardware to target"),
-           cl::values(clEnumValN(TARGET_CPU, "cpu", "generate CPU code"),
+           cl::values(clEnumValN(TARGET_CPU, "cpu", "generate CPU code")
 #ifdef GPU_CODEGEN
-                      clEnumValN(TARGET_GPU, "gpu", "generate GPU code"),
+                      , clEnumValN(TARGET_GPU, "gpu", "generate GPU code")
 #endif
-                      clEnumValEnd),
+                      ),
            cl::init(TARGET_CPU), cl::ZeroOrMore, cl::cat(PollyCategory));
 
 VectorizerChoice polly::PollyVectorizerChoice;
@@ -107,8 +104,7 @@ static cl::opt<polly::VectorizerChoice,
         clEnumValN(polly::VECTORIZER_POLLY, "polly",
                    "Polly internal vectorizer"),
         clEnumValN(polly::VECTORIZER_STRIPMINE, "stripmine",
-                   "Strip-mine outer loops for the loop-vectorizer to trigger"),
-        clEnumValEnd),
+                   "Strip-mine outer loops for the loop-vectorizer to trigger")),
     cl::location(PollyVectorizerChoice), cl::init(polly::VECTORIZER_NONE),
     cl::ZeroOrMore, cl::cat(PollyCategory));
 




More information about the llvm-commits mailing list