[llvm-bugs] [Bug 36208] New: ThinLTO does not drop aliases to dead targets.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 2 06:26:25 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36208

            Bug ID: 36208
           Summary: ThinLTO does not drop aliases to dead targets.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Linker
          Assignee: unassignedbugs at nondot.org
          Reporter: grimar at accesssoftek.com
                CC: llvm-bugs at lists.llvm.org

Currently ThinLTO backend does not support dropping aliases to dead functions.
(see comment at
https://github.com/llvm-mirror/llvm/blob/master/lib/LTO/LTOBackend.cpp#L411)

For example if we have following testcase where foo is prevailing and bar is
not prevailing:
; RUN: opt -module-summary %s -o %t1.bc
; RUN: llvm-lto2 run %t1.bc -r %t1.bc,fooAlias,pl -r %t1.bc,barAlias,pl \
; RUN:   -r %t1.bc,foo,plx -r %t1.bc,bar,lx \
; RUN:   -o %t2.o -save-temps
; RUN: llvm-dis -o %t.dis %t2.o.1.2.internalize.bc
; RUN: opt -module-summary %t.dis -o %t2.bc

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@fooAlias = alias i32(), i32()* @foo
define i32 @foo() {
  ret i32 11
}

@barAlias = alias i32(), i32()* @bar
define i32 @bar() {
  ret i32 22
}

It will fail with:
"Alias must point to a definition i32 ()* @barAlias"

because LTO drops bar, but does not drop it's alias.
Disasm of %t2.o.1.2.internalize.bc (%t.dis content):

@fooAlias = internal alias i32 (), i32 ()* @foo
@barAlias = internal alias i32 (), i32 ()* @bar

define dso_local i32 @foo() {
  ret i32 11
}

declare dso_local i32 @bar()

Expected result is that barAlias should be eliminated I think.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180202/40b21c10/attachment.html>


More information about the llvm-bugs mailing list