<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - lto deoptimizes this case on COFF"
   href="https://llvm.org/bugs/show_bug.cgi?id=25686">25686</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lto deoptimizes this case on COFF
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rafael.espindola@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Linking 

$zed = comdat any
@bar = private unnamed_addr constant [2 x i64] [i64 42, i64 43], comdat($zed)
@zed = internal unnamed_addr alias i64, getelementptr inbounds ([2 x i64], [2 x
i64]* @bar, i32 0, i32 1)
define i64* @baz() {
  ret i64* @zed
}


with

$zed = comdat any
@bar = private unnamed_addr constant [2 x i64] [i64 42, i64 43], comdat($zed)
@zed = internal unnamed_addr alias i64, getelementptr inbounds ([2 x i64], [2 x
i64]* @bar, i32 0, i32 1)
define i64* @foo() {
  ret i64* @zed
}

with lld without lto produces an executable with an .rdata that has
    SectionData (
      0000: 2A000000 00000000 2B000000 00000000  |*.......+.......|
    )


llvm-link on those files produces

---------------------------------------
$zed = comdat any

@bar = private unnamed_addr constant [2 x i64] [i64 42, i64 43], comdat($zed)
@bar.2 = private unnamed_addr constant [2 x i64] [i64 42, i64 43], comdat($zed)

@zed = internal unnamed_addr alias i64, getelementptr inbounds ([2 x i64], [2 x
i64]* @bar, i32 0, i32 1)
@zed.1 = internal unnamed_addr alias i64, getelementptr inbounds ([2 x i64], [2
x i64]* @bar.2, i32 0, i32 1)

define i64* @baz() {
  ret i64* @zed
}

define i64* @foo() {
  ret i64* @zed.1
}
-------------------------------------------


which then produces a .rdata with

    SectionData (
      0000: 2A000000 00000000 2B000000 00000000  |*.......+.......|
      0010: 2A000000 00000000 2B000000 00000000  |*.......+.......|
    )


the problem is that the IR linker is duplicating the internal linkage GV. How
does the native linker map references to internal symbols? Does anyone has an
idea on how to do the same with IR? If the data was rw, this would have been a
correctness issue.</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>