<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ThinLTO does not drop aliases to dead targets."
   href="https://bugs.llvm.org/show_bug.cgi?id=36208">36208</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ThinLTO does not drop aliases to dead targets.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Linker
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>grimar@accesssoftek.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Currently ThinLTO backend does not support dropping aliases to dead functions.
(see comment at
<a href="https://github.com/llvm-mirror/llvm/blob/master/lib/LTO/LTOBackend.cpp#L411">https://github.com/llvm-mirror/llvm/blob/master/lib/LTO/LTOBackend.cpp#L411</a>)

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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>