[clang] aaaa253 - [Passes] Add StandardInstrumentation to runCodeGenPipeline (#238671)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 23:01:02 PST 2026


Author: Aiden Grossman
Date: 2026-11-03T23:00:52-08:00
New Revision: aaaa25337b3c78f4953baa3b98fceaae9c961ea9

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

LOG: [Passes] Add StandardInstrumentation to runCodeGenPipeline (#238671)

Added: 
    clang/test/Misc/codegen-printer.c

Modified: 
    llvm/lib/Passes/RunCodeGen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Misc/codegen-printer.c b/clang/test/Misc/codegen-printer.c
new file mode 100644
index 00000000000000..ed1ce73d5ee616
--- /dev/null
+++ b/clang/test/Misc/codegen-printer.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -O3 -S -mllvm -print-after-all \
+// RUN:   -mllvm -force-new-pm-codegen -o %t 2>&1 | FileCheck %s
+
+// CHECK: *** IR Dump After CodeGenPreparePass
+// CHECK: *** IR Dump After X86AsmPrinterPas
+
+void foo() {}

diff  --git a/llvm/lib/Passes/RunCodeGen.cpp b/llvm/lib/Passes/RunCodeGen.cpp
index 67aecdb6f5494c..d66b62ca3ac27c 100644
--- a/llvm/lib/Passes/RunCodeGen.cpp
+++ b/llvm/lib/Passes/RunCodeGen.cpp
@@ -18,6 +18,7 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Passes/PassBuilder.h"
+#include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/CodeGen.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/raw_ostream.h"
@@ -75,6 +76,9 @@ static Error runCodeGenPipelineNewPM(TargetMachine &TM, Module &M,
   PB.registerMachineFunctionAnalyses(MFAM);
   PB.crossRegisterProxies(LAM, FAM, CGAM, MAM, &MFAM);
 
+  StandardInstrumentations SI(M.getContext(), /*DebugLogging=*/false);
+  SI.registerCallbacks(PIC, &MAM);
+
   MAM.registerPass([&] { return MachineModuleAnalysis(MMI); });
 
   Error BuildPipelineError = TM.buildCodeGenPipeline(


        


More information about the cfe-commits mailing list