From d72918903dbc5e4932c97487044872ee8d1f1c7e 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 adbbfee579eb..62fcdcc99d31 100644 --- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp +++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp @@ -838,6 +838,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 fae6b23bf737..3747b2581fa4 100644 --- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll +++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll @@ -230,6 +230,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