[all-commits] [llvm/llvm-project] 70e76e: [BOLT] Fix instrumenting conditional tail calls

Amir Ayupov via All-commits all-commits at lists.llvm.org
Mon Jul 31 13:53:05 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 70e76e0982a9dc27b8c252353609e3a778c2bec0
      https://github.com/llvm/llvm-project/commit/70e76e0982a9dc27b8c252353609e3a778c2bec0
  Author: Amir Ayupov <aaupov at fb.com>
  Date:   2023-07-31 (Mon, 31 Jul 2023)

  Changed paths:
    M bolt/lib/Core/BinaryFunction.cpp
    M bolt/test/runtime/X86/instrumentation-tail-call.s

  Log Message:
  -----------
  [BOLT] Fix instrumenting conditional tail calls

We identify instructions to be instrumented based on Offset annotation.

BOLT "expands" conditional tail calls into a conditional jump to a basic block
with unconditional tail call. Move Offset annotation from former CTC to the tail
call.

For expanded CTC we keep Offset attached to the original instruction which is
converted into a regular conditional jump, while leaving the newly created tail
call without an Offset annotation. This leads to attempting the instrumentation
of the conditional jump which points to the basic block with an inherited input
offset thus creating an invalid edge description. At the same time, the newly
created tail call is skipped entirely which means we're not creating a call
description for it.

If we instead reassign Offset annotation from the conditional jump to the tail
call we fix both issues. The conditional jump will be skipped not creating an
invalid edge description, while tail call will be handled properly (unformly
with regular calls).

Reviewed By: #bolt, maksfb

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




More information about the All-commits mailing list