[llvm-bugs] [Bug 46182] New: opt -indvars moves definition without updating debug info

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 3 04:27:07 PDT 2020


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

            Bug ID: 46182
           Summary: opt -indvars moves definition without updating debug
                    info
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 23567
  --> https://bugs.llvm.org/attachment.cgi?id=23567&action=edit
bbi-43604.ll

Reproduce with:
 opt -indvars -S -o - bbi-43604.ll

In the input we have:

define void @f() {
entry:
  %b = alloca [1 x i16], align 1
  %arraydecay = getelementptr inbounds [1 x i16], [1 x i16]* %b, i32 0, i32 0
  %0 = ptrtoint i16* %arraydecay to i16
  call void @llvm.dbg.value(metadata i16 %0, metadata !9, metadata
!DIExpression()), !dbg !14
  br label %for.cond

for.cond:                                         ; preds = %for.cond, %entry
  br i1 true, label %for.cond, label %for.end

for.end:                                          ; preds = %for.cond
  ret void
}

and in the output we get:

define void @f() {
entry:
  %b = alloca [1 x i16], align 1
  %arraydecay = getelementptr inbounds [1 x i16], [1 x i16]* %b, i32 0, i32 0
  call void @llvm.dbg.value(metadata i16 %0, metadata !9, metadata
!DIExpression()), !dbg !14
  br label %for.cond

for.cond:                                         ; preds = %for.cond, %entry
  br i1 true, label %for.cond, label %for.end

for.end:                                          ; preds = %for.cond
  %0 = ptrtoint i16* %arraydecay to i16
  ret void
}

so the definition of %0 is now done after the use of %0 in the dbg.value.

-- 
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/20200603/84a98aa5/attachment.html>


More information about the llvm-bugs mailing list