[all-commits] [llvm/llvm-project] 73c3b7: [ctx_prof] Add support for ICP (#105469)

Mircea Trofin via All-commits all-commits at lists.llvm.org
Tue Aug 27 15:50:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 73c3b7337b0a3a8cb447f9801341d5648aebe9b2
      https://github.com/llvm/llvm-project/commit/73c3b7337b0a3a8cb447f9801341d5648aebe9b2
  Author: Mircea Trofin <mtrofin at google.com>
  Date:   2024-08-27 (Tue, 27 Aug 2024)

  Changed paths:
    M llvm/include/llvm/Analysis/CtxProfAnalysis.h
    M llvm/include/llvm/IR/IntrinsicInst.h
    M llvm/include/llvm/ProfileData/PGOCtxProfReader.h
    M llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h
    M llvm/lib/Analysis/CtxProfAnalysis.cpp
    M llvm/lib/IR/IntrinsicInst.cpp
    M llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
    M llvm/unittests/Transforms/Utils/CallPromotionUtilsTest.cpp

  Log Message:
  -----------
  [ctx_prof] Add support for ICP (#105469)

An overload of `llvm::promoteCallWithIfThenElse` that updates the contextual profile.

High-level, this is very simple: after creating the `if... then (direct call) else (indirect call)` structure, we instrument the new callsites and BBs (the instrumentation will help with tracking for other IPO transformations, and, ultimately, to match counter values before flattening to `MD_prof`).

In more detail:

- move the callsite instrumentation of the indirect call to the `else` BB, before the indirect call
- create a new callsite instrumentation for the direct call
- create instrumentation for both the `then` and `else` BBs - we could instrument just one (MST-style) but we're not running the binary with this instrumentation, and at most this would save some space (less counters tracked). For simplicity instrumenting both at this point
- update each context belonging to the caller by updating the counters, and moving the indirect callee to the new, direct callsite ID

Issue #89287



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list