[polly] r206852 - [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE

Chandler Carruth chandlerc at gmail.com
Mon Apr 21 20:30:20 PDT 2014


Author: chandlerc
Date: Mon Apr 21 22:30:19 2014
New Revision: 206852

URL: http://llvm.org/viewvc/llvm-project?rev=206852&view=rev
Log:
[Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
definition below all of the header #include lines, Polly edition.

If you want to know more details about this, you can see the recent
commits to Debug.h in LLVM. This is just the Polly segment of a cleanup
I'm doing globally for this macro.

Modified:
    polly/trunk/include/polly/ScopDetectionDiagnostic.h
    polly/trunk/lib/Analysis/Dependences.cpp
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/Analysis/TempScopInfo.cpp
    polly/trunk/lib/CodeGen/Cloog.cpp
    polly/trunk/lib/CodeGen/CodeGeneration.cpp
    polly/trunk/lib/CodeGen/IslAst.cpp
    polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
    polly/trunk/lib/Exchange/JSONExporter.cpp
    polly/trunk/lib/Support/SCEVValidator.cpp
    polly/trunk/lib/Support/ScopHelper.cpp
    polly/trunk/lib/Transform/IndVarSimplify.cpp
    polly/trunk/lib/Transform/IndependentBlocks.cpp
    polly/trunk/lib/Transform/Pluto.cpp
    polly/trunk/lib/Transform/Pocc.cpp
    polly/trunk/lib/Transform/ScheduleOptimizer.cpp

Modified: polly/trunk/include/polly/ScopDetectionDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetectionDiagnostic.h?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetectionDiagnostic.h (original)
+++ polly/trunk/include/polly/ScopDetectionDiagnostic.h Mon Apr 21 22:30:19 2014
@@ -23,12 +23,11 @@
 #include "llvm/IR/Value.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include <string>
 
 #define DEBUG_TYPE "polly-detect"
-#include "llvm/Support/Debug.h"
-
-#include <string>
 
 #define BADSCOP_STAT(NAME, DESC)                                               \
   STATISTIC(Bad##NAME##ForScop, "Number of bad regions for Scop: " DESC)

Modified: polly/trunk/lib/Analysis/Dependences.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/Dependences.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/Dependences.cpp (original)
+++ polly/trunk/lib/Analysis/Dependences.cpp Mon Apr 21 22:30:19 2014
@@ -25,6 +25,8 @@
 #include "polly/Options.h"
 #include "polly/ScopInfo.h"
 #include "polly/Support/GICHelper.h"
+#include "llvm/Support/Debug.h"
+
 #include <isl/aff.h>
 #include <isl/ctx.h>
 #include <isl/flow.h>
@@ -32,12 +34,11 @@
 #include <isl/options.h>
 #include <isl/set.h>
 
-#define DEBUG_TYPE "polly-dependence"
-#include "llvm/Support/Debug.h"
-
 using namespace polly;
 using namespace llvm;
 
+#define DEBUG_TYPE "polly-dependence"
+
 static cl::opt<int>
 OptComputeOut("polly-dependences-computeout",
               cl::desc("Bound the dependence analysis by a maximal amount of "

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Mon Apr 21 22:30:19 2014
@@ -61,15 +61,14 @@
 #include "llvm/IR/DiagnosticInfo.h"
 #include "llvm/IR/DiagnosticPrinter.h"
 #include "llvm/IR/LLVMContext.h"
-
-#define DEBUG_TYPE "polly-detect"
 #include "llvm/Support/Debug.h"
-
 #include <set>
 
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-detect"
+
 static cl::opt<bool>
 DetectScopsWithoutLoops("polly-detect-scops-in-functions-without-loops",
                         cl::desc("Detect scops in functions without loops"),

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Apr 21 22:30:19 2014
@@ -31,8 +31,6 @@
 #include "llvm/Analysis/RegionIterator.h"
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "llvm/Support/CommandLine.h"
-
-#define DEBUG_TYPE "polly-scops"
 #include "llvm/Support/Debug.h"
 
 #include "isl/constraint.h"
@@ -44,6 +42,7 @@
 #include "isl/local_space.h"
 #include "isl/options.h"
 #include "isl/val.h"
+
 #include <sstream>
 #include <string>
 #include <vector>
@@ -51,6 +50,8 @@
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-scops"
+
 STATISTIC(ScopFound, "Number of valid Scops");
 STATISTIC(RichScopFound, "Number of Scops containing a loop");
 

Modified: polly/trunk/lib/Analysis/TempScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/TempScopInfo.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/TempScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/TempScopInfo.cpp Mon Apr 21 22:30:19 2014
@@ -26,13 +26,13 @@
 #include "llvm/Analysis/ScalarEvolution.h"
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "llvm/IR/DataLayout.h"
-
-#define DEBUG_TYPE "polly-analyze-ir"
 #include "llvm/Support/Debug.h"
 
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-analyze-ir"
+
 //===----------------------------------------------------------------------===//
 /// Helper Classes
 

Modified: polly/trunk/lib/CodeGen/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Cloog.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Cloog.cpp (original)
+++ polly/trunk/lib/CodeGen/Cloog.cpp Mon Apr 21 22:30:19 2014
@@ -27,7 +27,6 @@
 #include "polly/LinkAllPasses.h"
 #include "polly/ScopInfo.h"
 
-#define DEBUG_TYPE "polly-cloog"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/Debug.h"
 
@@ -39,6 +38,8 @@
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-cloog"
+
 namespace polly {
 class Cloog {
   Scop *S;

Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Mon Apr 21 22:30:19 2014
@@ -23,7 +23,6 @@
 #include "polly/CodeGen/Cloog.h"
 #ifdef CLOOG_FOUND
 
-#define DEBUG_TYPE "polly-codegen"
 #include "polly/Dependences.h"
 #include "polly/LinkAllPasses.h"
 #include "polly/Options.h"
@@ -58,6 +57,8 @@
 using namespace polly;
 using namespace llvm;
 
+#define DEBUG_TYPE "polly-codegen"
+
 struct isl_set;
 
 namespace polly {

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Mon Apr 21 22:30:19 2014
@@ -25,8 +25,6 @@
 #include "polly/LinkAllPasses.h"
 #include "polly/Options.h"
 #include "polly/ScopInfo.h"
-
-#define DEBUG_TYPE "polly-ast"
 #include "llvm/Support/Debug.h"
 
 #include "isl/union_map.h"
@@ -39,6 +37,8 @@
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-ast"
+
 static cl::opt<bool> UseContext("polly-ast-use-context",
                                 cl::desc("Use context"), cl::Hidden,
                                 cl::init(false), cl::ZeroOrMore,

Modified: polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslCodeGeneration.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/IslCodeGeneration.cpp Mon Apr 21 22:30:19 2014
@@ -33,7 +33,6 @@
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/ScalarEvolutionExpander.h"
 #include "llvm/IR/Module.h"
-#define DEBUG_TYPE "polly-codegen-isl"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/IR/DataLayout.h"
@@ -52,6 +51,8 @@
 using namespace polly;
 using namespace llvm;
 
+#define DEBUG_TYPE "polly-codegen-isl"
+
 /// @brief Insert function calls that print certain LLVM values at run time.
 ///
 /// This class inserts libc function calls to print certain LLVM values at

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Mon Apr 21 22:30:19 2014
@@ -22,8 +22,6 @@
 #include "llvm/Support/ToolOutputFile.h"
 #include "llvm/Support/system_error.h"
 
-#define DEBUG_TYPE "polly-import-jscop"
-
 #include "json/reader.h"
 #include "json/writer.h"
 
@@ -37,6 +35,8 @@
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-import-jscop"
+
 STATISTIC(NewAccessMapFound, "Number of updated access functions");
 
 namespace {

Modified: polly/trunk/lib/Support/SCEVValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/SCEVValidator.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Support/SCEVValidator.cpp (original)
+++ polly/trunk/lib/Support/SCEVValidator.cpp Mon Apr 21 22:30:19 2014
@@ -1,17 +1,17 @@
 
 #include "polly/Support/SCEVValidator.h"
 #include "polly/ScopInfo.h"
-
-#define DEBUG_TYPE "polly-scev-validator"
-#include "llvm/Support/Debug.h"
 #include "llvm/Analysis/ScalarEvolution.h"
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "llvm/Analysis/RegionInfo.h"
+#include "llvm/Support/Debug.h"
 
 #include <vector>
 
 using namespace llvm;
 
+#define DEBUG_TYPE "polly-scev-validator"
+
 namespace SCEVType {
 /// @brief The type of a SCEV
 ///

Modified: polly/trunk/lib/Support/ScopHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ScopHelper.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Support/ScopHelper.cpp (original)
+++ polly/trunk/lib/Support/ScopHelper.cpp Mon Apr 21 22:30:19 2014
@@ -18,13 +18,13 @@
 #include "llvm/Analysis/ScalarEvolution.h"
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "llvm/IR/CFG.h"
-#include "llvm/Transforms/Utils/BasicBlockUtils.h"
-
-#define DEBUG_TYPE "polly-scop-helper"
 #include "llvm/Support/Debug.h"
+#include "llvm/Transforms/Utils/BasicBlockUtils.h"
 
 using namespace llvm;
 
+#define DEBUG_TYPE "polly-scop-helper"
+
 // Helper function for Scop
 // TODO: Add assertion to not allow parameter to be null
 //===----------------------------------------------------------------------===//

Modified: polly/trunk/lib/Transform/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/IndVarSimplify.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Transform/IndVarSimplify.cpp (original)
+++ polly/trunk/lib/Transform/IndVarSimplify.cpp Mon Apr 21 22:30:19 2014
@@ -24,8 +24,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "indvars"
-
 #include "polly/LinkAllPasses.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
@@ -52,6 +50,8 @@
 #include "llvm/Transforms/Utils/SimplifyIndVar.h"
 using namespace llvm;
 
+#define DEBUG_TYPE "indvars"
+
 STATISTIC(NumRemoved, "Number of aux indvars removed");
 STATISTIC(NumWidened, "Number of indvars widened");
 STATISTIC(NumInserted, "Number of canonical indvars added");

Modified: polly/trunk/lib/Transform/IndependentBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/IndependentBlocks.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Transform/IndependentBlocks.cpp (original)
+++ polly/trunk/lib/Transform/IndependentBlocks.cpp Mon Apr 21 22:30:19 2014
@@ -22,7 +22,6 @@
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/Support/CommandLine.h"
-#define DEBUG_TYPE "polly-independent"
 #include "llvm/Support/Debug.h"
 
 #include <vector>
@@ -30,6 +29,8 @@
 using namespace polly;
 using namespace llvm;
 
+#define DEBUG_TYPE "polly-independent"
+
 static cl::opt<bool> DisableIntraScopScalarToArray(
     "disable-polly-intra-scop-scalar-to-array",
     cl::desc("Do not rewrite scalar to array to generate independent blocks"),

Modified: polly/trunk/lib/Transform/Pluto.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Pluto.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Pluto.cpp (original)
+++ polly/trunk/lib/Transform/Pluto.cpp Mon Apr 21 22:30:19 2014
@@ -20,8 +20,6 @@
 #include "polly/Options.h"
 #include "polly/ScopInfo.h"
 #include "polly/Support/GICHelper.h"
-
-#define DEBUG_TYPE "polly-opt-pluto"
 #include "llvm/Support/Debug.h"
 
 #include "pluto/libpluto.h"
@@ -30,6 +28,8 @@
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-opt-pluto"
+
 static cl::opt<bool> EnableTiling("polly-pluto-tile", cl::desc("Enable tiling"),
                                   cl::Hidden, cl::init(false), cl::ZeroOrMore,
                                   cl::cat(PollyCategory));

Modified: polly/trunk/lib/Transform/Pocc.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Pocc.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Pocc.cpp (original)
+++ polly/trunk/lib/Transform/Pocc.cpp Mon Apr 21 22:30:19 2014
@@ -24,8 +24,7 @@
 #include "polly/Options.h"
 #include "polly/ScheduleOptimizer.h"
 #include "polly/ScopInfo.h"
-
-#define DEBUG_TYPE "polly-opt-pocc"
+#include "polly/ScopLib.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
@@ -34,8 +33,6 @@
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/SmallString.h"
 
-#include "polly/ScopLib.h"
-
 #include "isl/space.h"
 #include "isl/map.h"
 #include "isl/constraint.h"
@@ -43,6 +40,8 @@
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-opt-pocc"
+
 static cl::opt<std::string> PlutoFuse("pluto-fuse", cl::desc(""), cl::Hidden,
                                       cl::value_desc("Set fuse mode of Pluto"),
                                       cl::init("maxfuse"),

Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=206852&r1=206851&r2=206852&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Mon Apr 21 22:30:19 2014
@@ -30,13 +30,13 @@
 #include "polly/LinkAllPasses.h"
 #include "polly/Options.h"
 #include "polly/ScopInfo.h"
-
-#define DEBUG_TYPE "polly-opt-isl"
 #include "llvm/Support/Debug.h"
 
 using namespace llvm;
 using namespace polly;
 
+#define DEBUG_TYPE "polly-opt-isl"
+
 namespace polly {
 bool DisablePollyTiling;
 }





More information about the llvm-commits mailing list