1 ; RUN: opt -O2 -mtriple=bpf-pc-linux %s | llvm-dis > %t1
2 ; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK %s
3 ; RUN: opt -O2 -mtriple=bpf-pc-linux -bpf-disable-serialize-icmp %s | llvm-dis > %t1
4 ; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK-DISABLE %s
18 ; clang -target bpf -O2 -S -emit-llvm -Xclang -disable-llvm-passes test.c
20 ; Function Attrs: nounwind
21 define dso_local i32 @test() #0 {
23 %retval = alloca i32, align 4
24 %ret = alloca i32, align 4
25 %cleanup.dest.slot = alloca i32, align 4
26 %0 = bitcast i32* %ret to i8*
27 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #3
28 %call = call i32 bitcast (i32 (...)* @foo to i32 ()*)()
29 store i32 %call, i32* %ret, align 4, !tbaa !2
30 %1 = load i32, i32* %ret, align 4, !tbaa !2
31 %cmp = icmp sle i32 %1, 0
32 br i1 %cmp, label %if.then, label %if.end
34 ; CHECK: [[REG1:r[0-9]+]] <<= 32
35 ; CHECK: [[REG1]] s>>= 32
36 ; CHECK: [[REG2:r[0-9]+]] = 1
37 ; CHECK: if [[REG2]] s> [[REG1]] goto
38 ; CHECK: if [[REG1]] s> 7 goto
40 ; CHECK-DISABLE: [[REG1:r[0-9]+]] += -1
41 ; CHECK-DISABLE: [[REG1]] <<= 32
42 ; CHECK-DISABLE: [[REG1]] >>= 32
43 ; CHECK-DISABLE: if [[REG1]] > 6 goto
45 if.then: ; preds = %entry
46 store i32 0, i32* %retval, align 4
47 store i32 1, i32* %cleanup.dest.slot, align 4
50 if.end: ; preds = %entry
51 %2 = load i32, i32* %ret, align 4, !tbaa !2
52 %cmp1 = icmp sgt i32 %2, 7
53 br i1 %cmp1, label %if.then2, label %if.end3
55 if.then2: ; preds = %if.end
56 store i32 0, i32* %retval, align 4
57 store i32 1, i32* %cleanup.dest.slot, align 4
60 if.end3: ; preds = %if.end
61 %3 = load i32, i32* %ret, align 4, !tbaa !2
62 %call4 = call i32 @bar(i32 %3)
63 store i32 %call4, i32* %retval, align 4
64 store i32 1, i32* %cleanup.dest.slot, align 4
67 cleanup: ; preds = %if.end3, %if.then2, %if.then
68 %4 = bitcast i32* %ret to i8*
69 call void @llvm.lifetime.end.p0i8(i64 4, i8* %4) #3
70 %5 = load i32, i32* %retval, align 4
74 ; Function Attrs: argmemonly nounwind willreturn
75 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
77 declare dso_local i32 @foo(...) #2
79 declare dso_local i32 @bar(i32) #2
81 ; Function Attrs: argmemonly nounwind willreturn
82 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
84 attributes #0 = { nounwind "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
85 attributes #1 = { argmemonly nounwind willreturn }
86 attributes #2 = { "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
87 attributes #3 = { nounwind }
89 !llvm.module.flags = !{!0}
92 !0 = !{i32 1, !"wchar_size", i32 4}
93 !1 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git ca9c5433a6c31e372092fcd8bfd0e4fddd7e8784)"}
95 !3 = !{!"int", !4, i64 0}
96 !4 = !{!"omnipotent char", !5, i64 0}
97 !5 = !{!"Simple C/C++ TBAA"}