1; RUN: opt -loop-deletion %s -o /dev/null --pass-remarks-output=%t --pass-remarks-filter=loop-delete 2; RUN: cat %t | FileCheck %s 3 4; Check that we use the right debug location: the loop header. 5; CHECK: --- !Passed 6; CHECK-NEXT: Pass: loop-delete 7; CHECK-NEXT: Name: Invariant 8; CHECK-NEXT: DebugLoc: { File: loop.c, Line: 2, Column: 3 } 9; CHECK-NEXT: Function: main 10; CHECK-NEXT: Args: 11; CHECK-NEXT: - String: Loop deleted because it is invariant 12; CHECK-NEXT: ... 13define i32 @main() local_unnamed_addr #0 { 14entry: 15 br label %for.cond, !dbg !9 16 17for.cond: 18 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.cond ] 19 %cmp = icmp ult i32 %i.0, 1000 20 %inc = add nuw nsw i32 %i.0, 1 21 br i1 %cmp, label %for.cond, label %for.cond.cleanup 22 23for.cond.cleanup: 24 ret i32 0 25} 26 27!llvm.dbg.cu = !{!0} 28!llvm.module.flags = !{!3} 29 30!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2, nameTableKind: None, sysroot: "/") 31!1 = !DIFile(filename: "loop.c", directory: "") 32!2 = !{} 33!3 = !{i32 2, !"Debug Info Version", i32 3} 34!6 = distinct !DISubprogram(name: "main", scope: !7, file: !7, line: 1, type: !8, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) 35!7 = !DIFile(filename: "loop.c", directory: "") 36!8 = !DISubroutineType(types: !2) 37!9 = !DILocation(line: 2, column: 3, scope: !6) 38