[llvm] [BPF] crash fix for memcpy with unsupported alignment (PR #199541)

Claire Fan via llvm-commits llvm-commits at lists.llvm.org
Wed May 27 19:57:48 PDT 2026


================
@@ -21,9 +21,18 @@ using namespace llvm;
 
 #define DEBUG_TYPE "bpf-selectiondag-info"
 
+static cl::opt<unsigned> BPFMaxStoresPerMemFunc(
+    "bpf-max-stores-per-memfunc", cl::Hidden, cl::init(128),
----------------
clairechingching wrote:

In our use case, having `BPFMaxStoresPerMemFunc` fixed at 128 means most constant-size memory operations are forced into inline load/store expansion, which can become quite expensive in our execution environment.

we'd like to be able to lower the threshold and allow more memory operations to naturally fall through to libcalls, so the implementation can be tailored to the target environment instead of always materializing large inline sequences in LLVM.

we have explored using the technique for u128 multiplication here, where libcalls act as an interface between compiler-generated code and runtime-specific optimization while keeping normal Rust source code unchanged:

https://blueshift.gg/research/accelerating-u128-math-with-libcalls-and-jit-intrinsics

The proposed flag is opt-in and disabled by default, so the existing kernel-oriented behavior remains unchanged.

https://github.com/llvm/llvm-project/pull/199541


More information about the llvm-commits mailing list