[PATCH] D61461: When removing inalloca, convert to static alloca

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 16:55:59 PDT 2019


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:2152
+      // 2. They have dynamic size.
+      // 3. There is control flow between the alloca and the call that uses it.
+      ConstantInt *Num = dyn_cast<ConstantInt>(AI->getArraySize());
----------------
Maybe worth expanding a little on why control flow matters, based on the review discussion.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:2167
+          F->getParent()->getDataLayout().getTypeAllocSize(AI->getAllocatedType()));
+      IR.CreateLifetimeStart(AI, Size);
+      InsertLifetimeEndAfter(CS.getInstruction(), AI, Size);
----------------
Do we expect that clang will, at some point, start emitting the relevant lifetime markers itself?  It currently doesn't, as far as I can tell, but it seems like it might be useful for other reasons.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61461/new/

https://reviews.llvm.org/D61461





More information about the llvm-commits mailing list