[PATCH] D46182: [RISCV] Set isReMaterializable on ADDI and LUI instructions

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 13:45:40 PDT 2018


asb added a comment.

In https://reviews.llvm.org/D46182#1081575, @mgrang wrote:

> Sorry for not being clear enough. This patch alone gives us 44 bytes. Internally, I had tried a patch which just marks ALU insts as isReMat and that gave us 226 bytes. But combining the two patches still gives us only 44 bytes.
>
> So I digged a bit more and it seems the degradation in code size comes from marking LUI as isReMaterializable. This results in repeated load zero for our workload:
>
>   lui x10, 0
>
>
> So in your patch if I simply remove LUI isReMat (and keep ADDI isReMat) then I get 226 bytes (without my ALU patch).


Thanks for the datapoint. I'm not surprised there's no big code size win. I'm mostly seeing minor codegen changes, and where those changes are noticeable the win is in reducing stack size.

The use of LUI to zero a register is curious. I'll play around with those patch variants and see if I can replicate something similar. If there's a representative example that would be interesting, but I know from playing around with this series of patches that tweak codegen that it can be _really_ difficult to pull out a minimal example.


Repository:
  rL LLVM

https://reviews.llvm.org/D46182





More information about the llvm-commits mailing list