aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp23
-rw-r--r--clang/lib/CodeGen/CGCall.h20
2 files changed, 1 insertions, 42 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 &LT : 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(),
diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index cc0b1da..aee86a3 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -278,11 +278,6 @@ public:
llvm::Instruction *IsActiveIP;
};
- struct EndLifetimeInfo {
- llvm::Value *Addr;
- llvm::Value *Size;
- };
-
void add(RValue rvalue, QualType type) { push_back(CallArg(rvalue, type)); }
void addUncopiedAggregate(LValue LV, QualType type) {
@@ -299,9 +294,6 @@ public:
CleanupsToDeactivate.insert(CleanupsToDeactivate.end(),
other.CleanupsToDeactivate.begin(),
other.CleanupsToDeactivate.end());
- LifetimeCleanups.insert(LifetimeCleanups.end(),
- other.LifetimeCleanups.begin(),
- other.LifetimeCleanups.end());
assert(!(StackBase && other.StackBase) && "can't merge stackbases");
if (!StackBase)
StackBase = other.StackBase;
@@ -341,14 +333,6 @@ public:
/// memory.
bool isUsingInAlloca() const { return StackBase; }
- void addLifetimeCleanup(EndLifetimeInfo Info) {
- LifetimeCleanups.push_back(Info);
- }
-
- ArrayRef<EndLifetimeInfo> getLifetimeCleanups() const {
- return LifetimeCleanups;
- }
-
private:
SmallVector<Writeback, 1> Writebacks;
@@ -357,10 +341,6 @@ private:
/// occurs.
SmallVector<CallArgCleanup, 1> CleanupsToDeactivate;
- /// Lifetime information needed to call llvm.lifetime.end for any temporary
- /// argument allocas.
- SmallVector<EndLifetimeInfo, 2> LifetimeCleanups;
-
/// The stacksave call. It dominates all of the argument evaluation.
llvm::CallInst *StackBase = nullptr;
};