[llvm-bugs] [Bug 25686] New: lto deoptimizes this case on COFF

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 30 17:33:59 PST 2015


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

            Bug ID: 25686
           Summary: lto deoptimizes this case on COFF
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
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/20151201/60493616/attachment.html>


More information about the llvm-bugs mailing list