2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 ; RUN: opt -O2 -S < %s | FileCheck %s
15 @d = common global i32 0, align 4
16 @b = common global i32 0, align 4
17 @f = common global [1 x [3 x i8]] zeroinitializer, align 1
18 @e = common global i32 0, align 4
19 @c = common global i32 0, align 4
20 @a = common global i32 0, align 4
22 ; Function Attrs: nounwind uwtable
25 store i32 0, i32* @d, align 4
28 for.cond: ; preds = %for.inc8, %entry
29 %0 = load i32, i32* @d, align 4
30 %cmp = icmp slt i32 %0, 2
31 br i1 %cmp, label %for.body, label %for.end10
33 for.body: ; preds = %for.cond
34 %1 = load i32, i32* @d, align 4
35 %idxprom = sext i32 %1 to i64
36 %2 = load i32, i32* @b, align 4
37 %idxprom1 = sext i32 %2 to i64
38 %arrayidx = getelementptr inbounds [1 x [3 x i8]], [1 x [3 x i8]]* @f, i32 0, i64 %idxprom1
39 %arrayidx2 = getelementptr inbounds [3 x i8], [3 x i8]* %arrayidx, i32 0, i64 %idxprom
40 store i8 0, i8* %arrayidx2, align 1
41 store i32 0, i32* @e, align 4
44 for.cond3: ; preds = %for.inc, %for.body
45 %3 = load i32, i32* @e, align 4
46 %cmp4 = icmp slt i32 %3, 3
47 br i1 %cmp4, label %for.body5, label %for.end
49 for.body5: ; preds = %for.cond3
50 %4 = load i32, i32* @c, align 4
51 %tobool = icmp ne i32 %4, 0
52 br i1 %tobool, label %if.then, label %if.end
54 if.then: ; preds = %for.body5
55 %5 = load i32, i32* @a, align 4
56 %dec = add nsw i32 %5, -1
57 store i32 %dec, i32* @a, align 4
60 if.end: ; preds = %if.then, %for.body5
61 %6 = load i32, i32* @e, align 4
62 %idxprom6 = sext i32 %6 to i64
63 %arrayidx7 = getelementptr inbounds [3 x i8], [3 x i8]* getelementptr inbounds ([1 x [3 x i8]], [1 x [3 x i8]]* @f, i32 0, i64 0), i32 0, i64 %idxprom6
64 store i8 1, i8* %arrayidx7, align 1
67 for.inc: ; preds = %if.end
68 %7 = load i32, i32* @e, align 4
69 %inc = add nsw i32 %7, 1
70 store i32 %inc, i32* @e, align 4
73 for.end: ; preds = %for.cond3
76 for.inc8: ; preds = %for.end
77 %8 = load i32, i32* @d, align 4
78 %inc9 = add nsw i32 %8, 1
79 store i32 %inc9, i32* @d, align 4
82 for.end10: ; preds = %for.cond
86 ; Function Attrs: nounwind uwtable
89 %retval = alloca i32, align 4
90 store i32 0, i32* %retval
92 %0 = load i8, i8* getelementptr inbounds ([1 x [3 x i8]], [1 x [3 x i8]]* @f, i32 0, i64 0, i64 1), align 1
93 %conv = sext i8 %0 to i32
94 %cmp = icmp ne i32 %conv, 1
95 br i1 %cmp, label %if.then, label %if.end
97 if.then: ; preds = %entry
101 if.end: ; preds = %entry
105 ; Function Attrs: noreturn nounwind
106 declare void @abort()