Skip to content

Commit a4ec8ee

Browse files
MrSidimsPavel V Chupin
authored andcommitted
Explicitly add 'sret' parameter attribute for builtins (intel#1438)
* Explicitly add 'sret' parameter attribute for builtins It's required after: commit 2182665 Author: Nikita Popov <[email protected]> Date: Fri Mar 11 17:30:34 2022 +0100 [Bitcode] Don't confuse type attributes on declaration and call We should not be using APIs here that try to fetch the attribute from both the call attributes and the function attributes. Otherwise we'll try to upgrade a non-existent sret attribute on the call using the attribute on the function. Signed-off-by: Dmitry Sidorov <[email protected]> * Little refactoring Signed-off-by: Dmitry Sidorov <[email protected]> Original commit: KhronosGroup/SPIRV-LLVM-Translator@f009f45
1 parent c33414c commit a4ec8ee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm-spirv/lib/SPIRV/SPIRVUtil.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,13 +1936,14 @@ bool postProcessBuiltinReturningStruct(Function *F) {
19361936
PointerType::get(F->getReturnType(), SPIRAS_Private));
19371937
auto *NewF =
19381938
getOrCreateFunction(M, Type::getVoidTy(*Context), ArgTys, Name);
1939-
NewF->addParamAttr(0, Attribute::get(*Context,
1940-
Attribute::AttrKind::StructRet,
1941-
F->getReturnType()));
1939+
auto SretAttr = Attribute::get(*Context, Attribute::AttrKind::StructRet,
1940+
F->getReturnType());
1941+
NewF->addParamAttr(0, SretAttr);
19421942
NewF->setCallingConv(F->getCallingConv());
19431943
auto Args = getArguments(CI);
19441944
Args.insert(Args.begin(), ST->getPointerOperand());
19451945
auto *NewCI = CallInst::Create(NewF, Args, CI->getName(), CI);
1946+
NewCI->addParamAttr(0, SretAttr);
19461947
NewCI->setCallingConv(CI->getCallingConv());
19471948
InstToRemove.push_back(ST);
19481949
InstToRemove.push_back(CI);

0 commit comments

Comments
 (0)