diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index af28cbfd1f331..50795f1de791b 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -128,6 +128,7 @@ #include "llvm/Support/Allocator.h" #include "llvm/Support/Casting.h" #include "llvm/Support/DOTGraphTraits.h" +#include "llvm/Support/DebugCounter.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ModRef.h" #include "llvm/Support/TimeProfiler.h" @@ -1460,6 +1461,10 @@ struct AttributorConfig { IPOAmendableCBTy IPOAmendableCB; }; +/// A debug counter to limit the number of AAs created. +DEBUG_COUNTER(NumAbstractAttributes, "num-abstract-attributes", + "How many AAs should be initialized"); + /// The fixpoint analysis framework that orchestrates the attribute deduction. /// /// The Attributor provides a general abstract analysis framework (guided @@ -1572,6 +1577,9 @@ struct Attributor { if (!shouldInitialize(IRP, ShouldUpdateAA)) return nullptr; + if (!DebugCounter::shouldExecute(NumAbstractAttributes)) + return nullptr; + // No matching attribute found, create one. // Use the static create method. auto &AA = AAType::createForPosition(IRP, *this);