[RISC-V] ADDI/ORI/XORI x, 0 should be as cheap as a move
The isTriviallyRematerializable hook is only called for instructions that are tagged as isAsCheapAsAMove. Since ADDI 0 is used for "mv" it should definitely be marked with "isAsCheapAsAMove". This change avoids one stack spill in most of the atomic-rmw.ll tests functions. It also avoids stack spills in two of our out-of-tree CHERI tests. ORI/XORI with zero may or may not be the same as a move micro-architecturally, but since we are already doing it for register == x0, we might as well do the same if the immediate is zero. Reviewed By: luismarques Differential Revision: https://reviews.llvm.org/D86480
Loading
Please sign in to comment