From 5cdf648eb562eb0e1548b65ae9c26badd12ae3d9 Mon Sep 17 00:00:00 2001 From: vad Date: Mon, 1 Jun 2026 15:07:57 +0200 Subject: [PATCH 1/4] tests: codegen-llvm: Allow additional LLVM attributes in bpf-alu32 The LLVM backend now emits `noundef zeroext` on `i8` return values and `noundef` on `i8` parameters. Update the FileCheck pattern to match those, and any possible future attributes. --- tests/codegen-llvm/bpf-alu32.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/codegen-llvm/bpf-alu32.rs b/tests/codegen-llvm/bpf-alu32.rs index 13a7b658cecce..b722534774088 100644 --- a/tests/codegen-llvm/bpf-alu32.rs +++ b/tests/codegen-llvm/bpf-alu32.rs @@ -5,7 +5,7 @@ #[no_mangle] #[target_feature(enable = "alu32")] -// CHECK: define i8 @foo(i8 returned %arg) unnamed_addr #0 +// CHECK: define {{.*}}i8 @foo(i8 {{.*}}%arg) unnamed_addr #0 pub unsafe fn foo(arg: u8) -> u8 { arg } From 6a1b87296eb7bec2fd0e62bdbdf53a0030f2714d Mon Sep 17 00:00:00 2001 From: vad Date: Mon, 1 Jun 2026 15:49:22 +0200 Subject: [PATCH 2/4] tests: codegen-llvm: Use minicore in bpf-alu32 Instead of keeping it as `only-bpf`, use minicore. This way we make sure it will never get outdated again. --- tests/codegen-llvm/bpf-alu32.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/codegen-llvm/bpf-alu32.rs b/tests/codegen-llvm/bpf-alu32.rs index b722534774088..8a1d6045eaa3c 100644 --- a/tests/codegen-llvm/bpf-alu32.rs +++ b/tests/codegen-llvm/bpf-alu32.rs @@ -1,8 +1,14 @@ -//@ only-bpf +//@ add-minicore +//@ compile-flags: --target=bpfel-unknown-none +//@ needs-llvm-components: bpf #![crate_type = "lib"] -#![feature(bpf_target_feature)] +#![feature(bpf_target_feature, no_core)] +#![no_core] #![no_std] +extern crate minicore; +use minicore::*; + #[no_mangle] #[target_feature(enable = "alu32")] // CHECK: define {{.*}}i8 @foo(i8 {{.*}}%arg) unnamed_addr #0 From 1df9b8af17292672236493f5b6cc22cf15f8041a Mon Sep 17 00:00:00 2001 From: vad Date: Tue, 2 Jun 2026 14:25:48 +0200 Subject: [PATCH 3/4] tests: codegen-llvm: Check whether feature is emitted in bpf-alu32 test Check whether the `"target-feature"` attribure was actually emitted in LLVM IR. --- tests/codegen-llvm/bpf-alu32.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/codegen-llvm/bpf-alu32.rs b/tests/codegen-llvm/bpf-alu32.rs index 8a1d6045eaa3c..c48988271d9a3 100644 --- a/tests/codegen-llvm/bpf-alu32.rs +++ b/tests/codegen-llvm/bpf-alu32.rs @@ -12,6 +12,7 @@ use minicore::*; #[no_mangle] #[target_feature(enable = "alu32")] // CHECK: define {{.*}}i8 @foo(i8 {{.*}}%arg) unnamed_addr #0 +// CHECK: attributes #0 = { {{.*}}"target-features"="{{[^"]*}}+alu32{{.*}} } pub unsafe fn foo(arg: u8) -> u8 { arg } From 177a0ece7470e81f67e42ef27a2aecdbad759212 Mon Sep 17 00:00:00 2001 From: vad Date: Wed, 3 Jun 2026 12:56:07 +0200 Subject: [PATCH 4/4] tests: codegen-llvm: Add `-C opt-level=0` to bpf-alu32 test Make sure that optimizations don't affect the resulting IR. --- tests/codegen-llvm/bpf-alu32.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/codegen-llvm/bpf-alu32.rs b/tests/codegen-llvm/bpf-alu32.rs index c48988271d9a3..7fef7e4101eed 100644 --- a/tests/codegen-llvm/bpf-alu32.rs +++ b/tests/codegen-llvm/bpf-alu32.rs @@ -1,5 +1,5 @@ //@ add-minicore -//@ compile-flags: --target=bpfel-unknown-none +//@ compile-flags: --target=bpfel-unknown-none -C opt-level=0 //@ needs-llvm-components: bpf #![crate_type = "lib"] #![feature(bpf_target_feature, no_core)]