[llvm-branch-commits] [llvm] [AMDGPU] Allocate and reserve registers for address space 13 objects (PR #214248)

Carl Ritson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 9 02:06:42 PST 2026


================
@@ -412,6 +467,17 @@ bool AMDGPUPromoteAllocaImpl::run(Function &F, bool PromoteToLDS) {
   bool Changed = false;
   SetVector<IntrinsicInst *> DeferredIntrs;
   for (AllocaAnalysis &AA : Allocas) {
+    if (AA.Alloca->getAddressSpace() == AMDGPUAS::VGPR) {
+      allocateVgprs(AA);
+      std::optional<TypeSize> Size = AA.Alloca->getAllocationSize(DL);
+      assert(Size); // Expected to succeed on non-array alloca.
+      const unsigned AllocaCost = Size->getFixedValue() * 8;
+      // These registers are no longer available for vectorization.
+      VectorizationBudget -= std::min(VectorizationBudget, AllocaCost);
----------------
perlfu wrote:

`VectorizationBudget` is `unsigned` so this may have unintended consequences.

https://github.com/llvm/llvm-project/pull/214248


More information about the llvm-branch-commits mailing list