diff options
author | Nikita Popov <npopov@redhat.com> | 2021-12-16 15:36:20 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2021-12-16 16:34:09 +0100 |
commit | 2d89382b5a21423180c7860163bb0e4cd3082e4b (patch) | |
tree | f7782987c74407e6a6fc36c06ff48b16356038c2 /clang/lib/CodeGen/CGCall.cpp | |
parent | 2dbe5898d78221c7599592fd2380eae18788bb60 (diff) | |
download | llvm-2d89382b5a21423180c7860163bb0e4cd3082e4b.zip llvm-2d89382b5a21423180c7860163bb0e4cd3082e4b.tar.gz llvm-2d89382b5a21423180c7860163bb0e4cd3082e4b.tar.bz2 |
[CodeGen] Avoid more pointer element type accesses
This is enough to build sqlite3 with opaque pointers.
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 8ecef6a..28fc75b 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -2686,8 +2686,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, case ABIArgInfo::Indirect: case ABIArgInfo::IndirectAliased: { assert(NumIRArgs == 1); - Address ParamAddr = - Address(Fn->getArg(FirstIRArg), ArgI.getIndirectAlign()); + Address ParamAddr = Address(Fn->getArg(FirstIRArg), ConvertTypeForMem(Ty), + ArgI.getIndirectAlign()); if (!hasScalarEvaluationKind(Ty)) { // Aggregates and complex variables are accessed by reference. All we @@ -4869,7 +4869,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, I->copyInto(*this, AI); } else { // Skip the extra memcpy call. - auto *T = V->getType()->getPointerElementType()->getPointerTo( + auto *T = llvm::PointerType::getWithSamePointeeType( + cast<llvm::PointerType>(V->getType()), CGM.getDataLayout().getAllocaAddrSpace()); IRCallArgs[FirstIRArg] = getTargetHooks().performAddrSpaceCast( *this, V, LangAS::Default, CGM.getASTAllocaAddressSpace(), T, |