single-backedge.ll 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. ; RUN: opt < %s -indvars -S | FileCheck %s
  5. ; CHECK: Loop.backedge:
  6. ; CHECK-NOT: br
  7. ; CHECK: br label %Loop, !dbg [[BACKEDGE_LOC:![0-9]+]]
  8. ; CHECK: [[BACKEDGE_LOC]] = !DILocation(line: 101, column: 1, scope: !{{.*}})
  9. define i32 @test(i1 %C) {
  10. ; <label>:0
  11. br label %Loop, !dbg !6
  12. Loop: ; preds = %BE2, %BE1, %0
  13. %IV = phi i32 [ 1, %0 ], [ %IV2, %BE1 ], [ %IV2, %BE2 ] ; <i32> [#uses=2]
  14. store i32 %IV, i32* null, !dbg !7
  15. %IV2 = add i32 %IV, 2, !dbg !8 ; <i32> [#uses=2]
  16. br i1 %C, label %BE1, label %BE2, !dbg !9
  17. BE1: ; preds = %Loop
  18. br label %Loop, !dbg !10
  19. BE2: ; preds = %n br label %Loop
  20. br label %Loop, !dbg !11
  21. }
  22. !llvm.module.flags = !{!0, !1}
  23. !0 = !{i32 2, !"Dwarf Version", i32 4}
  24. !1 = !{i32 2, !"Debug Info Version", i32 3}
  25. !2 = !{}
  26. !3 = !DISubroutineType(types: !2)
  27. !4 = !DIFile(filename: "atomic.cpp", directory: "/tmp")
  28. !5 = !DISubprogram(name: "test", scope: !4, file: !4, line: 99, type: !3, isLocal: false, isDefinition: true, scopeLine: 100, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
  29. !6 = !DILocation(line: 100, column: 1, scope: !5)
  30. !7 = !DILocation(line: 101, column: 1, scope: !5)
  31. !8 = !DILocation(line: 102, column: 1, scope: !5)
  32. !9 = !DILocation(line: 103, column: 1, scope: !5)
  33. !10 = !DILocation(line: 104, column: 1, scope: !5)
  34. !11 = !DILocation(line: 105, column: 1, scope: !5)