Skip to content

Commit dba4b3f

Browse files
authored
[SPIRV] Filter out illegal attributes to align with Khronos behaviour (#15295)
Fixes #10817. Signed-off-by: Marcos Maronas <marcos.maronas@intel.com>
1 parent 00b4a92 commit dba4b3f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

llvm-spirv/lib/SPIRV/SPIRVReader.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,12 +3044,15 @@ Function *SPIRVToLLVM::transFunction(SPIRVFunction *BF) {
30443044
auto BA = BF->getArgument(I->getArgNo());
30453045
mapValue(BA, &(*I));
30463046
setName(&(*I), BA);
3047+
AttributeMask IllegalAttrs = AttributeFuncs::typeIncompatible(I->getType());
30473048
BA->foreachAttr([&](SPIRVFuncParamAttrKind Kind) {
30483049
// Skip this function parameter attribute as it will translated among
30493050
// OpenCL metadata
30503051
if (Kind == FunctionParameterAttributeRuntimeAlignedINTEL)
30513052
return;
30523053
Attribute::AttrKind LLVMKind = SPIRSPIRVFuncParamAttrMap::rmap(Kind);
3054+
if (IllegalAttrs.contains(LLVMKind))
3055+
return;
30533056
Type *AttrTy = nullptr;
30543057
switch (LLVMKind) {
30553058
case Attribute::AttrKind::ByVal:

llvm-spirv/test/image.ll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
; XFAIL: *
2-
31
; RUN: llvm-as %s -o %t.bc
42
; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
53
; RUN: llvm-spirv %t.bc -o %t.spv

0 commit comments

Comments
 (0)