From 9e65b133a9a391d5c0cc1cdc1276300494945cea Mon Sep 17 00:00:00 2001 From: Szymon Sobieszek Date: Thu, 14 Aug 2025 16:26:47 -0400 Subject: [PATCH] The PSEUDO_PROBE pseudo instruction for CSSPGO is not inserted in the AArch64 backend, which results in lack of value profiling metadata and hence indirect call promotion cannot be done due to lack of call target information. This commit does the insertion of the pseudo probe instructions. --- llvm/lib/Target/AArch64/AArch64TargetMachine.cpp | 3 +++ llvm/test/CodeGen/AArch64/O3-pipeline.ll | 1 + 2 files changed, 4 insertions(+) diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp index 93b0f5c7e697..98b990fdce8c 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp @@ -831,6 +831,9 @@ void AArch64PassConfig::addPostBBSections() { } void AArch64PassConfig::addPreEmitPass2() { + // Insert pseudo probe annotation for callsite profiling + addPass(createPseudoProbeInserter()); + // SVE bundles move prefixes with destructive operations. BLR_RVMARKER pseudo // instructions are lowered to bundles as well. addPass(createUnpackMachineBundles(nullptr)); diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll index 0b55d2a266e7..2a07b4ffa6e3 100644 --- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll +++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll @@ -228,6 +228,7 @@ ; CHECK-NEXT: Lazy Machine Block Frequency Analysis ; CHECK-NEXT: Machine Optimization Remark Emitter ; CHECK-NEXT: Stack Frame Layout Analysis +; CHECK-NEXT: Pseudo Probe Inserter ; CHECK-NEXT: Unpack machine instruction bundles ; CHECK-NEXT: Lazy Machine Block Frequency Analysis ; CHECK-NEXT: Machine Optimization Remark Emitter -- Gitee