Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,18 @@ static InstrSignature instrToSignature(const MachineInstr &MI,
InstrSignature Signature{MI.getOpcode()};
for (unsigned i = 0; i < MI.getNumOperands(); ++i) {
// The only decorations that can be applied more than once to a given <id>
// or structure member are UserSemantic(5635), CacheControlLoadINTEL (6442),
// and CacheControlStoreINTEL (6443). For all the rest of decorations, we
// will only add to the signature the Opcode, the id to which it applies,
// and the decoration id, disregarding any decoration flags. This will
// ensure that any subsequent decoration with the same id will be deemed as
// a duplicate. Then, at the call site, we will be able to handle duplicates
// in the best way.
// or structure member are FuncParamAttr (38), UserSemantic (5635),
// CacheControlLoadINTEL (6442), and CacheControlStoreINTEL (6443). For all
// the rest of decorations, we will only add to the signature the Opcode,
// the id to which it applies, and the decoration id, disregarding any
// decoration flags. This will ensure that any subsequent decoration with
// the same id will be deemed as a duplicate. Then, at the call site, we
// will be able to handle duplicates in the best way.
unsigned Opcode = MI.getOpcode();
if ((Opcode == SPIRV::OpDecorate) && i >= 2) {
unsigned DecorationID = MI.getOperand(1).getImm();
if (DecorationID != SPIRV::Decoration::UserSemantic &&
if (DecorationID != SPIRV::Decoration::FuncParamAttr &&
DecorationID != SPIRV::Decoration::UserSemantic &&
DecorationID != SPIRV::Decoration::CacheControlLoadINTEL &&
DecorationID != SPIRV::Decoration::CacheControlStoreINTEL)
continue;
Expand Down
4 changes: 3 additions & 1 deletion llvm/test/CodeGen/SPIRV/spirv_param_decorations_quals.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ entry:

; CHECK-SPIRV: OpDecorate %[[#PId:]] Volatile
; CHECK-SPIRV: OpDecorate %[[#PId]] FuncParamAttr NoAlias
; CHECK-SPIRV: OpDecorate %[[#PId]] FuncParamAttr NoWrite
; CHECK-SPIRV: %[[#PId]] = OpFunctionParameter %[[#]]

!7 = !{!"volatile"}
!8 = !{i32 38, i32 4} ; FuncParamAttr NoAlias
!9 = !{!8}
!11 = !{i32 38, i32 6} ; FuncParamAttr NoWrite
!9 = !{!8, !11}
!10 = !{!9}