[PATCH] D121428: [lld-macho] Extend lto-internalize-unnamed-addr.ll

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 10:26:44 PDT 2022


tejohnson added inline comments.


================
Comment at: lld/test/MachO/lto-internalize-unnamed-addr.ll:47
+; THINLTO-BC-DAG: @local_unnamed_sometimes_const = weak_odr local_unnamed_addr constant i8 42
+; THINLTO-BC-DAG: @local_unnamed = weak_odr local_unnamed_addr global i8 42
+
----------------
int3 wrote:
> modimo wrote:
> > I find it odd that `local_unnamed` is able to be internalized in fullLTO but not thinLTO. The code path is https://github.com/llvm/llvm-project/blob/9f616a467fc710f084b7e57812a2ed64c214c2c6/llvm/lib/LTO/LTO.cpp#L349 where any linkonce_odr gets upgraded to weak but if this is the only copy that exists it appears to fit within the rules coming from D20348. cc @tejohnson is there an opportunity here?
> I realize `global_unnamed_sometimes_linkonce` has the same issue too. I've added a FIXME for this
That's true, if there is only one copy no need to make the prevailing one weak_odr. Is changing that sufficient to get the internalization in the ThinLTO case?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121428/new/

https://reviews.llvm.org/D121428



More information about the llvm-commits mailing list