Skip to content

Commit

Permalink
[Attributor][NFC] Add debug counter for AA creation
Browse files Browse the repository at this point in the history
It is not possible to not create an AA at all, which we can use to
bisect problems in the future.
  • Loading branch information
jdoerfert committed Sep 2, 2023
1 parent 2544283 commit 750510c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions llvm/include/llvm/Transforms/IPO/Attributor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 750510c

Please sign in to comment.