[clang][codegen] Fix another lifetime emission on alloca on non-default address space.
- Lifetime intrinsics expect the pointer directly from alloca. Need
extra handling for targets with alloca on non-default (or non-zero)
address space.
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 3edcfb2..9ef2a3b 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -3690,8 +3690,9 @@
}
AggValueSlot ArgSlot = AggValueSlot::ignored();
+ Address ArgSlotAlloca = Address::invalid();
if (hasAggregateEvaluationKind(E->getType())) {
- ArgSlot = CreateAggTemp(E->getType(), "agg.tmp");
+ 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
@@ -3699,8 +3700,9 @@
if (!E->getType().isDestructedType()) {
uint64_t size =
CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(E->getType()));
- if (auto *lifetimeSize = EmitLifetimeStart(size, ArgSlot.getPointer()))
- args.addLifetimeCleanup({ArgSlot.getPointer(), lifetimeSize});
+ if (auto *lifetimeSize =
+ EmitLifetimeStart(size, ArgSlotAlloca.getPointer()))
+ args.addLifetimeCleanup({ArgSlotAlloca.getPointer(), lifetimeSize});
}
}