[Propeller] Match debug info filenames from profiles to distinguish internal linkage...
authorRahman Lavaee <rahmanl@google.com>
Tue, 27 Jun 2023 20:11:45 +0000 (20:11 +0000)
committerRahman Lavaee <rahmanl@google.com>
Tue, 27 Jun 2023 21:28:28 +0000 (21:28 +0000)
commitc13b046de338d2751283b1abbe9dd61e96ac05c8
tree0b485bc3f87204f71631bca10621f217e197162f
parentca7914564e676fe52fa80049d9c6932653522424
[Propeller] Match debug info filenames from profiles to distinguish internal linkage functions with the same names.

Basic block sections profiles are ingested based on the function name. However, conflicts may occur when internal linkage functions with the same symbol name are linked into the binary (for instance static functions defined in different modules). Currently, these functions cannot be optimized unless we use `-funique-internal-linkage-names` (D89617) to enforce unique symbol names.

However, we have found that `-funique-internal-linkage-names` does not play well with inline assembly code which refers to the symbol via its symbol name. For example, the Linux kernel does not build with this option.

This patch implements a new feature which allows differentiating profiles based on the debug info filenames associated with each function. When specified, the given path is compared against the debug info filename of the matching function and profile is ingested only when the debug info filenames match. Backward-compatibility is guaranteed as omitting the specifiers from the profile would allow them to be matched by function name only. Also specifiers can be included for a subset of functions only.

Reviewed By: shenhan

Differential Revision: https://reviews.llvm.org/D146770
llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
llvm/lib/CodeGen/BasicBlockSections.cpp
llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
llvm/test/CodeGen/X86/basic-block-sections-clusters-error.ll
llvm/test/CodeGen/X86/basic-block-sections-module1.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/basic-block-sections-module2.ll [new file with mode: 0644]