Skip to content

Commit f797de2

Browse files
authored
Fix SPIRV -> OCL barrier call argument attributes (#1407)
The first arg of CI is not used as arg in NewCI. So its attribute should be removed from attributes of NewCI.
1 parent a46d8a6 commit f797de2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/SPIRV/SPIRVToOCL20.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ void SPIRVToOCL20Base::visitCallSPIRVMemoryBarrier(CallInst *CI) {
9797

9898
void SPIRVToOCL20Base::visitCallSPIRVControlBarrier(CallInst *CI) {
9999
AttributeList Attrs = CI->getCalledFunction()->getAttributes();
100+
SmallVector<AttributeSet, 2> ArgAttrs = {Attrs.getParamAttrs(1),
101+
Attrs.getParamAttrs(2)};
102+
AttributeList NewAttrs = AttributeList::get(*Ctx, Attrs.getFnAttrs(),
103+
Attrs.getRetAttrs(), ArgAttrs);
100104
mutateCallInstOCL(
101105
M, CI,
102106
[=](CallInst *, std::vector<Value *> &Args) {
@@ -116,7 +120,7 @@ void SPIRVToOCL20Base::visitCallSPIRVControlBarrier(CallInst *CI) {
116120
return (ExecScope == ScopeWorkgroup) ? kOCLBuiltinName::WorkGroupBarrier
117121
: kOCLBuiltinName::SubGroupBarrier;
118122
},
119-
&Attrs);
123+
&NewAttrs);
120124
}
121125

122126
std::string SPIRVToOCL20Base::mapFPAtomicName(Op OC) {

0 commit comments

Comments
 (0)