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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 28 11:53:04 PDT 2022


reames added a comment.

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.


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