================
@@ -446,6 +512,96 @@ bool AMDGPUPromoteAllocaImpl::run(Function &F, bool
PromoteToLDS) {
return Changed;
}
+// Give an alloca in the VGPR ("as memory") address space a place there,
+// recorded as !amdgpu.allocated.vgprs, plus lifetime markers the backend
+// understands. AMDGPUPrivateObjectVGPRs turns those into defs and uses of the
+// physical registers, which keeps register allocation off them.
+void AMDGPUPromoteAllocaImpl::allocateVgprs(AllocaAnalysis &AA) {
+ LLVMContext &Ctx = Mod.getContext();
+ const unsigned AllocaSize =
+ DL.getTypeAllocSize(AA.Alloca->getAllocatedType()).getFixedValue();
+
+ // The generic lifetime intrinsics do not survive into the backend, so use
+ // the address-space specific ones. An object with no start is live from its
+ // definition.
+ //
+ // An already-converted marker counts as a start: this runs over IR it has
+ // converted before, and a second start would move the live range back to
+ // the alloca and keep the object live from there.
+ bool HaveLifetimeStart = false;
+ for (Use &U : AA.Alloca->uses()) {
+ auto *II = dyn_cast<IntrinsicInst>(U.getUser());
+ if (!II)
+ continue;
+ switch (II->getIntrinsicID()) {
+ case Intrinsic::lifetime_start:
+ II->setCalledFunction(Intrinsic::getOrInsertDeclaration(
----------------
perlfu wrote:
Does rewriting these potential effect analysis in proceeding passes?
https://github.com/llvm/llvm-project/pull/214248
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits