[PATCH] D110257: [CFE][Codegen] Do not break the contiguity of static allocas.

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 22 09:10:54 PDT 2021


arsenm added a comment.

I do think it's cleaner/more canonical IR to cluster these at the top of the block, but I don't understand this comment:

> otherwise, inliner's attempt to move static allocas from callee to caller will fail,

The inliner successfully moves allocas to the caller's entry block, even with addrspacecasts interspersed.



================
Comment at: clang/lib/CodeGen/CGExpr.cpp:102-106
+      auto *EBB = AllocaInsertPt->getParent();
+      auto Iter = AllocaInsertPt->getIterator();
+      if (Iter != EBB->end())
+        ++Iter;
+      Builder.SetInsertPoint(EBB, Iter);
----------------
Where are the addrspacecasts inserted? Could you just adjust where those are inserted instead?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110257



More information about the cfe-commits mailing list