[PATCH] D135427: [LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 11:17:00 PDT 2022


MaskRay added a comment.

I put this in the description

> To fix this, update the regular LTO change D34803 <https://reviews.llvm.org/D34803> to track local linkage GlobalValues, and port the code to ThinLTO (GlobalAliases are not handled.)

It turns out that we need to handle `GlobalAlias` in this patch (as opposed to in a follow-up), as otherwise it may break clang codegen of C5/D5 <https://reviews.llvm.org/D5> constructor/destructor

  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-linux-gnu"
  
  $_ZN1AD5Ev = comdat any
  $_ZTV1A = comdat any
  
  @_ZN1AD1Ev = weak_odr unnamed_addr alias void (ptr), ptr @_ZN1AD2Ev
  ; @_ZTV1A = weak_odr unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr @_ZTI1A, ptr @_ZN1AD1Ev, ptr @_ZN1AD0Ev] }, comdat, align 8
  @_ZTV1A = weak_odr unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr @_ZN1AD1Ev, ptr @_ZN1AD0Ev] }, comdat, align 8
  
  define weak_odr void @_ZN1AD2Ev(ptr noundef nonnull align 8 dereferenceable(464) %0) unnamed_addr #9 comdat($_ZN1AD5Ev) align 32 {
    ret void
  }
  
  define weak_odr void @_ZN1AD0Ev(ptr noundef nonnull align 8 dereferenceable(464) %0) unnamed_addr #9 comdat($_ZN1AD5Ev) align 32 {
    tail call void @_ZN1AD1Ev(ptr noundef nonnull align 8 dereferenceable(464) %0)
    ret void
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135427



More information about the llvm-commits mailing list