[PATCH] D79492: [RISCV] Improve constant materialization
Sam Elliott via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 12 03:43:32 PDT 2020
lenary added a comment.
Alex's concerns about the retry-based algorithm seem reasonable to me, but I have been advocating the approach of "this is an improvement, we can make more improvements later", so I think I still err towards landing this patch.
When it comes to improving the implementation approach here, it would be good to ensure that the overhead of `getIntMatCost` is also reduced, given it has an inefficient implementation based on materialising and then counting, rather than anything else.
================
Comment at: llvm/test/CodeGen/RISCV/add-before-shl.ll:42-44
+; RV64I-NEXT: lui a1, 4095
+; RV64I-NEXT: slli a1, a1, 36
+; RV64I-NEXT: add a0, a0, a1
----------------
These have been changed from `(shift_left (add X, C) C)` to `(add (shift_left X, C), C)`.
This isn't an issue per-se, as the sequences are still the same number of instructions - it's likely due to slight changes in the results of `getIntMatCost` for these examples, and potentially it means we need to change these test cases to maintain coverage of the shift/add hook (which we can do in a follow-up commit).
Having checked the compression (something I know the cost model does not do), it seems the new code does not compress as well as the old code (the `lui a0, 4095` is beyond its capabilities). Again, I think this is something to address in a follow-up commit.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79492/new/
https://reviews.llvm.org/D79492
More information about the llvm-commits
mailing list