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

Di Mo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 14:53:40 PST 2022


modimo added a subscriber: tejohnson.
modimo added inline comments.


================
Comment at: lld/test/MachO/lto-internalize-unnamed-addr.ll:26
+; RUN:   %t/test.thinlto.dylib -save-temps
 ; RUN: llvm-nm -m %t/test.thinlto.dylib | FileCheck %s --check-prefix=THINLTO
 
----------------
thinlto+dylib shares the same output as thinlto by itself. Can check for that as well in the bitcode output


================
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
+
----------------
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?


================
Comment at: lld/test/MachO/lto-internalize-unnamed-addr.ll:67
 ; LTO-DYLIB-DAG: (__DATA,__data) non-external _global_unnamed
+; LTO-DYLIB-DAG: (__DATA,__data) weak external _global_unnamed_sometimes_linkonce
 ; LTO-DYLIB-DAG: (__DATA,__data) weak external _local_unnamed
----------------
Add final output binary check for LTO-DAG and THINLTO-DAG as well?


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