Skip to content

Commit df2134d

Browse files
apply a code review suggestion
1 parent b16900f commit df2134d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class SPIRVEmitIntrinsics
7474
DenseMap<Instruction *, Constant *> AggrConsts;
7575
DenseMap<Instruction *, Type *> AggrConstTypes;
7676
DenseSet<Instruction *> AggrStores;
77-
SPIRV::InstructionSet::InstructionSet InstrSet;
7877

7978
// map of function declarations to <pointer arg index => element type>
8079
DenseMap<Function *, SmallVector<std::pair<unsigned, Type *>>> FDeclPtrTys;
@@ -896,8 +895,10 @@ bool SPIRVEmitIntrinsics::deduceOperandElementTypeCalledFunction(
896895
getOclOrSpirvBuiltinDemangledName(CalledF->getName());
897896
if (DemangledName.length() > 0 &&
898897
!StringRef(DemangledName).starts_with("llvm.")) {
899-
auto [Grp, Opcode, ExtNo] =
900-
SPIRV::mapBuiltinToOpcode(DemangledName, InstrSet);
898+
auto [Grp, Opcode, ExtNo] = SPIRV::mapBuiltinToOpcode(
899+
DemangledName, TM->getSubtarget<SPIRVSubtarget>(*CalledF).isOpenCLEnv()
900+
? SPIRV::InstructionSet::OpenCL_std
901+
: SPIRV::InstructionSet::GLSL_std_450);
901902
if (Opcode == SPIRV::OpGroupAsyncCopy) {
902903
for (unsigned i = 0, PtrCnt = 0; i < CI->arg_size() && PtrCnt < 2; ++i) {
903904
Value *Op = CI->getArgOperand(i);
@@ -2316,10 +2317,6 @@ bool SPIRVEmitIntrinsics::runOnFunction(Function &Func) {
23162317
return false;
23172318

23182319
const SPIRVSubtarget &ST = TM->getSubtarget<SPIRVSubtarget>(Func);
2319-
GR = ST.getSPIRVGlobalRegistry();
2320-
InstrSet = ST.isOpenCLEnv() ? SPIRV::InstructionSet::OpenCL_std
2321-
: SPIRV::InstructionSet::GLSL_std_450;
2322-
23232320
if (!CurrF)
23242321
HaveFunPtrs =
23252322
ST.canUseExtension(SPIRV::Extension::SPV_INTEL_function_pointers);

0 commit comments

Comments
 (0)