• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; NOTE: Only %local_3_4 is important here.
3;       All other instructions are needed to lure LLVM into executing
4;       specific code to trigger a bug.
5; RUN: opt < %s -indvars -S | FileCheck %s
6define i32 @test() {
7; CHECK-LABEL: @test(
8; CHECK-NEXT:  entry:
9; CHECK-NEXT:    br label [[OUTER:%.*]]
10; CHECK:       outer:
11; CHECK-NEXT:    [[LOCAL_6_6:%.*]] = phi i32 [ 10, [[ENTRY:%.*]] ], [ [[TMP5:%.*]], [[LATCH:%.*]] ]
12; CHECK-NEXT:    [[LOCAL_4_5:%.*]] = phi i32 [ 56587, [[ENTRY]] ], [ 0, [[LATCH]] ]
13; CHECK-NEXT:    [[LOCAL_3_4:%.*]] = phi i32 [ 2, [[ENTRY]] ], [ [[TMP5]], [[LATCH]] ]
14; CHECK-NEXT:    [[DOTUDIV:%.*]] = udiv i32 [[LOCAL_6_6]], 8361
15; CHECK-NEXT:    br label [[INNER:%.*]]
16; CHECK:       inner:
17; CHECK-NEXT:    [[LOCAL_7_3:%.*]] = phi i32 [ 2, [[OUTER]] ], [ [[TMP3:%.*]], [[INNER]] ]
18; CHECK-NEXT:    [[LOCAL_4_5_PN:%.*]] = phi i32 [ [[LOCAL_4_5]], [[OUTER]] ], [ [[TMP2:%.*]], [[INNER]] ]
19; CHECK-NEXT:    [[LOCAL_3_31:%.*]] = mul i32 [[LOCAL_4_5_PN]], [[DOTUDIV]]
20; CHECK-NEXT:    [[TMP0:%.*]] = mul nuw nsw i32 [[LOCAL_7_3]], [[DOTUDIV]]
21; CHECK-NEXT:    [[TMP1:%.*]] = sub i32 [[TMP0]], [[LOCAL_3_4]]
22; CHECK-NEXT:    [[TMP2]] = add i32 [[TMP1]], [[LOCAL_3_31]]
23; CHECK-NEXT:    [[TMP3]] = add nuw nsw i32 [[LOCAL_7_3]], 1
24; CHECK-NEXT:    [[TMP4:%.*]] = icmp ugt i32 [[LOCAL_7_3]], 4
25; CHECK-NEXT:    br i1 [[TMP4]], label [[LATCH]], label [[INNER]]
26; CHECK:       latch:
27; CHECK-NEXT:    [[DOTLCSSA:%.*]] = phi i32 [ [[TMP2]], [[INNER]] ]
28; CHECK-NEXT:    [[TMP5]] = add nuw nsw i32 [[LOCAL_6_6]], 1
29; CHECK-NEXT:    [[TMP6:%.*]] = icmp ugt i32 [[LOCAL_6_6]], 276
30; CHECK-NEXT:    br i1 [[TMP6]], label [[RETURN:%.*]], label [[OUTER]]
31; CHECK:       return:
32; CHECK-NEXT:    [[DOTLCSSA_LCSSA:%.*]] = phi i32 [ [[DOTLCSSA]], [[LATCH]] ]
33; CHECK-NEXT:    ret i32 [[DOTLCSSA_LCSSA]]
34;
35entry:
36  br label %outer
37
38outer:
39  %local_6_6 = phi i32 [ 10, %entry ], [ %5, %latch ]
40  %local_4_5 = phi i32 [ 56587, %entry ], [ 0, %latch ]
41  %local_3_4 = phi i32 [ 2, %entry ], [ %5, %latch ]
42  %.udiv = udiv i32 %local_6_6, 8361
43  br label %inner
44
45inner:
46  %local_7_3 = phi i32 [ 2, %outer ], [ %3, %inner ]
47  %local_4_5.pn = phi i32 [ %local_4_5, %outer ], [ %2, %inner ]
48  %local_3_31 = mul i32 %local_4_5.pn, %.udiv
49  %0 = mul i32 %local_7_3, %.udiv
50  %1 = sub i32 %0, %local_3_4
51  %2 = add i32 %1, %local_3_31
52  %3 = add nuw nsw i32 %local_7_3, 1
53  %4 = icmp ugt i32 %local_7_3, 4
54  br i1 %4, label %latch, label %inner
55
56latch:
57  %.lcssa = phi i32 [ %2, %inner ]
58  %5 = add nuw nsw i32 %local_6_6, 1
59  %6 = icmp ugt i32 %local_6_6, 276
60  br i1 %6, label %return, label %outer
61
62return:
63  %.lcssa.lcssa = phi i32 [ %.lcssa, %latch ]
64  ret i32 %.lcssa.lcssa
65
66}
67
68