blob: 82c333bb45e869b517f0c78089a8eb20e6bdf0f8 [file] [log] [blame]
David Callahanebcf9162016-12-13 16:42:18 +00001; RUN: opt < %s -sroa -adce -adce-remove-loops -S | FileCheck %s
2; ModuleID = 'test1.bc'
3source_filename = "test1.c"
4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-unknown-linux-gnu"
6
7; Function Attrs: nounwind uwtable
8define i32 @foo(i32, i32, i32) #0 {
9 %4 = alloca i32, align 4
10 %5 = alloca i32, align 4
11 %6 = alloca i32, align 4
12 %7 = alloca i32, align 4
13 %8 = alloca i32, align 4
14 store i32 %0, i32* %4, align 4
15 store i32 %1, i32* %5, align 4
16 store i32 %2, i32* %6, align 4
17 store i32 0, i32* %7, align 4
18 %9 = load i32, i32* %5, align 4
19 %I10 = icmp ne i32 %9, 0
20 br i1 %I10, label %B11, label %B21
21
22B11:
23 store i32 0, i32* %8, align 4
24 br label %B12
25
26B12:
27 %I13 = load i32, i32* %8, align 4
28 %I14 = load i32, i32* %6, align 4
29 %I15 = icmp slt i32 %I13, %I14
30; CHECK: br label %B20
31 br i1 %I15, label %B16, label %B20
32
33B16:
34 br label %B17
35
36B17:
37 %I18 = load i32, i32* %8, align 4
38 %I19 = add nsw i32 %I18, 1
39 store i32 %I19, i32* %8, align 4
40 br label %B12
41
42B20:
43 store i32 1, i32* %7, align 4
44 br label %B21
45
46B21:
47 %I22 = load i32, i32* %7, align 4
48 ret i32 %I22
49}
50
51attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
52
53!llvm.ident = !{!0}
54
55!0 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 5864a13abf4490e76ae2eb0896198e1305927df2)"}