1 ; RUN: opt -aa-pipeline=default -passes="default<O2>" -disable-output %s
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 @b = external global i32, align 4
9 @f = external global i32, align 4
10 @g = external global i32, align 4
12 define i32* @a(i32 %h) #0 {
14 %h.addr = alloca i32, align 4
15 store i32 %h, i32* %h.addr, align 4
16 %tmp0 = load i32, i32* %h.addr, align 4
17 switch i32 %tmp0, label %sw.default [
23 sw.bb: ; preds = %entry
24 %call = call i32 (...) @c()
27 sw.bb1: ; preds = %entry
28 %call2 = call i32 (...) @c()
31 sw.bb3: ; preds = %entry
32 %call4 = call i32 (...) @c()
33 %conv = sext i32 %call4 to i64
34 %tmp1 = inttoptr i64 %conv to i32*
37 sw.default: ; preds = %entry
44 %call1 = call i32 @j()
48 define internal i32 @j() #0 {
50 %i = alloca i32, align 4
51 store i32 0, i32* %i, align 4
54 for.cond: ; preds = %for.body, %entry
55 %tmp0 = load i32, i32* %i, align 4
56 %tmp1 = load i32, i32* @f, align 4
57 %cmp = icmp ult i32 %tmp0, %tmp1
58 br i1 %cmp, label %for.body, label %for.cond.cleanup
60 for.cond.cleanup: ; preds = %for.cond
61 %tmp2 = load i32, i32* @f, align 4
62 %call3 = call i32* @a(i32 %tmp2)
65 for.body: ; preds = %for.cond
66 %call = call i32 (...) @c()
67 %call1 = call i32 (...) @c()
68 %call2 = call i32 (...) @c()
69 %tmp3 = load i32, i32* @b, align 4
70 %tmp4 = load i32, i32* @g, align 4
71 %sub = sub nsw i32 %tmp4, %tmp3
72 store i32 %sub, i32* @g, align 4
73 %tmp5 = load i32, i32* %i, align 4
74 %inc = add i32 %tmp5, 1
75 store i32 %inc, i32* %i, align 4
79 declare i32 @c(...) #0
81 ; Function Attrs: argmemonly nounwind
82 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #2
84 ; Function Attrs: argmemonly nounwind
85 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #2
87 attributes #0 = { "use-soft-float"="false" }
88 attributes #1 = { "target-cpu"="x86-64" }
89 attributes #2 = { argmemonly nounwind }