[llvm] [llvm][CFI] Do not canonicalize COFF functions in a comdat (PR #139962)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 16:09:20 PDT 2025


================
@@ -246,6 +246,18 @@ void ByteArrayBuilder::allocate(const std::set<uint64_t> &Bits,
 bool lowertypetests::isJumpTableCanonical(Function *F) {
   if (F->isDeclarationForLinker())
     return false;
+
+  // Do not canonicalize a comdat'd COFF function because this could end up
+  // renaming the comdat key function without renaming the comdat key. We cannot
+  // rename the key in this LTO unit because other TUs may reference the
+  // original key name. To prevent this, just ignore canonicalization for
----------------
PiJoules wrote:

Ah I didn't know that. So I guess as long as the key function was chosen as the prevailing symbol for the symbol table passed to LTO, then it should be fine to rename the comdat.

https://github.com/llvm/llvm-project/pull/139962


More information about the llvm-commits mailing list