HomePhabricator

[CSSPGO] Pseudo probe instrumentation pass

Authored by hoy on Aug 24 2020, 5:52 PM.

Description

[CSSPGO] Pseudo probe instrumentation pass

This change introduces a pseudo probe instrumentation pass for block instrumentation. Please refer to https://reviews.llvm.org/D86193 for the whole story.

Given the following LLVM IR:

define internal void @foo2(i32 %x, void (i32)* %f) !dbg !4 {
bb0:
  %cmp = icmp eq i32 %x, 0
   br i1 %cmp, label %bb1, label %bb2
bb1:
   br label %bb3
bb2:
   br label %bb3
bb3:
   ret void
}

The instrumented IR will look like below. Note that each llvm.pseudoprobe intrinsic call represents a pseudo probe at a block, of which the first parameter is the GUID of the probe’s owner function and the second parameter is the probe’s ID.

define internal void @foo2(i32 %x, void (i32)* %f) !dbg !4 {
bb0:
   %cmp = icmp eq i32 %x, 0
   call void @llvm.pseudoprobe(i64 837061429793323041, i64 1)
   br i1 %cmp, label %bb1, label %bb2
bb1:
   call void @llvm.pseudoprobe(i64 837061429793323041, i64 2)
   br label %bb3
bb2:
   call void @llvm.pseudoprobe(i64 837061429793323041, i64 3)
   br label %bb3
bb3:
   call void @llvm.pseudoprobe(i64 837061429793323041, i64 4)
   ret void
}

Reviewed By: wmi

Differential Revision: https://reviews.llvm.org/D86499

Details

Committed
hoyNov 30 2020, 10:16 AM
Reviewer
wmi
Differential Revision
D86499: [CSSPGO] Pseudo probe instrumentation pass
Parents
rG7c4555f60d96: [PowerPC] Delete remnant Darwin code in PPCAsmParser
Branches
Unknown
Tags
Unknown