[llvm] Support replacing `add rd, Zero, Zero` with `c.li rd, 0` (PR #86937)

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 08:20:21 PDT 2024


jrtc27 wrote:

> Why should add rd, Zero, Zero be special? If we support this, shouldn't we do it for And, Or, Xor, Sll, Srl, Sra that all produce 0 with x0, x0 arguments?
> 
> Given the number of cases, I don't think we should do this.

For what it’s worth, I second this opinion. The line has to be drawn *somewhere*, and adding zero to zero is not a sensible instruction to write in the first place IMO.

https://github.com/llvm/llvm-project/pull/86937


More information about the llvm-commits mailing list