[PATCH] D133896: [AArch64][SME] Add codegen pass to handle ZA state in arm_new_za functions.

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 21 04:00:29 PDT 2022


aemerson added a comment.

In D133896#3805074 <https://reviews.llvm.org/D133896#3805074>, @david-arm wrote:

> In D133896#3802726 <https://reviews.llvm.org/D133896#3802726>, @aemerson wrote:
>
>> Using an IR pass to implement ABI doesn't seem right to me. This could be done at codegen time, and having it at the IR level places implicit constraints on later IR passes that aren't enforced.
>>
>> Even the IR pass was the right choice, I don't see anything here that necessitates a Module pass instead of the usual FunctionPass.
>
> Hi @aemerson, I think the reasons why we chose to do this in IR are:
>
> 1. Partly due to legacy reasons, since for an earlier version of the ABI it made sense to implement aspects of the ABI in an IR pass. However, I guess there is now a less compelling reason to do so.
> 2. I think it's probably neater to do this in IR since we can do both the function prologue and epilogue at the same time, otherwise in codegen I imagine we have to do it separately in different lowering functions? In an IR pass we can deal with all aspects of the attributes at the same time in the same function. IIRC it's easier to create/split blocks in IR too?
>
> I can look into how much effort it would take to implement this in codegen, however I'm not sure what you mean by `having it at the IR level places implicit constraints on later IR passes that aren't enforced`? It's worth saying that we will need an SME ABI IR pass like when it comes to exception handling because that's too complicated to do at the codegen level.

My concern was that by decorating the IR for ABI reasons we also rely on any future IR passes to not accidentally break it by placing instructions in the wrong place. Having said that, I suppose you technically have the same issue if you do it in a MachineFunction pass.

So in that respect my objection to an IR pass is gone, but I think this should be moved as late as possible in the pipeline before codegen runs. The current place it runs seems to be before a bunch of other passes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133896



More information about the llvm-commits mailing list