diff options
author | Alexander Kornienko <alexfh@google.com> | 2023-09-01 11:06:48 +0200 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2023-09-01 12:53:24 +0200 |
commit | b7f4915644844fb9f32e8763922a070f5fe4fd29 (patch) | |
tree | f7d85f559e082bc939611cf0d221676bdbf365c6 /clang/lib/CodeGen/CGCall.cpp | |
parent | 1148cfac51f28438b3684976cb14cde73935ea7f (diff) | |
download | llvm-b7f4915644844fb9f32e8763922a070f5fe4fd29.zip llvm-b7f4915644844fb9f32e8763922a070f5fe4fd29.tar.gz llvm-b7f4915644844fb9f32e8763922a070f5fe4fd29.tar.bz2 |
Revert "Reapply: [IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"
This reverts commit e698695fbbf62e6676f8907665187f2d2c4d814b. The commit caused
invalid AddressSanitizer: stack-use-after-scope errors.
See https://reviews.llvm.org/D74094#4633785 for details.
Differential Revision: https://reviews.llvm.org/D159346
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index af05eec..37ccd0d 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -40,7 +40,6 @@ #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Intrinsics.h" #include "llvm/IR/Type.h" -#include "llvm/Support/TypeSize.h" #include "llvm/Transforms/Utils/Local.h" #include <optional> using namespace clang; @@ -4616,24 +4615,7 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E, return; } - AggValueSlot ArgSlot = AggValueSlot::ignored(); - if (hasAggregateEvaluationKind(E->getType())) { - Address ArgSlotAlloca = Address::invalid(); - ArgSlot = CreateAggTemp(E->getType(), "agg.tmp", &ArgSlotAlloca); - - // Emit a lifetime start/end for this temporary. If the type has a - // destructor, then we need to keep it alive. FIXME: We should still be able - // to end the lifetime after the destructor returns. - if (!E->getType().isDestructedType()) { - llvm::TypeSize size = - CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(E->getType())); - if (llvm::Value *lifetimeSize = - EmitLifetimeStart(size, ArgSlotAlloca.getPointer())) - args.addLifetimeCleanup({ArgSlotAlloca.getPointer(), lifetimeSize}); - } - } - - args.add(EmitAnyExpr(E, ArgSlot), type); + args.add(EmitAnyExprToTemp(E), type); } QualType CodeGenFunction::getVarArgType(const Expr *Arg) { @@ -5822,9 +5804,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, for (CallLifetimeEnd &LifetimeEnd : CallLifetimeEndAfterCall) LifetimeEnd.Emit(*this, /*Flags=*/{}); - for (const CallArgList::EndLifetimeInfo < : CallArgs.getLifetimeCleanups()) - EmitLifetimeEnd(LT.Size, LT.Addr); - if (!ReturnValue.isExternallyDestructed() && RetTy.isDestructedType() == QualType::DK_nontrivial_c_struct) pushDestroy(QualType::DK_nontrivial_c_struct, Ret.getAggregateAddress(), |