• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -verify-loop-info -irce-print-changed-loops -irce -S < %s 2>&1 | FileCheck %s
2
3; CHECK-LABEL: irce: in function test_01: constrained Loop at depth 2 containing:
4
5define void @test_01(i64 %len) {
6
7; CHECK-LABEL: @test_01(
8
9entry:
10  br label %loop
11
12check:
13  %entry_check = icmp eq i32 %idx.next, 0
14  br i1 %entry_check, label %exit, label %loop
15
16loop:
17  %idx = phi i32 [ 1, %entry ], [ %idx.next, %check ]
18  %idx_ext = sext i32 %idx to i64
19  br label %inner_loop
20
21inner_loop:
22  %iv = phi i64 [ 0, %loop ], [ %iv.next, %inner_backedge ]
23  %iv.next = add nuw nsw i64 %iv, 1
24  %inner_check = icmp slt i64 %iv.next, %idx_ext
25  br i1 %inner_check, label %inner, label %outer_check
26
27inner:
28  %iv_next_check = icmp slt i64 %iv.next, 100
29  br i1 %iv_next_check, label %inner_backedge, label %exit
30
31inner_backedge:
32  %cond = icmp eq i64 %iv.next, 100
33  br i1 %cond, label %exit, label %inner_loop
34
35outer_check:
36  %idx.next = add i32 %idx, 1
37  %loopdone = icmp slt i32 %idx.next, 2
38  br i1 %loopdone, label %check, label %exit
39
40exit:
41  ret void
42}
43