Commit c5fafc1e authored by Hongtao Yu's avatar Hongtao Yu
Browse files

[CSSPGO] Tweakes to lower pseudo probe runtime overhead

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. Without those attributes, pseudo probes will be basically treated as unknown calls which will in turn block their containing functions from annotated with those attributes.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D109976
parent 80d62993
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1334,7 +1334,7 @@ def int_sideeffect : DefaultAttrsIntrinsic<[], [], [IntrInaccessibleMemOnly, Int
// 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.
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ static void computeFunctionSummary(
    }

    for (const Instruction &I : BB) {
      if (isa<DbgInfoIntrinsic>(I))
      if (I.isDebugOrPseudoInst())
        continue;
      ++NumInsts;
      // Regular LTO module doesn't participate in ThinLTO import,
+3 −0
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ entry:
  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]])