1 ; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
2 ; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
3 ; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
4 ; RUN: llc %t1 -mcpu=v3 -o - | FileCheck -check-prefixes=CHECK,CHECK-V3 %s
7 ; unsigned bar(unsigned);
8 ; unsigned int test(unsigned *p) {
9 ; if (*p <= 1 || *p >= 7)
14 ; clang -target bpf -O2 -S -emit-llvm -Xclang -disable-llvm-passes test.c
16 ; Function Attrs: nounwind
17 define dso_local i32 @test(ptr noundef %p) #0 {
19 %retval = alloca i32, align 4
20 %p.addr = alloca ptr, align 8
21 store ptr %p, ptr %p.addr, align 8, !tbaa !3
22 %0 = load ptr, ptr %p.addr, align 8, !tbaa !3
23 %1 = load i32, ptr %0, align 4, !tbaa !7
24 %cmp = icmp ule i32 %1, 1
25 br i1 %cmp, label %if.then, label %lor.lhs.false
27 lor.lhs.false: ; preds = %entry
28 %2 = load ptr, ptr %p.addr, align 8, !tbaa !3
29 %3 = load i32, ptr %2, align 4, !tbaa !7
30 %cmp1 = icmp uge i32 %3, 7
31 br i1 %cmp1, label %if.then, label %if.end
33 if.then: ; preds = %lor.lhs.false, %entry
34 store i32 0, ptr %retval, align 4
37 if.end: ; preds = %lor.lhs.false
38 %4 = load ptr, ptr %p.addr, align 8, !tbaa !3
39 %5 = load i32, ptr %4, align 4, !tbaa !7
40 %call = call i32 @bar(i32 noundef %5)
41 store i32 %call, ptr %retval, align 4
44 return: ; preds = %if.end, %if.then
45 %6 = load i32, ptr %retval, align 4
50 ; CHECK-V1: if r[[#]] > r[[#]] goto
51 ; CHECK-V1: if r[[#]] > 6 goto
52 ; CHECK-V3: if w[[#]] < 2 goto
53 ; CHECK-V3: if w[[#]] > 6 goto
55 declare dso_local i32 @bar(i32 noundef) #1
57 attributes #0 = { nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
58 attributes #1 = { "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
60 !llvm.module.flags = !{!0, !1}
63 !0 = !{i32 1, !"wchar_size", i32 4}
64 !1 = !{i32 7, !"frame-pointer", i32 2}
65 !2 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git 2a25e1af85f3138f70888c4c3f359c6a09e3cfe5)"}
67 !4 = !{!"any pointer", !5, i64 0}
68 !5 = !{!"omnipotent char", !6, i64 0}
69 !6 = !{!"Simple C/C++ TBAA"}
71 !8 = !{!"int", !5, i64 0}