Revert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"
This reverts commit fafc6e4fdf3673dcf557d6c8ae0c0a4bb3184402.
Should fix ppc stage2 failure: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/23546
Conflicts:
clang/lib/CodeGen/CGCall.cpp
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index c903263..432058b 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3692,24 +3692,7 @@
return;
}
- AggValueSlot ArgSlot = AggValueSlot::ignored();
- Address ArgSlotAlloca = Address::invalid();
- if (hasAggregateEvaluationKind(E->getType())) {
- 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()) {
- uint64_t size =
- CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(E->getType()));
- if (auto *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) {
@@ -4810,9 +4793,6 @@
for (CallLifetimeEnd &LifetimeEnd : CallLifetimeEndAfterCall)
LifetimeEnd.Emit(*this, /*Flags=*/{});
- for (auto < : CallArgs.getLifetimeCleanups())
- EmitLifetimeEnd(LT.Size, LT.Addr);
-
return Ret;
}
diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index 3c574a1..28121af 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -283,11 +283,6 @@
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) {
@@ -304,9 +299,6 @@
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;
@@ -346,14 +338,6 @@
/// 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;
@@ -362,10 +346,6 @@
/// 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;
};