[llvm] 750510c - [Attributor][NFC] Add debug counter for AA creation

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 17:18:04 PDT 2023


Author: Johannes Doerfert
Date: 2023-09-01T17:17:51-07:00
New Revision: 750510c648bad1fc6efe6b371185124767ba79e1

URL: https://github.com/llvm/llvm-project/commit/750510c648bad1fc6efe6b371185124767ba79e1
DIFF: https://github.com/llvm/llvm-project/commit/750510c648bad1fc6efe6b371185124767ba79e1.diff

LOG: [Attributor][NFC] Add debug counter for AA creation

It is not possible to not create an AA at all, which we can use to
bisect problems in the future.

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/IPO/Attributor.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h
index af28cbfd1f3316e..50795f1de791b16 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<AAType>(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);


        


More information about the llvm-commits mailing list