Skip to content

Commit 53ad077

Browse files
author
git apple-llvm automerger
committed
Merge commit '38f3dbefab0a' from llvm.org/release/19.x into stable/20240723
2 parents 2cda1ca + 38f3dbe commit 53ad077

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

llvm/include/llvm/IR/IntrinsicsBPF.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
// Specialized loads from packet
1414
let TargetPrefix = "bpf" in { // All intrinsics start with "llvm.bpf."
1515
def int_bpf_load_byte : ClangBuiltin<"__builtin_bpf_load_byte">,
16-
Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
16+
DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
1717
def int_bpf_load_half : ClangBuiltin<"__builtin_bpf_load_half">,
18-
Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
18+
DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
1919
def int_bpf_load_word : ClangBuiltin<"__builtin_bpf_load_word">,
20-
Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
20+
DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
2121
def int_bpf_pseudo : ClangBuiltin<"__builtin_bpf_pseudo">,
2222
Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty]>;
2323
def int_bpf_preserve_field_info : ClangBuiltin<"__builtin_bpf_preserve_field_info">,

llvm/test/CodeGen/BPF/sockex2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ flow_dissector.exit.thread: ; preds = %86, %12, %196, %199
311311
; CHECK-LABEL: bpf_prog2:
312312
; CHECK: r0 = *(u16 *)skb[12] # encoding: [0x28,0x00,0x00,0x00,0x0c,0x00,0x00,0x00]
313313
; CHECK: r0 = *(u16 *)skb[16] # encoding: [0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00]
314-
; CHECK: implicit-def: $r8
314+
; CHECK: implicit-def: $r7
315315
; CHECK: r1 =
316316
; CHECK: call 1 # encoding: [0x85,0x00,0x00,0x00,0x01,0x00,0x00,0x00]
317317
; CHECK: call 2 # encoding: [0x85,0x00,0x00,0x00,0x02,0x00,0x00,0x00]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S < %s -passes=dce | FileCheck %s
3+
4+
declare i64 @llvm.bpf.load.half(ptr, i64)
5+
declare i64 @llvm.bpf.load.word(ptr, i64)
6+
declare i64 @llvm.bpf.load.byte(ptr, i64)
7+
8+
define void @test_bpf_load_half(ptr %a, i64 %b) {
9+
; CHECK-LABEL: define void @test_bpf_load_half(
10+
; CHECK-SAME: ptr [[A:%.*]], i64 [[B:%.*]]) {
11+
; CHECK-NEXT: ret void
12+
;
13+
%v = call i64 @llvm.bpf.load.half(ptr %a, i64 %b)
14+
ret void
15+
}
16+
17+
define void @test_bpf_load_word(ptr %a, i64 %b) {
18+
; CHECK-LABEL: define void @test_bpf_load_word(
19+
; CHECK-SAME: ptr [[A:%.*]], i64 [[B:%.*]]) {
20+
; CHECK-NEXT: ret void
21+
;
22+
%v = call i64 @llvm.bpf.load.word(ptr %a, i64 %b)
23+
ret void
24+
}
25+
26+
define void @test_bpf_load_byte(ptr %a, i64 %b) {
27+
; CHECK-LABEL: define void @test_bpf_load_byte(
28+
; CHECK-SAME: ptr [[A:%.*]], i64 [[B:%.*]]) {
29+
; CHECK-NEXT: ret void
30+
;
31+
%v = call i64 @llvm.bpf.load.byte(ptr %a, i64 %b)
32+
ret void
33+
}

0 commit comments

Comments
 (0)