[llvm] 50d3495 - [Attributor][NFC] Introduce a debug counter for `AA::manifest`

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 20:08:48 PDT 2020


Author: Johannes Doerfert
Date: 2020-10-27T22:07:56-05:00
New Revision: 50d34958df7b7a335ce4ddc0258ed28273430399

URL: https://github.com/llvm/llvm-project/commit/50d34958df7b7a335ce4ddc0258ed28273430399
DIFF: https://github.com/llvm/llvm-project/commit/50d34958df7b7a335ce4ddc0258ed28273430399.diff

LOG: [Attributor][NFC] Introduce a debug counter for `AA::manifest`

This will simplify debugging and tracking down problems.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/Attributor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 3d7fde4dbff7..81430f132fcf 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -32,6 +32,7 @@
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/DebugCounter.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/GraphWriter.h"
 #include "llvm/Support/raw_ostream.h"
@@ -46,6 +47,9 @@ using namespace llvm;
 
 #define DEBUG_TYPE "attributor"
 
+DEBUG_COUNTER(ManifestDBGCounter, "attributor-manifest",
+              "Determine what attributes are manifested in the IR");
+
 STATISTIC(NumFnDeleted, "Number of function deleted");
 STATISTIC(NumFnWithExactDefinition,
           "Number of functions with exact definitions");
@@ -1127,6 +1131,10 @@ ChangeStatus Attributor::manifestAttributes() {
     // Skip dead code.
     if (isAssumedDead(*AA, nullptr, /* CheckBBLivenessOnly */ true))
       continue;
+    // Check if the manifest debug counter that allows skipping manifestation of
+    // AAs
+    if (!DebugCounter::shouldExecute(ManifestDBGCounter))
+      continue;
     // Manifest the state and record if we changed the IR.
     ChangeStatus LocalChange = AA->manifest(*this);
     if (LocalChange == ChangeStatus::CHANGED && AreStatisticsEnabled())


        


More information about the llvm-commits mailing list