Append ".__part." to every basic block section symbol.
authorSriraman Tallam <tmsriram@google.com>
Wed, 23 Dec 2020 17:51:35 +0000 (09:51 -0800)
committerSriraman Tallam <tmsriram@google.com>
Wed, 23 Dec 2020 19:35:44 +0000 (11:35 -0800)
commit34e70d722dfd0e73d460802e8d43d3a885d24784
treea42e8ae53427a34ed7c5b8a7f9cebb503f0fdfda
parenta16fbff17d329c3f2cc1e49d501f61b3996e9b8a
Append ".__part." to every basic block section symbol.

Every basic block section symbol created by -fbasic-block-sections will contain
".__part." to know that this symbol corresponds to a basic block fragment of
the function.

This patch solves two problems:

a) Like D89617, we want function symbols with suffixes to be properly qualified
   so that external tools like profile aggregators know exactly what this
   symbol corresponds to.
b) The current basic block naming just adds a ".N" to the symbol name where N is
   some integer. This collides with how clang creates __cxx_global_var_init.N.
   clang creates these symbol names to call constructor functions and basic
   block symbol naming should not use the same style.

Fixed all the test cases and added an extra test for __cxx_global_var_init
breakage.

Differential Revision: https://reviews.llvm.org/D93082
19 files changed:
clang/test/CodeGen/basic-block-sections.c
lld/test/ELF/lto/basic-block-sections.ll
llvm/lib/CodeGen/MachineBasicBlock.cpp
llvm/test/CodeGen/X86/basic-block-sections-blockaddress-taken.ll
llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll
llvm/test/CodeGen/X86/basic-block-sections-clusters-eh.ll
llvm/test/CodeGen/X86/basic-block-sections-clusters.ll
llvm/test/CodeGen/X86/basic-block-sections-directjumps.ll
llvm/test/CodeGen/X86/basic-block-sections-eh.ll
llvm/test/CodeGen/X86/basic-block-sections-list.ll
llvm/test/CodeGen/X86/basic-block-sections-listbb.ll
llvm/test/CodeGen/X86/basic-block-sections-mir-parse.mir
llvm/test/CodeGen/X86/basic-block-sections-unreachable.ll
llvm/test/CodeGen/X86/basic-block-sections.ll
llvm/test/CodeGen/X86/basic-block-sections_2.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/cfi-basic-block-sections-1.ll
llvm/test/CodeGen/X86/cfi-inserter-basic-block-sections-callee-save-registers.ll
llvm/test/CodeGen/X86/gcc_except_table_bb_sections.ll
llvm/test/DebugInfo/X86/basic-block-sections_1.ll