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