121
|
1 ; RUN: opt -S -newgvn %s | FileCheck %s
|
|
2
|
|
3 ; CHECK: define void @tinkywinky() {
|
|
4 ; CHECK-NEXT: entry:
|
|
5 ; CHECK-NEXT: %d = alloca i32, align 4
|
|
6 ; CHECK-NEXT: store i32 0, i32* null, align 4
|
|
7 ; CHECK-NEXT: br label %for.cond
|
|
8 ; CHECK: for.cond: ; preds = %if.end, %entry
|
|
9 ; CHECK-NEXT: %0 = load i32, i32* null, align 4
|
|
10 ; CHECK-NEXT: %cmp = icmp slt i32 %0, 1
|
|
11 ; CHECK-NEXT: br i1 %cmp, label %for.body, label %while.cond
|
|
12 ; CHECK: for.body: ; preds = %for.cond
|
|
13 ; CHECK-NEXT: %1 = load i32, i32* @a, align 4
|
|
14 ; CHECK-NEXT: store i32 %1, i32* %d, align 4
|
|
15 ; CHECK-NEXT: br label %L
|
|
16 ; CHECK: L: ; preds = %if.then, %for.body
|
|
17 ; CHECK-NEXT: %tobool = icmp ne i32 %1, 0
|
|
18 ; CHECK-NEXT: br i1 %tobool, label %if.then, label %if.end
|
|
19 ; CHECK: if.then: ; preds = %L
|
|
20 ; CHECK-NEXT: call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @patatino, i32 0, i32 0))
|
|
21 ; CHECK-NEXT: br label %L
|
|
22 ; CHECK: if.end: ; preds = %L
|
|
23 ; CHECK-NEXT: br label %for.cond
|
|
24 ; CHECK: while.cond: ; preds = %while.body, %for.cond
|
|
25 ; CHECK-NEXT: br i1 undef, label %while.body, label %while.end
|
|
26 ; CHECK: while.body: ; preds = %while.cond
|
|
27 ; CHECK-NEXT: call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @patatino, i32 0, i32 0))
|
|
28 ; CHECK-NEXT: br label %while.cond
|
|
29 ; CHECK: while.end:
|
|
30 ; CHECK-NEXT: %2 = load i32, i32* @a, align 4
|
|
31 ; CHECK-NEXT: store i32 %2, i32* undef, align 4
|
|
32 ; CHECK-NEXT: ret void
|
|
33
|
|
34 @a = external global i32, align 4
|
|
35 @patatino = external unnamed_addr constant [2 x i8], align 1
|
|
36 define void @tinkywinky() {
|
|
37 entry:
|
|
38 %d = alloca i32, align 4
|
|
39 store i32 0, i32* null, align 4
|
|
40 br label %for.cond
|
|
41 for.cond:
|
|
42 %0 = load i32, i32* null, align 4
|
|
43 %cmp = icmp slt i32 %0, 1
|
|
44 br i1 %cmp, label %for.body, label %while.cond
|
|
45 for.body:
|
|
46 %1 = load i32, i32* @a, align 4
|
|
47 store i32 %1, i32* %d, align 4
|
|
48 br label %L
|
|
49 L:
|
|
50 %2 = load i32, i32* %d, align 4
|
|
51 %tobool = icmp ne i32 %2, 0
|
|
52 br i1 %tobool, label %if.then, label %if.end
|
|
53 if.then:
|
|
54 call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @patatino, i32 0, i32 0))
|
|
55 br label %L
|
|
56 if.end:
|
|
57 br label %for.cond
|
|
58 while.cond:
|
|
59 br i1 undef, label %while.body, label %while.end
|
|
60 while.body:
|
|
61 call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @patatino, i32 0, i32 0))
|
|
62 br label %while.cond
|
|
63 while.end:
|
|
64 %3 = load i32, i32* @a, align 4
|
|
65 store i32 %3, i32* undef, align 4
|
|
66 ret void
|
|
67 }
|
|
68 declare void @printf(i8*, ...) #1
|