[llvm] 75ca0f7 - [AArch64] Don't forcefully add ORE to O0 pipeline (#191476)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 02:43:37 PDT 2026
Author: Alexis Engelke
Date: 2026-04-13T11:43:32+02:00
New Revision: 75ca0f71d209058d1f565d7529e6d1b117129911
URL: https://github.com/llvm/llvm-project/commit/75ca0f71d209058d1f565d7529e6d1b117129911
DIFF: https://github.com/llvm/llvm-project/commit/75ca0f71d209058d1f565d7529e6d1b117129911.diff
LOG: [AArch64] Don't forcefully add ORE to O0 pipeline (#191476)
Construct the OptimizationRemarkEmitter in AArch64StackTagging on demand
if not available and requires, this avoids computing several analysis in
all pipelines.
Added:
Modified:
llvm/lib/Target/AArch64/AArch64StackTagging.cpp
llvm/test/CodeGen/AArch64/O0-pipeline.ll
llvm/test/CodeGen/AArch64/O3-pipeline.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index 787928246eaed..7ef18fa18255d 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -333,7 +333,7 @@ class AArch64StackTagging : public FunctionPass {
AU.addRequired<StackSafetyGlobalInfoWrapperPass>();
if (MergeInit)
AU.addRequired<AAResultsWrapperPass>();
- AU.addRequired<OptimizationRemarkEmitterWrapperPass>();
+ AU.addUsedIfAvailable<OptimizationRemarkEmitterWrapperPass>();
}
};
@@ -518,12 +518,20 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
DL = &Fn.getDataLayout();
if (MergeInit)
AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
- OptimizationRemarkEmitter &ORE =
- getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE();
+
+ std::unique_ptr<OptimizationRemarkEmitter> DeleteORE;
+ OptimizationRemarkEmitter *ORE = nullptr;
+ if (auto *P = getAnalysisIfAvailable<OptimizationRemarkEmitterWrapperPass>())
+ ORE = &P->getORE();
+
+ if (ORE == nullptr) {
+ DeleteORE = std::make_unique<OptimizationRemarkEmitter>(F);
+ ORE = DeleteORE.get();
+ }
memtag::StackInfoBuilder SIB(SSI, DEBUG_TYPE);
for (Instruction &I : instructions(F))
- SIB.visit(ORE, I);
+ SIB.visit(*ORE, I);
memtag::StackInfo &SInfo = SIB.get();
if (SInfo.AllocasToInstrument.empty())
diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
index 32dbe49df0c1d..c0918a1949499 100644
--- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
@@ -11,8 +11,8 @@
; CHECK-NEXT: Target Transform Information
; CHECK-NEXT: Library Function Lowering Analysis
; CHECK-NEXT: Create Garbage Collector Module Metadata
-; CHECK-NEXT: Profile summary info
; CHECK-NEXT: Assumption Cache Tracker
+; CHECK-NEXT: Profile summary info
; CHECK-NEXT: Machine Branch Probability Analysis
; CHECK-NEXT: ModulePass Manager
; CHECK-NEXT: Pre-ISel Intrinsic Lowering
@@ -26,11 +26,6 @@
; CHECK-NEXT: Instrument function entry/exit with calls to e.g. mcount() (post inlining)
; CHECK-NEXT: Scalarize Masked Memory Intrinsics
; CHECK-NEXT: Expand reduction intrinsics
-; CHECK-NEXT: Dominator Tree Construction
-; CHECK-NEXT: Natural Loop Information
-; CHECK-NEXT: Lazy Branch Probability Analysis
-; CHECK-NEXT: Lazy Block Frequency Analysis
-; CHECK-NEXT: Optimization Remark Emitter
; CHECK-NEXT: AArch64 Stack Tagging
; CHECK-NEXT: Exception handling preparation
; CHECK-NEXT: Prepare inline asm insts
diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
index ff4f28a3a50c1..546949aa4e209 100644
--- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
@@ -83,10 +83,6 @@
; CHECK-NEXT: Dominator Tree Construction
; CHECK-NEXT: Basic Alias Analysis (stateless AA impl)
; CHECK-NEXT: Function Alias Analysis Results
-; CHECK-NEXT: Natural Loop Information
-; CHECK-NEXT: Lazy Branch Probability Analysis
-; CHECK-NEXT: Lazy Block Frequency Analysis
-; CHECK-NEXT: Optimization Remark Emitter
; CHECK-NEXT: AArch64 Stack Tagging
; CHECK-NEXT: Complex Deinterleaving Pass
; CHECK-NEXT: Function Alias Analysis Results
More information about the llvm-commits
mailing list