[clang] [llvm] [SPIRV] Backend service functions must handle callees with aligned returns (PR #240910)
Alex Voicu via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 12 05:55:49 PST 2026
================
@@ -0,0 +1,18 @@
+; Ensure that implicitly inserted service functions are lowered into valid MIR.
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers %s -o - | FileCheck %s
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers %s -o - | FileCheck %s
+; TODO: We do not generate correct SPIR-V for this pattern, which is used for e.g. std::endl handling, thus spirv-val is disabled.
+; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers %s -o - -filetype=obj | spirv-val %}
+; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_function_pointers %s -o - -filetype=obj | spirv-val %}
+
+; CHECK: OpCapability FunctionPointersINTEL
+; CHECK: OpExtension "SPV_INTEL_function_pointers"
+; CHECK: OpDecorate %[[#]] LinkageAttributes "e" Import
----------------
AlexVlx wrote:
The test for this particular case is just to show that the service function does not generate broken MIR. The SPIR-V, beyond existing, is not super informative because, as the `TODO:` says, it is broken due to other lingering bugs. I can reform the test to merely look at MIR after `IRTranslator` - perhaps I should as it'd be more "surgical".
https://github.com/llvm/llvm-project/pull/240910
More information about the cfe-commits
mailing list