1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=indvars < %s | FileCheck %s
4 ; This test used to assert when expanding an addrec into a loop without
7 define void @test(ptr %tgt) {
10 ; CHECK-NEXT: indirectbr ptr [[TGT:%.*]], [label [[EXIT:%.*]], label %bb33]
12 ; CHECK-NEXT: ret void
14 ; CHECK-NEXT: [[TMP34:%.*]] = phi i32 [ [[TMP50:%.*]], [[BB49:%.*]] ], [ 0, [[BB31:%.*]] ]
15 ; CHECK-NEXT: br i1 false, label [[BB40_PREHEADER:%.*]], label [[BB49]]
16 ; CHECK: bb40.preheader:
17 ; CHECK-NEXT: br label [[BB40:%.*]]
19 ; CHECK-NEXT: br label [[BB40]]
21 ; CHECK-NEXT: [[TMP50]] = add i32 [[TMP34]], 1
22 ; CHECK-NEXT: br label [[BB33:%.*]]
25 indirectbr ptr %tgt, [label %exit, label %bb33]
30 bb33: ; preds = %bb49, %bb31
31 %tmp34 = phi i32 [ %tmp50, %bb49 ], [ 0, %bb31 ]
32 %tmp36 = add i32 %tmp34, 1
33 br i1 false, label %bb40, label %bb49
35 bb40: ; preds = %bb38, %bb37
36 %tmp41 = phi i32 [ %tmp36, %bb33 ], [ %tmp39, %bb40 ]
37 %tmp39 = add i32 %tmp41, 0
41 %tmp50 = add i32 %tmp34, 1