Skip to content

Commit d2e863e

Browse files
committed
Edit test case debug info
1 parent 276b552 commit d2e863e

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

llvm/test/Transforms/LoopIdiom/strlen.ll

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -613,50 +613,51 @@ while.end:
613613
}
614614

615615
define i64 @valid_basic_strlen_with_dbg(ptr %str) {
616+
; Make sure that the call to strlen has debug info attached.
616617
; CHECK-LABEL: define i64 @valid_basic_strlen_with_dbg(
617618
; CHECK-SAME: ptr [[STR:%.*]]) {
618619
; CHECK-NEXT: [[ENTRY:.*]]:
619-
; CHECK-NEXT: [[STRLEN:%.*]] = call i64 @strlen(ptr [[STR]]), !dbg !{{[0-9]+}}
620+
; CHECK-NEXT: [[STRLEN:%.*]] = call i64 @strlen(ptr [[STR]]), !dbg !4
620621
; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[STR]], i64 [[STRLEN]]
621622
; CHECK-NEXT: br label %[[WHILE_COND:.*]]
622623
; CHECK: [[WHILE_COND]]:
623624
; CHECK-NEXT: [[STR_ADDR_0:%.*]] = phi ptr [ [[STR]], %[[ENTRY]] ], [ [[INCDEC_PTR:%.*]], %[[WHILE_COND]] ]
624-
; CHECK-NEXT: [[TMP0:%.*]] = load i8, ptr [[STR_ADDR_0]], align 1
625-
; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i8 [[TMP0]], 0
626-
; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr i8, ptr [[STR_ADDR_0]], i64 1
627-
; CHECK-NEXT: br i1 true, label %[[WHILE_END:.*]], label %[[WHILE_COND]]
625+
; CHECK-NEXT: [[TMP0:%.*]] = load i8, ptr [[STR_ADDR_0]], align 1, !dbg !8
626+
; CHECK-NEXT: [[CMP_NOT:%.*]] = icmp eq i8 [[TMP0]], 0, !dbg !8
627+
; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr i8, ptr [[STR_ADDR_0]], i64 1, !dbg !8
628+
; CHECK-NEXT: br i1 true, label %[[WHILE_END:.*]], label %[[WHILE_COND]], !dbg !4
628629
; CHECK: [[WHILE_END]]:
629-
; CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[SCEVGEP]] to i64
630-
; CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[STR]] to i64
631-
; CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]]
632-
; CHECK-NEXT: ret i64 [[SUB_PTR_SUB]]
630+
; CHECK-NEXT: [[SUB_PTR_LHS_CAST:%.*]] = ptrtoint ptr [[SCEVGEP]] to i64, !dbg !8
631+
; CHECK-NEXT: [[SUB_PTR_RHS_CAST:%.*]] = ptrtoint ptr [[STR]] to i64, !dbg !8
632+
; CHECK-NEXT: [[SUB_PTR_SUB:%.*]] = sub i64 [[SUB_PTR_LHS_CAST]], [[SUB_PTR_RHS_CAST]], !dbg !8
633+
; CHECK-NEXT: ret i64 [[SUB_PTR_SUB]], !dbg !8
633634
;
634635
entry:
635636
br label %while.cond
636637

637638
while.cond:
638639
%str.addr.0 = phi ptr [ %str, %entry ], [ %incdec.ptr, %while.cond ]
639-
%0 = load i8, ptr %str.addr.0, align 1, !dbg !6
640-
%cmp.not = icmp eq i8 %0, 0, !dbg !6
641-
%incdec.ptr = getelementptr i8, ptr %str.addr.0, i64 1
642-
br i1 %cmp.not, label %while.end, label %while.cond, !dbg !6
640+
%0 = load i8, ptr %str.addr.0, align 1, !dbg !8
641+
%cmp.not = icmp eq i8 %0, 0, !dbg !8
642+
%incdec.ptr = getelementptr i8, ptr %str.addr.0, i64 1, !dbg !8
643+
br i1 %cmp.not, label %while.end, label %while.cond, !dbg !4
643644

644645
while.end:
645-
%sub.ptr.lhs.cast = ptrtoint ptr %str.addr.0 to i64
646-
%sub.ptr.rhs.cast = ptrtoint ptr %str to i64
647-
%sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast
648-
ret i64 %sub.ptr.sub
646+
%sub.ptr.lhs.cast = ptrtoint ptr %str.addr.0 to i64, !dbg !8
647+
%sub.ptr.rhs.cast = ptrtoint ptr %str to i64, !dbg !8
648+
%sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast, !dbg !8
649+
ret i64 %sub.ptr.sub, !dbg !8
649650
}
650651

651-
652-
!llvm.module.flags = !{!7}
653-
!llvm.dbg.cu = !{!2}
654-
655-
!0 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !1, scope: !1, type: !3)
656-
!1 = !DIFile(filename: "strlen.c", directory: "/tmp")
657-
!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 127165:127174)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !4, retainedTypes: !4)
658-
!3 = !DISubroutineType(types: !4)
659-
!4 = !{}
660-
!5 = distinct !DILexicalBlock(line: 2, column: 21, file: !1, scope: !0)
661-
!6 = !DILocation(line: 3, column: 3, scope: !5)
662-
!7 = !{i32 1, !"Debug Info Version", i32 3}
652+
!llvm.module.flags = !{!0}
653+
!llvm.dbg.cu = !{!1}
654+
655+
!0 = !{i32 1, !"Debug Info Version", i32 3}
656+
!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 2.9 (trunk 127165:127174)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, retainedTypes: !3)
657+
!2 = !DIFile(filename: "strlen.c", directory: "/tmp")
658+
!3 = !{}
659+
!4 = !DILocation(line: 3, column: 3, scope: !5)
660+
!5 = distinct !DILexicalBlock(scope: !6, file: !2, line: 2, column: 21)
661+
!6 = distinct !DISubprogram(name: "foo", scope: !2, file: !2, line: 2, type: !7, virtualIndex: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !1)
662+
!7 = !DISubroutineType(types: !3)
663+
!8 = !DILocation(line: 5, column: 3, scope: !5)

0 commit comments

Comments
 (0)