[libclc] [libclc] Restore always_inline for SPIR-V targets (PR #202891)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 15 23:55:58 PDT 2026
https://github.com/Eric-Guo-NXP updated https://github.com/llvm/llvm-project/pull/202891
>From bf6dc127ef26b556baa5dbd3bd863210f8417d41 Mon Sep 17 00:00:00 2001
From: Eric Guo <eric.guo at nxp.com>
Date: Tue, 16 Jun 2026 13:48:26 +0800
Subject: [PATCH] [libclc] Change SPIR-V build flag from -O0 to
-disable-llvm-passes
PR #158791 removed always_inline from _CLC_INLINE/_CLC_DEF. SPIR-V
targets built at -O0 and never run 'opt', so helpers were marked
optnone/noinline and survived as real calls, causing NIR validation
failures in rusticl (e.g. OpenCL CTS math_brute_force -w cos).
Build with '-Xclang -disable-llvm-passes' instead: SPIRV is generic
target and doesn't have TTI interface, which can cause optimizations
pass to make suboptimal decisions. An alternative approach is to
selectively disable some passes , but this is not trivial.
Co-authored-by: Wenju He <wenju.he at intel.com>
---
libclc/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index bc3624688a087..a4d8fa5b0ccbf 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -145,7 +145,7 @@ if(LIBCLC_TARGET_ARCH IN_LIST LIBCLC_ARCHS_SPIRV)
if(LIBCLC_TARGET_OS STREQUAL vulkan)
list(APPEND target_compile_flags -Wno-unknown-assumption -U__opencl_c_int64)
else()
- list(APPEND target_compile_flags -O0 -finline-hint-functions)
+ list(APPEND target_compile_flags "SHELL:-Xclang -disable-llvm-passes")
list(APPEND target_extra_defines CLC_SPIRV)
set(opt_flags)
endif()
More information about the cfe-commits
mailing list