diff --git a/llvm-spirv/lib/SPIRV/libSPIRV/SPIRVInstruction.h b/llvm-spirv/lib/SPIRV/libSPIRV/SPIRVInstruction.h index ecfef98e53824..cfd71cfccc923 100644 --- a/llvm-spirv/lib/SPIRV/libSPIRV/SPIRVInstruction.h +++ b/llvm-spirv/lib/SPIRV/libSPIRV/SPIRVInstruction.h @@ -276,9 +276,6 @@ class SPIRVInstTemplateBase : public SPIRVInstruction { } else SPIRVEntry::setWordCount(WC); Ops = TheOps; - // The required SPIR-V version depends on the operands for some - // instructions. - updateModuleVersion(); } void setWordCount(SPIRVWord TheWordCount) override { SPIRVEntry::setWordCount(TheWordCount); @@ -298,11 +295,6 @@ class SPIRVInstTemplateBase : public SPIRVInstruction { /// Get operand as value. /// If the operand is a literal, return it as a uint32 constant. - const SPIRVValue *getOpValue(int I) const { - return isOperandLiteral(I) ? Module->getLiteralAsConstant(Ops[I]) - : getValue(Ops[I]); - } - SPIRVValue *getOpValue(int I) { return isOperandLiteral(I) ? Module->getLiteralAsConstant(Ops[I]) : getValue(Ops[I]); @@ -323,10 +315,6 @@ class SPIRVInstTemplateBase : public SPIRVInstruction { return Operands; } - virtual const SPIRVValue *getOperand(unsigned I) const { - return getOpValue(I); - } - virtual SPIRVValue *getOperand(unsigned I) { return getOpValue(I); } @@ -2515,22 +2503,6 @@ class SPIRVGroupNonUniformBallotInst : public SPIRVInstTemplateBase { SPIRVCapVec getRequiredCapability() const override { return getVec(CapabilityGroupNonUniformBallot); } - - SPIRVWord getRequiredSPIRVVersion() const override { - switch (OpCode) { - case OpGroupNonUniformBroadcast: { - assert(Ops.size() == 3 && "Expecting (Execution, Value, Id) operands"); - if (!isConstantOpCode(getOperand(2)->getOpCode())) { - // Before version 1.5, Id must come from a constant instruction. - return static_cast<SPIRVWord>(VersionNumber::SPIRV_1_5); - } - break; - } - default: - break; - } - return static_cast<SPIRVWord>(VersionNumber::SPIRV_1_3); - } }; #define _SPIRV_OP(x, ...) \ diff --git a/llvm-spirv/test/transcoding/subgroup_spirv_1_5.cl b/llvm-spirv/test/transcoding/subgroup_spirv_1_5.cl deleted file mode 100644 index be7dbf59a49d6..0000000000000 --- a/llvm-spirv/test/transcoding/subgroup_spirv_1_5.cl +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: %clang_cc1 -triple spir-unknown-unknown -O1 -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header -emit-llvm-bc %s -o %t.bc -// RUN: not llvm-spirv --spirv-max-version=1.4 %t.bc 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s -// RUN: llvm-spirv %t.bc -o %t.spv -// RUN: spirv-val %t.spv -// RUN: llvm-spirv -r %t.spv -o %t.rev.bc -// RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM - -// Before SPIR-V 1.5, the Id operand of OpGroupNonUniformBroadcast must come from a constant instruction. -// CHECK-ERROR: RequiresVersion: Cannot fulfill SPIR-V version restriction: -// CHECK-ERROR-NEXT: SPIR-V version was restricted to at most 1.4 (66560) but a construct from the input requires SPIR-V version 1.5 (66816) or above - -// CHECK-LLVM-LABEL: @test -// CHECK-LLVM: call spir_func i16 @_Z31sub_group_non_uniform_broadcasttj(i16 %a, i32 %id) - -kernel void test(short a, uint id, global short *res) { - res[0] = sub_group_non_uniform_broadcast(a, id); -}