[PATCH] D108971: [AMDGPU] Split entry basic block after alloca instructions.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 10:48:51 PDT 2021


arsenm added a comment.

In D108971#2976989 <https://reviews.llvm.org/D108971#2976989>, @JonChesterfield wrote:

>> Only such possibility for breaking is - there is a call to non-kernel function foo() before alloca, and foo() uses LDS. But, the assumption here is that usually won't happen, because allocas are usually put at the beggining of the entry block.
>
> I've seen alloca in blocks other than the entry block after inlining. I think I've seen a function call followed by an alloca as well. I can't think of a reason why that would be invalid IR, and I think it would be possible to set up a series of passes that create it. Could you add a (handwritten) test case with the pattern that is miscompiled?
>
> In such a case we could move the alloca to the start of the basic block. We might actually want to move alloca to the (start of the) entry block in general for amdgpu as (I think, it's been a few months) we can only lower them in the entry block.

This needs to work correctly. Alloca can legally be placed anywhere


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108971



More information about the llvm-commits mailing list