1 ; The loop canonicalization pass should guarantee that there is one backedge 2 ; for all loops. This allows the -indvars pass to recognize the %IV 3 ; induction variable in this testcase. 4 5 ; RUN: opt < %s -indvars -S | FileCheck %s 6 ; CHECK: Loop.backedge: 7 ; CHECK-NOT: br 8 ; CHECK: br label %Loop, !dbg [[BACKEDGE_LOC:![0-9]+]] 9 10 ; CHECK: [[BACKEDGE_LOC]] = !DILocation(line: 101, column: 1, scope: !{{.*}}) 11 12 define i32 @test(i1 %C) { 13 ; <label>:0 14 br label %Loop, !dbg !6 15 Loop: ; preds = %BE2, %BE1, %0 16 %IV = phi i32 [ 1, %0 ], [ %IV2, %BE1 ], [ %IV2, %BE2 ] ; <i32> [#uses=2] 17 store i32 %IV, i32* null, !dbg !7 18 %IV2 = add i32 %IV, 2, !dbg !8 ; <i32> [#uses=2] 19 br i1 %C, label %BE1, label %BE2, !dbg !9 20 BE1: ; preds = %Loop 21 br label %Loop, !dbg !10 22 BE2: ; preds = %n br label %Loop 23 br label %Loop, !dbg !11 24 } 25 26 !llvm.module.flags = !{!0, !1} 27 !llvm.dbg.cu = !{!12} 28 !0 = !{i32 2, !"Dwarf Version", i32 4} 29 !1 = !{i32 2, !"Debug Info Version", i32 3} 30 31 !2 = !{} 32 !3 = !DISubroutineType(types: !2) 33 !4 = !DIFile(filename: "atomic.cpp", directory: "/tmp") 34 !5 = distinct !DISubprogram(name: "test", scope: !4, file: !4, line: 99, type: !3, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, unit: !12, variables: !2) 35 !6 = !DILocation(line: 100, column: 1, scope: !5) 36 !7 = !DILocation(line: 101, column: 1, scope: !5) 37 !8 = !DILocation(line: 102, column: 1, scope: !5) 38 !9 = !DILocation(line: 103, column: 1, scope: !5) 39 !10 = !DILocation(line: 104, column: 1, scope: !5) 40 !11 = !DILocation(line: 105, column: 1, scope: !5) 41 !12 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", 42 file: !4, 43 isOptimized: true, flags: "-O2", 44 splitDebugFilename: "abc.debug", emissionKind: 2) 45