]> granicus.if.org Git - llvm/commitdiff
[PGO] make graph view internal options available for all builds
authorXinliang David Li <davidxl@google.com>
Thu, 2 Feb 2017 19:18:56 +0000 (19:18 +0000)
committerXinliang David Li <davidxl@google.com>
Thu, 2 Feb 2017 19:18:56 +0000 (19:18 +0000)
Differential Revision: https://reviews.llvm.org/D29259

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293921 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BlockFrequencyInfo.cpp
lib/CodeGen/MachineBlockFrequencyInfo.cpp
lib/CodeGen/MachineBlockPlacement.cpp
lib/Transforms/Instrumentation/PGOInstrumentation.cpp

index 3c57c171e07eb3fa9440efe87bd671cba8275655..2064be577f6c6f14599cd231354394741431a632 100644 (file)
@@ -26,7 +26,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "block-freq"
 
-#ifndef NDEBUG
 static cl::opt<GVDAGType> ViewBlockFreqPropagationDAG(
     "view-block-freq-propagation-dags", cl::Hidden,
     cl::desc("Pop up a window to show a dag displaying how block "
@@ -116,7 +115,6 @@ struct DOTGraphTraits<BlockFrequencyInfo *> : public BFIDOTGTraitsBase {
 };
 
 } // end namespace llvm
-#endif
 
 BlockFrequencyInfo::BlockFrequencyInfo() {}
 
@@ -156,13 +154,11 @@ void BlockFrequencyInfo::calculate(const Function &F,
   if (!BFI)
     BFI.reset(new ImplType);
   BFI->calculate(F, BPI, LI);
-#ifndef NDEBUG
   if (ViewBlockFreqPropagationDAG != GVDT_None &&
       (ViewBlockFreqFuncName.empty() ||
        F.getName().equals(ViewBlockFreqFuncName))) {
     view();
   }
-#endif
 }
 
 BlockFrequency BlockFrequencyInfo::getBlockFreq(const BasicBlock *BB) const {
@@ -214,13 +210,7 @@ void BlockFrequencyInfo::setBlockFreqAndScale(
 /// Pop up a ghostview window with the current block frequency propagation
 /// rendered using dot.
 void BlockFrequencyInfo::view() const {
-// This code is only for debugging.
-#ifndef NDEBUG
   ViewGraph(const_cast<BlockFrequencyInfo *>(this), "BlockFrequencyDAGs");
-#else
-  errs() << "BlockFrequencyInfo::view is only available in debug builds on "
-            "systems with Graphviz or gv!\n";
-#endif // NDEBUG
 }
 
 const Function *BlockFrequencyInfo::getFunction() const {
index d8ee2438ae2d4eaf39acb920b0f5b3a6ee89ac53..856aadc5120f2e4b05adfbee8c45145119255190 100644 (file)
@@ -28,7 +28,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "block-freq"
 
-#ifndef NDEBUG
 
 static cl::opt<GVDAGType> ViewMachineBlockFreqPropagationDAG(
     "view-machine-block-freq-propagation-dags", cl::Hidden,
@@ -145,7 +144,6 @@ struct DOTGraphTraits<MachineBlockFrequencyInfo *>
 };
 
 } // end namespace llvm
-#endif
 
 INITIALIZE_PASS_BEGIN(MachineBlockFrequencyInfo, "machine-block-freq",
                       "Machine Block Frequency Analysis", true, true)
@@ -177,13 +175,11 @@ bool MachineBlockFrequencyInfo::runOnMachineFunction(MachineFunction &F) {
   if (!MBFI)
     MBFI.reset(new ImplType);
   MBFI->calculate(F, MBPI, MLI);
-#ifndef NDEBUG
   if (ViewMachineBlockFreqPropagationDAG != GVDT_None &&
       (ViewBlockFreqFuncName.empty() ||
        F.getName().equals(ViewBlockFreqFuncName))) {
     view();
   }
-#endif
   return false;
 }
 
@@ -193,13 +189,8 @@ void MachineBlockFrequencyInfo::releaseMemory() { MBFI.reset(); }
 /// rendered using dot.
 void MachineBlockFrequencyInfo::view(bool isSimple) const {
 // This code is only for debugging.
-#ifndef NDEBUG
   ViewGraph(const_cast<MachineBlockFrequencyInfo *>(this),
             "MachineBlockFrequencyDAGs", isSimple);
-#else
-  errs() << "MachineBlockFrequencyInfo::view is only available in debug builds "
-            "on systems with Graphviz or gv!\n";
-#endif // NDEBUG
 }
 
 BlockFrequency
index 780be9c1813f4821f56c311d66c4a0b8b0c20b0d..8128efbaf2d97dc5cd3401f629a5870f9f97caf8 100644 (file)
@@ -160,10 +160,8 @@ static cl::opt<unsigned> TailDupPlacementPenalty(
 extern cl::opt<unsigned> StaticLikelyProb;
 extern cl::opt<unsigned> ProfileLikelyProb;
 
-#ifndef NDEBUG
 extern cl::opt<GVDAGType> ViewBlockLayoutWithBFI;
 extern cl::opt<std::string> ViewBlockFreqFuncName;
-#endif
 
 namespace {
 class BlockChain;
@@ -2365,13 +2363,11 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
         MBI->setAlignment(AlignAllNonFallThruBlocks);
     }
   }
-#ifndef NDEBUG
   if (ViewBlockLayoutWithBFI != GVDT_None &&
       (ViewBlockFreqFuncName.empty() ||
        F->getFunction()->getName().equals(ViewBlockFreqFuncName))) {
     MBFI->view(false);
   }
-#endif
 
 
   // We always return true as we have no way to track whether the final order
index b31d27151fc334c3fd2f139133a62faa4ae2af8e..97fe6c89d579b257b5f653dc5ca5f33cb55b21c4 100644 (file)
@@ -1223,7 +1223,6 @@ static bool annotateAllFunctions(
       ColdFunctions.push_back(&F);
     else if (FreqAttr == PGOUseFunc::FFA_Hot)
       HotFunctions.push_back(&F);
-#ifndef NDEBUG
     if (PGOViewCounts &&
         (PGOViewFunction.empty() || F.getName().equals(PGOViewFunction))) {
       LoopInfo LI{DominatorTree(F)};
@@ -1234,7 +1233,6 @@ static bool annotateAllFunctions(
 
       NewBFI->view();
     }
-#endif
     if (PGOViewRawCounts &&
         (PGOViewFunction.empty() || F.getName().equals(PGOViewFunction))) {
       if (PGOViewFunction.empty())