• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -loop-rotate -licm -S | FileCheck %s
2; PR9604
3
4@g_3 = global i32 0, align 4
5@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00"
6
7define i32 @main() nounwind {
8entry:
9  %tmp = load i32* @g_3, align 4
10  %tobool = icmp eq i32 %tmp, 0
11  br i1 %tobool, label %for.cond, label %if.then
12
13if.then:                                          ; preds = %entry
14  br label %for.cond
15
16for.cond:                                         ; preds = %for.inc10, %if.then, %entry
17  %g.0 = phi i32* [ %g.0, %for.inc10 ], [ @g_3, %entry ], [ null, %if.then ]
18  %x.0 = phi i32 [ %inc12, %for.inc10 ], [ 0, %entry ], [ 0, %if.then ]
19  %cmp = icmp slt i32 %x.0, 5
20  br i1 %cmp, label %for.cond4, label %for.end13
21
22for.cond4:                                        ; preds = %for.body7, %for.cond
23  %y.0 = phi i32 [ %inc, %for.body7 ], [ 0, %for.cond ]
24  %cmp6 = icmp slt i32 %y.0, 5
25  br i1 %cmp6, label %for.body7, label %for.inc10
26
27; CHECK: for.body7:
28; CHECK-NEXT: phi
29; CHECK-NEXT: store i32 0
30; CHECK-NEXT: store i32 1
31
32for.body7:                                        ; preds = %for.cond4
33  store i32 0, i32* @g_3, align 4
34  store i32 1, i32* %g.0, align 4
35  %inc = add nsw i32 %y.0, 1
36  br label %for.cond4
37
38for.inc10:                                        ; preds = %for.cond4
39  %inc12 = add nsw i32 %x.0, 1
40  br label %for.cond
41
42for.end13:                                        ; preds = %for.cond
43  %tmp14 = load i32* @g_3, align 4
44  %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i64 0, i64 0), i32 %tmp14) nounwind
45  ret i32 0
46}
47
48declare i32 @printf(i8* nocapture, ...) nounwind
49
50