[llvm] [AMDGPU] Replace getAllocatedType with getAllocationSize in PromoteAlloca (PR #179523)

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 4 10:09:16 PST 2026


================
@@ -421,8 +421,10 @@ bool AMDGPUPromoteAllocaImpl::run(Function &F, bool PromoteToLDS) {
   SetVector<IntrinsicInst *> DeferredIntrs;
   for (AllocaAnalysis &AA : Allocas) {
     if (AA.Vector.Ty) {
-      const unsigned AllocaCost =
-          DL->getTypeSizeInBits(AA.Alloca->getAllocatedType());
+      std::optional<TypeSize> Size = AA.Alloca->getAllocationSize(*DL);
+      if (!Size)
+        continue; // Skip dynamic allocas
----------------
vtjnash wrote:

Did you want me to make this an assert right now, or leave it as a conservatively correctly duplicate check?

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


More information about the llvm-commits mailing list