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

            Bug ID: 46267
           Summary: opt -speculative-execution moves dbg.value(%0 before
                    definition of %0
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: mikael.hol...@ericsson.com
                CC: llvm-bugs@lists.llvm.org

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

Repriduce with:
 opt -speculative-execution -S -o - bbi-43737.ll

Input:

define void @f() {
entry:
  br i1 undef, label %land.rhs, label %land.end

land.rhs:                                         ; preds = %entry
  %0 = load i16, i16* undef, align 1
  call void @llvm.dbg.value(metadata i16 %0, metadata !9, metadata
!DIExpression()), !dbg !10
  br label %land.end

land.end:                                         ; preds = %land.rhs, %entry
  ret void
}

Output:

define dso_local void @f() {
entry:
  call void @llvm.dbg.value(metadata i16 %0, metadata !6, metadata
!DIExpression()), !dbg !10
  br i1 undef, label %land.rhs, label %land.end

land.rhs:                                         ; preds = %entry
  %0 = load i16, i16* undef, align 1
  br label %land.end

land.end:                                         ; preds = %land.rhs, %entry
  ret void
}

So the dbg.value is hoisted to the entry block, before the definition of the
value it uses.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to