aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BasicBlockSections.cpp
diff options
context:
space:
mode:
authorRahman Lavaee <rahmanl@google.com>2023-06-27 20:11:45 +0000
committerRahman Lavaee <rahmanl@google.com>2023-06-27 21:28:28 +0000
commitc13b046de338d2751283b1abbe9dd61e96ac05c8 (patch)
tree0b485bc3f87204f71631bca10621f217e197162f /llvm/lib/CodeGen/BasicBlockSections.cpp
parentca7914564e676fe52fa80049d9c6932653522424 (diff)
downloadllvm-c13b046de338d2751283b1abbe9dd61e96ac05c8.zip
llvm-c13b046de338d2751283b1abbe9dd61e96ac05c8.tar.gz
llvm-c13b046de338d2751283b1abbe9dd61e96ac05c8.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/BasicBlockSections.cpp')
-rw-r--r--llvm/lib/CodeGen/BasicBlockSections.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp
index 5cbd53f..6967ca5 100644
--- a/llvm/lib/CodeGen/BasicBlockSections.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSections.cpp
@@ -123,10 +123,16 @@ public:
} // end anonymous namespace
char BasicBlockSections::ID = 0;
-INITIALIZE_PASS(BasicBlockSections, "bbsections-prepare",
- "Prepares for basic block sections, by splitting functions "
- "into clusters of basic blocks.",
- false, false)
+INITIALIZE_PASS_BEGIN(
+ BasicBlockSections, "bbsections-prepare",
+ "Prepares for basic block sections, by splitting functions "
+ "into clusters of basic blocks.",
+ false, false)
+INITIALIZE_PASS_DEPENDENCY(BasicBlockSectionsProfileReader)
+INITIALIZE_PASS_END(BasicBlockSections, "bbsections-prepare",
+ "Prepares for basic block sections, by splitting functions "
+ "into clusters of basic blocks.",
+ false, false)
// This function updates and optimizes the branching instructions of every basic
// block in a given function to account for changes in the layout.