diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 3d7fde4dbff7a..81430f132fcfd 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())