1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[Orc] Fix sret/byval attributes in test (NFC)

This was placing sret/byval attributes without type argument on
non-pointer arguments. Make this valid IR by using pointer
arguments and passing the corresponding attribute type argument.
This commit is contained in:
Nikita Popov 2021-07-20 20:45:18 +02:00
parent 23d5a10c04
commit aa40b02846

View File

@ -18,17 +18,17 @@ namespace {
TEST(IndirectionUtilsTest, MakeStub) { TEST(IndirectionUtilsTest, MakeStub) {
LLVMContext Context; LLVMContext Context;
ModuleBuilder MB(Context, "x86_64-apple-macosx10.10", ""); ModuleBuilder MB(Context, "x86_64-apple-macosx10.10", "");
StructType *ArgTy = getDummyStructTy(Context);
Type *ArgPtrTy = PointerType::getUnqual(ArgTy);
FunctionType *FTy = FunctionType::get( FunctionType *FTy = FunctionType::get(
Type::getVoidTy(Context), Type::getVoidTy(Context), {ArgPtrTy, ArgPtrTy}, false);
{getDummyStructTy(Context), getDummyStructTy(Context)}, false);
Function *F = MB.createFunctionDecl(FTy, ""); Function *F = MB.createFunctionDecl(FTy, "");
AttributeSet FnAttrs = AttributeSet::get( AttributeSet FnAttrs = AttributeSet::get(
Context, AttrBuilder().addAttribute(Attribute::NoUnwind)); Context, AttrBuilder().addAttribute(Attribute::NoUnwind));
AttributeSet RetAttrs; // None AttributeSet RetAttrs; // None
AttributeSet ArgAttrs[2] = { AttributeSet ArgAttrs[2] = {
AttributeSet::get(Context, AttributeSet::get(Context, AttrBuilder().addStructRetAttr(ArgTy)),
AttrBuilder().addAttribute(Attribute::StructRet)), AttributeSet::get(Context, AttrBuilder().addByValAttr(ArgTy)),
AttributeSet::get(Context, AttrBuilder().addAttribute(Attribute::ByVal)),
}; };
F->setAttributes(AttributeList::get(Context, FnAttrs, RetAttrs, ArgAttrs)); F->setAttributes(AttributeList::get(Context, FnAttrs, RetAttrs, ArgAttrs));