From 68e01339cc5bc3d8a885bc9413611fbc6ca151e4 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 13 Feb 2021 17:43:17 +0100 Subject: [CGBuilder] Remove type-less CreateAlignedLoad() APIs (NFC) These are incompatible with opaque pointers. This is in preparation of dropping this API on the IRBuilder side as well. Instead explicitly pass the loaded type. --- clang/lib/CodeGen/CodeGenFunction.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index f03208f..3a7d1ab 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1062,8 +1062,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, llvm::Function::arg_iterator EI = CurFn->arg_end(); --EI; llvm::Value *Addr = Builder.CreateStructGEP(nullptr, &*EI, Idx); + llvm::Type *Ty = + cast(Addr)->getResultElementType(); ReturnValuePointer = Address(Addr, getPointerAlign()); - Addr = Builder.CreateAlignedLoad(Addr, getPointerAlign(), "agg.result"); + Addr = Builder.CreateAlignedLoad(Ty, Addr, getPointerAlign(), "agg.result"); ReturnValue = Address(Addr, CGM.getNaturalTypeAlignment(RetTy)); } else { ReturnValue = CreateIRTemp(RetTy, "retval"); -- cgit v1.1