[PATCH] D23488: ThinLTO: add early "dead-stripping" on the Index

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 16:18:20 PST 2016


pcc added a comment.

In https://reviews.llvm.org/D23488#627201, @mehdi_amini wrote:

> In https://reviews.llvm.org/D23488#627136, @tejohnson wrote:
>
> > In https://reviews.llvm.org/D23488#627135, @mehdi_amini wrote:
> >
> > > As an alternative, have you considered having a bit "used" (or "do not dead strip") that would express in the summary exactly what we want?
> >
> >
> > Yes, that would be another alternative, I thought about that but was hoping it could be avoided, but maybe not easily. The bit would probably need to be set for any variable that starts with "llvm." to be safely conservative (e.g. we should also consider anything in llvm.used or llvm.compiler.used as potentially live).
>
>
> llvm.used is definitely a must-be root, llvm.compiler.used are supposed to be able to be dead-stripped at link-time.


I think we will need logic for removing entries from llvm.compiler.used then. Consider this scenario:

module A:

  @llvm.compiler.used = [@f]
  
  define internal void @f() {
    call void @g()
    ret void
  }
  
  declare void @g()

module B:

  define void @g() {
    ret void
  }

In this case we can't dead strip f by internalizing as that would end up keeping the reference to the dead function g, we need to actually remove it.


https://reviews.llvm.org/D23488





More information about the llvm-commits mailing list