[llvm-bugs] [Bug 35113] New: Debug info for induction variable points at next iteration's value

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 27 15:27:19 PDT 2017


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

            Bug ID: 35113
           Summary: Debug info for induction variable points at next
                    iteration's value
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: aprantl at apple.com
                CC: llvm-bugs at lists.llvm.org

void bar(float);
void f(float *input, long long n, long long s) {
  for (long long i = 0; i < n; i+=s )
    bar(input[i]);
}

clang -g -O1 -S -emit-llvm /tmp/loop.c  -o - 

...
for.body:                                         ; preds =
%for.body.preheader, %for.body
  %i.05 = phi i64 [ %add, %for.body ], [ 0, %for.body.preheader ]
  tail call void @llvm.dbg.value(metadata i64 %i.05, metadata !18, metadata
!DIExpression()), !dbg !23
  %arrayidx = getelementptr inbounds float, float* %input, i64 %i.05, !dbg !27
  %0 = load float, float* %arrayidx, align 4, !dbg !27, !tbaa !29
  tail call void @bar(float %0) #3, !dbg !33
  %add = add nsw i64 %i.05, %s, !dbg !34
  tail call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata
!DIExpression()), !dbg !23
  tail call void @llvm.dbg.value(metadata i64 %add, metadata !18, metadata
!DIExpression()), !dbg !23
  %cmp = icmp slt i64 %add, %n, !dbg !24
  br i1 %cmp, label %for.body, label %for.cond.cleanup, !dbg !26, !llvm.loop
!35
}

!7 = !{!"clang version 6.0.0 (trunk 316686) (llvm/trunk 316682)"}
!23 = !DILocation(line: 3, column: 18, scope: !19)
!34 = !DILocation(line: 3, column: 32, scope: !25)

There are two problems here:
1. The dbg.value describing %add is duplicated.
2. It is wrong. If we insert a dbg.value for %add I would either expect it to
have a DIExpression that subtracts %s (which we can't represent), *or* to have
a DILocation that clearly points to a source location after the increment.

-- 
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/20171027/8fd9cc5e/attachment.html>


More information about the llvm-bugs mailing list