1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; Check that we're not crashing while looking at the recurrence variable.
3; RUN: opt -S -loop-idiom %s | FileCheck %s
4
5define void @tinkywinky() {
6; CHECK-LABEL: @tinkywinky(
7; CHECK-NEXT:  entry:
8; CHECK-NEXT:    br i1 true, label [[EXIT:%.*]], label [[PH:%.*]]
9; CHECK:       ph:
10; CHECK-NEXT:    [[MYPHI:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ]
11; CHECK-NEXT:    br label [[IF_END:%.*]]
12; CHECK:       if.end:
13; CHECK-NEXT:    [[PATATINO:%.*]] = ashr i32 [[MYPHI]], undef
14; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp eq i32 [[PATATINO]], 0
15; CHECK-NEXT:    br i1 [[TOBOOL]], label [[EXIT_LOOPEXIT:%.*]], label [[IF_END]]
16; CHECK:       exit.loopexit:
17; CHECK-NEXT:    br label [[EXIT]]
18; CHECK:       exit:
19; CHECK-NEXT:    ret void
20;
21entry:
22  br i1 true, label %exit, label %ph
23
24ph:
25  %myphi = phi i32 [ 1, %entry ]
26  br label %if.end
27
28if.end:
29  %patatino = ashr i32 %myphi, undef
30  %tobool = icmp eq i32 %patatino, 0
31  br i1 %tobool, label %exit, label %if.end
32
33exit:
34  ret void
35}
36