1 ; RUN: opt -S -newgvn %s | FileCheck %s
3 ; CHECK: define void @tinkywinky() {
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
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
34 @a = external global i32, align 4
35 @patatino = external unnamed_addr constant [2 x i8], align 1
36 define void @tinkywinky() {
38 %d = alloca i32, align 4
39 store i32 0, i32* null, align 4
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
46 %1 = load i32, i32* @a, align 4
47 store i32 %1, i32* %d, align 4
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
54 call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @patatino, i32 0, i32 0))
59 br i1 undef, label %while.body, label %while.end
61 call void (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @patatino, i32 0, i32 0))
64 %3 = load i32, i32* @a, align 4
65 store i32 %3, i32* undef, align 4
68 declare void @printf(i8*, ...) #1