[PATCH] D109976: [CSSPGO] Tweakes to lower pseudo probe runtime overhead

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 17 09:22:12 PDT 2021


hoy created this revision.
Herald added subscribers: modimo, wenlei, hiraditya.
hoy requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

A couple tweaks to

1. allow more thinlto importing by excluding probe intrinsics from IR size in module summary

2. Allow general default attributes (nofree nosync nounwind) for pseudo probe intrinsic.

Test Plan:


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109976

Files:
  llvm/include/llvm/IR/Intrinsics.td
  llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
  llvm/test/Transforms/SampleProfile/pseudo-probe-emit.ll


Index: llvm/test/Transforms/SampleProfile/pseudo-probe-emit.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/pseudo-probe-emit.ll
+++ llvm/test/Transforms/SampleProfile/pseudo-probe-emit.ll
@@ -64,6 +64,9 @@
   ret void
 }
 
+; CHECK-IL: Function Attrs: inaccessiblememonly nofree nosync nounwind willreturn
+; CHECK-IL-NEXT: declare void @llvm.pseudoprobe(i64, i64, i32, i64)
+
 ; CHECK-IL: ![[#FOO:]] = distinct !DISubprogram(name: "foo"
 ; CHECK-IL: ![[#FAKELINE]] = !DILocation(line: 0, scope: ![[#FOO]])
 ; CHECK-IL: ![[#REALLINE]] = !DILocation(line: 2, scope: ![[#FOO]])
Index: llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -279,7 +279,7 @@
     }
 
     for (const Instruction &I : BB) {
-      if (isa<DbgInfoIntrinsic>(I))
+      if (I.isDebugOrPseudoInst())
         continue;
       ++NumInsts;
       // Regular LTO module doesn't participate in ThinLTO import,
Index: llvm/include/llvm/IR/Intrinsics.td
===================================================================
--- llvm/include/llvm/IR/Intrinsics.td
+++ llvm/include/llvm/IR/Intrinsics.td
@@ -1334,7 +1334,7 @@
 // Like the sideeffect intrinsic defined above, this intrinsic is treated by the
 // optimizer as having opaque side effects so that it won't be get rid of or moved
 // out of the block it probes.
-def int_pseudoprobe : Intrinsic<[], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty, llvm_i64_ty],
+def int_pseudoprobe : DefaultAttrsIntrinsic<[], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty, llvm_i64_ty],
                                     [IntrInaccessibleMemOnly, IntrWillReturn]>;
 
 // Arithmetic fence intrinsic.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109976.373252.patch
Type: text/x-patch
Size: 1818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210917/f6c5334a/attachment.bin>


More information about the llvm-commits mailing list