[PATCH] D126576: [RISCV] Add custom isel for (add X, imm) used by load/stores.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 28 13:22:02 PDT 2022


craig.topper added a comment.

In D126576#3544140 <https://reviews.llvm.org/D126576#3544140>, @reames wrote:

> Just a thought on an alternate approach.  Feel free to ignore.
>
> Given:
> addi a2, a2, Low12C
> add a2, a0, a2
>
> Is there any reason we shouldn't canonicalize toward:
> add a2, a0, a2
> addi a2, a2, Low12C
>
> That is, try to push the add with immediate towards the users?  (Assume a one use restriction on the original addi.)
>
> This isn't an optimization per se, but if we could treat it as a canonicalization, I think it simplifies the address matching problem significantly.

Where do you propose to canonicalize it? Another peephole between isel and doPeepholeLoadStoreADDI?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126576



More information about the llvm-commits mailing list