================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to