[llvm] 86add58 - [SPIR-V] Return false after non-constant offset error in generateSampleImage (#203512)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 08:03:33 PDT 2026
Author: Arseniy Obolenskiy
Date: 2026-06-15T17:03:29+02:00
New Revision: 86add58afb1c2de7339e779ecec5d812810350f3
URL: https://github.com/llvm/llvm-project/commit/86add58afb1c2de7339e779ecec5d812810350f3
DIFF: https://github.com/llvm/llvm-project/commit/86add58afb1c2de7339e779ecec5d812810350f3.diff
LOG: [SPIR-V] Return false after non-constant offset error in generateSampleImage (#203512)
generateSampleImage emitted the diagnostic but kept building the
instruction, producing a malformed OpImageSample with the offset
silently dropped
Added:
Modified:
llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
llvm/test/CodeGen/SPIRV/hlsl-resources/SampleErrors.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
index 768fa89647d89..dc7143181968f 100644
--- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
@@ -5720,6 +5720,7 @@ bool SPIRVInstructionSelector::generateSampleImage(
else {
Pos.emitGenericError(
"Non-constant offsets are not supported in sample instructions.");
+ return false;
}
}
if (ImOps.MinLod)
diff --git a/llvm/test/CodeGen/SPIRV/hlsl-resources/SampleErrors.ll b/llvm/test/CodeGen/SPIRV/hlsl-resources/SampleErrors.ll
index 672715b37fbcf..bead56c600a7e 100644
--- a/llvm/test/CodeGen/SPIRV/hlsl-resources/SampleErrors.ll
+++ b/llvm/test/CodeGen/SPIRV/hlsl-resources/SampleErrors.ll
@@ -1,4 +1,4 @@
-; RUN: not llc -O0 -mtriple=spirv-vulkan-compute %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: not llc -O0 -mtriple=spirv-vulkan-compute %s -o - 2>&1 | FileCheck %s
; CHECK: error: {{.*}} Non-constant offsets are not supported in sample instructions.
More information about the llvm-commits
mailing list