Skip to content

Commit ef3f5fc

Browse files
committed
PR feedback
1 parent 76245d4 commit ef3f5fc

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,14 +4023,16 @@ bool SPIRVInstructionSelector::loadBuiltinInputID(
40234023
SPIRV::BuiltIn::BuiltIn BuiltInValue, Register ResVReg,
40244024
const SPIRVType *ResType, MachineInstr &I) const {
40254025
MachineIRBuilder MIRBuilder(I);
4026-
const SPIRVType *U32Type = GR.getOrCreateSPIRVIntegerType(32, MIRBuilder);
40274026
const SPIRVType *PtrType = GR.getOrCreateSPIRVPointerType(
4028-
U32Type, MIRBuilder, SPIRV::StorageClass::Input);
4027+
ResType, MIRBuilder, SPIRV::StorageClass::Input);
40294028

40304029
// Create new register for the input ID builtin variable.
40314030
Register NewRegister =
4032-
MIRBuilder.getMRI()->createVirtualRegister(&SPIRV::iIDRegClass);
4033-
MIRBuilder.getMRI()->setType(NewRegister, LLT::pointer(0, 64));
4031+
MIRBuilder.getMRI()->createVirtualRegister(GR.getRegClass(PtrType));
4032+
MIRBuilder.getMRI()->setType(
4033+
NewRegister,
4034+
LLT::pointer(storageClassToAddressSpace(SPIRV::StorageClass::Input),
4035+
GR.getPointerSize()));
40344036
GR.assignSPIRVTypeToVReg(PtrType, NewRegister, MIRBuilder.getMF());
40354037

40364038
// Build global variable with the necessary decorations for the input ID
@@ -4043,7 +4045,7 @@ bool SPIRVInstructionSelector::loadBuiltinInputID(
40434045
// Load uint value from the global variable.
40444046
auto MIB = BuildMI(*I.getParent(), I, I.getDebugLoc(), TII.get(SPIRV::OpLoad))
40454047
.addDef(ResVReg)
4046-
.addUse(GR.getSPIRVTypeID(U32Type))
4048+
.addUse(GR.getSPIRVTypeID(ResType))
40474049
.addUse(Variable);
40484050

40494051
return MIB.constrainAllUses(TII, TRI, RBI);

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/SV_GroupIndex.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-vulkan-unknown %s -o - | FileCheck %s
2-
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val %}
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-vulkan-unknown %s -o - -filetype=obj | spirv-val --target-env vulkan1.3 %}
33

44
; CHECK-DAG: %[[#int:]] = OpTypeInt 32 0
55
; CHECK-DAG: %[[#ptr_Input_int:]] = OpTypePointer Input %[[#int]]

0 commit comments

Comments
 (0)