[all-commits] [llvm/llvm-project] 3a423a: [MemProf][PGO] Prevent dropping of profile metadat...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Thu Jan 2 12:12:21 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3a423a10ff83684332195b5191b16f12c81985ba
      https://github.com/llvm/llvm-project/commit/3a423a10ff83684332195b5191b16f12c81985ba
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2025-01-02 (Thu, 02 Jan 2025)

  Changed paths:
    M llvm/include/llvm/IR/Metadata.h
    M llvm/include/llvm/Transforms/Utils/Local.h
    M llvm/lib/Analysis/MemoryProfileInfo.cpp
    M llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
    M llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
    M llvm/lib/Transforms/Utils/Local.cpp
    M llvm/test/Transforms/MemCpyOpt/memcpy.ll
    A llvm/test/Transforms/SimplifyCFG/merge-calls-memprof.ll

  Log Message:
  -----------
  [MemProf][PGO] Prevent dropping of profile metadata during optimization (#121359)

This patch fixes a couple of places where memprof-related metadata
(!memprof and !callsite) were being dropped, and one place where PGO
metadata (!prof) was being dropped.

All were due to instances of combineMetadata() being invoked. That
function drops all metadata not in the list provided by the client, and
also drops any not in its switch statement.

Memprof metadata needed a case in the combineMetadata switch statement.
For now we simply keep the metadata of the instruction being kept, which
doesn't retain all the profile information when two calls with
memprof metadata are being combined, but at least retains some.

For the memprof metadata being dropped during call CSE, add memprof and
callsite metadata to the list of known ids in combineMetadataForCSE.

Neither memprof nor regular prof metadata were in the list of known ids
for the callsite in MemCpyOptimizer, which was added to combine AA
metadata after optimization of byval arguments fed by memcpy
instructions, and similar types of optimizations of memcpy uses.

There is one other callsite of combineMetadata, but it is only invoked
on load instructions, which do not carry these types of metadata.



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