Skip to content

Commit b16900f

Browse files
Fix an undefined behaviour in the SPIRV emit-intrinsics pass
1 parent fe7cb15 commit b16900f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,8 +2475,10 @@ void SPIRVEmitIntrinsics::parseFunDeclarations(Module &M) {
24752475
if (DemangledName.empty())
24762476
continue;
24772477
// allow only OpGroupAsyncCopy use case at the moment
2478-
auto [Grp, Opcode, ExtNo] =
2479-
SPIRV::mapBuiltinToOpcode(DemangledName, InstrSet);
2478+
auto [Grp, Opcode, ExtNo] = SPIRV::mapBuiltinToOpcode(
2479+
DemangledName, TM->getSubtarget<SPIRVSubtarget>(F).isOpenCLEnv()
2480+
? SPIRV::InstructionSet::OpenCL_std
2481+
: SPIRV::InstructionSet::GLSL_std_450);
24802482
if (Opcode != SPIRV::OpGroupAsyncCopy)
24812483
continue;
24822484
// find pointer arguments

0 commit comments

Comments
 (0)