[PATCH] D153771: [BOLT][Instrumentation] Fix hash table memory corruption and append-pid option

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 01:19:45 PDT 2023


treapster added inline comments.


================
Comment at: bolt/test/runtime/instrumentation-indirect-2.c:96-97
+# process and vice versa.
+RUN: cat %t.$child_pid.fdata | FileCheck %s --check-prefix=CHECK-CHILD
+RUN: cat %t.$par_pid.fdata | FileCheck %s --check-prefix=CHECK-PARENT
+
----------------
rafauler wrote:
> This can accidentally match other entries in the profile, such as the activity in funcX calling printf(). I imagine what we want to match is the indirect call itself, right? For that I would rather use:
> 
> 
>   RUN: llvm-bolt %t.exe -data %t.child.fdata \
>   RUN:   -print-finalized -print-only=main -o /dev/null | FileCheck %s --check-prefix=CHECK_CHILD
> 
> And then match this string:
>     {{.*}}:   callq   *%rax # CallProfile: 8 (0 misses) :
>         { func1: 1 (0 misses) },
>         { func3: 1 (0 misses) },
> ...
> 
> 
> Actually, I ran BOLT like that and surprisingly the profile is incorrect and it is printing this:
> .LFT15 (8 instructions, align : 1)
>   Exec Count : 8
>   CFI State : 3
>   Predecessors: .Ltmp10
>     000000d1:   movslq  -0x94(%rbp), %rax
>     000000d8:   movq    -0x90(%rbp,%rax,8), %rax
>     000000e0:   movl    -0x98(%rbp), %edi
>     000000e6:   callq   *%rax # CallProfile: 8 (0 misses) :
>         { <unknown>: 1 (0 misses) },
>         { <unknown>: 1 (0 misses) },
>         { <unknown>: 1 (0 misses) },
>         { <unknown>: 1 (0 misses) },
>         { <unknown>: 1 (0 misses) },
>         { <unknown>: 1 (0 misses) },
>         { <unknown>: 1 (0 misses) },
>         { <unknown>: 1 (0 misses) }
>     000000e8:   movl    -0x94(%rbp), %eax
>     000000ee:   addl    $0x2, %eax
>     000000f1:   movl    %eax, -0x94(%rbp)
>     000000f7:   jmp     .Ltmp10
>   Successors: .Ltmp10 (mispreds: 0, count: 8)
> 
> 
> 
> I'm not sure why yet.
If we match instructions, it unnecessarily becomes arch-specific. I think we need to figure out why indirect calls are not recorded in profile and construct a regex to match them there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153771/new/

https://reviews.llvm.org/D153771



More information about the llvm-commits mailing list