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

Mahesha S via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 22 19:03:59 PDT 2021


hsmhsm added a comment.

In D110257#3016113 <https://reviews.llvm.org/D110257#3016113>, @rnk wrote:

> In D110257#3015641 <https://reviews.llvm.org/D110257#3015641>, @hsmhsm wrote:
>
>> The logic at https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Utils/InlineFunction.cpp#L2093 assumes that static allocas (within callee) are contiguous.
>
> No, it doesn't make that assumption. That code is an attempt to optimize the linked list splicing, so that batches of contiguous allocas can be spliced over together. I believe the code would still be correct if you removed this inner loop and left behind the outer loop, which iterates over all allocas in the entry block.

Thanks, understood it now. So, the actual logic (in the outer loop) is - scan the (contiguous ) batches of static allocas within the callees entry block, and move those batches to caller as one chunk at a time.

That said, it is still good idea (and actually an explicitly not mandated requirement) to maintain the contiguity of the static allocas at the top of the basic block as one cluster, and it should start from FE itself.  So, this patch is still relevant.


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