https://llvm.org/bugs/show_bug.cgi?id=30612
Bug ID: 30612 Summary: llvm.dbg.value calls on phis appear in the wrong place Product: libraries Version: trunk Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: Transformation Utilities Assignee: unassignedb...@nondot.org Reporter: r...@google.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Consider this test case: struct IntPair { int x, y; }; extern int g(int r); extern int i; extern int n; int loop_csr() { struct IntPair o = {0, 0}; for (i = 0; i < n; i++) { o.x = g(o.x); o.y = g(o.y); } return o.x + o.y; } The LLVM IR we get after -O1 for the loop body is: for.body: ; preds = %entry, %for.body %o.sroa.0.011 = phi i32 [ %call, %for.body ], [ 0, %entry ] %o.sroa.5.010 = phi i32 [ %call2, %for.body ], [ 0, %entry ] %call = tail call i32 @g(i32 %o.sroa.0.011) #5, !dbg !31 tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !12, metadata !19), !dbg !18 %call2 = tail call i32 @g(i32 %o.sroa.5.010) #5, !dbg !33 tail call void @llvm.dbg.value(metadata i32 %call2, i64 0, metadata !12, metadata !20), !dbg !18 %1 = load i32, i32* @i, align 4, !dbg !21, !tbaa !24 %inc = add nsw i32 %1, 1, !dbg !21 tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !12, metadata !19), !dbg !18 tail call void @llvm.dbg.value(metadata i32 %call2, i64 0, metadata !12, metadata !20), !dbg !18 store i32 %inc, i32* @i, align 4, !dbg !21, !tbaa !24 %2 = load i32, i32* @n, align 4, !dbg !28, !tbaa !24 %cmp = icmp slt i32 %inc, %2, !dbg !29 br i1 %cmp, label %for.body, label %for.end, !dbg !30, !llvm.loop !34 The dbg.value calls appear misplaced. IMO they should appear after the phi, and after the calls. We should be able to emit dwarf that says that, for the entire loop body, o.x and o.y are in EDI and ESI respectively, but we can't because we don't have debug value info on phis. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs