[llvm-bugs] [Bug 33641] New: "function-local metadata used in wrong function" with -argpromotion -verify -dse

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 29 06:20:17 PDT 2017


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

            Bug ID: 33641
           Summary: "function-local metadata used in wrong function" with
                    -argpromotion -verify -dse
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18732
  --> https://bugs.llvm.org/attachment.cgi?id=18732&action=edit
reproducer

Reproduce with:
opt -argpromotion -verify -dse -S -o /dev/null reduced.ll

which gives:

function-local metadata used in wrong function
i16 addrspace(1)* %p
LLVM ERROR: Broken function found, compilation aborted!



With -print-before-all -print-after-all -debug we see

*** IR Dump Before Promote 'by reference' arguments to scalars ***
define internal void @bar(i16 addrspace(1)* %p) {
bb1:
  call void @llvm.dbg.value(metadata i16 addrspace(1)* %p, i64 0, metadata !3,
metadata !5), !dbg !6
  ret void
}
ARG PROMOTION:  Promoting to:
declare internal void @bar()

From: 
define internal void @bar(i16 addrspace(1)* %p) {
bb1:
  call void @llvm.dbg.value(metadata i16 addrspace(1)* %p, i64 0, metadata !3,
metadata !5), !dbg !6
  ret void
}
CGSCCPASSMGR: Refreshing SCC with 1 nodes:
Call graph node for function: 'bar'<<0x5116db0>>  #uses=0

CGSCCPASSMGR: SCC Refresh didn't change call graph.
*** IR Dump After Promote 'by reference' arguments to scalars ***
define internal void @bar() {
bb1:
  call void @llvm.dbg.value(metadata i16 addrspace(1)* %p, i64 0, metadata !3,
metadata !5), !dbg !6
  ret void
}

So the %p argument to bar has been removed, but the call to @llvm.dbg.value
which uses %p is still left.

Since ArgumentPromotion changes the argument list by creating a new function
with the desired argument list, we then get the error about using meta data
from the wrong function.

-- 
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/20170629/9c65f1db/attachment.html>


More information about the llvm-bugs mailing list