From 55b756d90c35fdda30a18ab677747b0914dd24ea Mon Sep 17 00:00:00 2001 From: Dmitri Makarov Date: Wed, 17 Feb 2021 20:34:06 +0100 Subject: [PATCH] [SOL] Allow selectively disable compiler builtins for BPF target (#4) * [BPF] Make rust allocation builtins unavailable for BPF target - the calls to rust alloc/dealloc routines need to be preserved and not replaced by compiler generated builtin inlined code --- llvm/lib/Analysis/TargetLibraryInfo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp index 25951d2a7fe63c..421f8a42e7e2c9 100644 --- a/llvm/lib/Analysis/TargetLibraryInfo.cpp +++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp @@ -872,6 +872,12 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, TLI.setUnavailable(LibFunc_vec_free); } + if (T.isBPF()) { + TLI.setUnavailable(LibFunc_rust_alloc); + TLI.setUnavailable(LibFunc_rust_dealloc); + TLI.setUnavailable(LibFunc_rust_realloc); + } + TLI.addVectorizableFunctionsFromVecLib(ClVectorLibrary, T); }