[llvm] [RISCV][NFCI] Use isADDLike helper for or_is_add PatFrag (PR #81137)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 11:11:54 PST 2024


asb wrote:

> Is it equivalent? Aren't there some special cases handled in isAddLIke? See `haveNoCommonBitsSetCommutative` in SelectionDAG.cpp.

Good point, I'd assumed that `SelectionDAG::haveNoCommonBitsSet` was a trivial wrapper over `KnownBits;:HaveNoCommonBitsSet`. So there may be some functional change. Are you pointing out that the NFCI tag is likely incorrect and we probably want tests for any new patterns picked up, or do you have correctness concerns? I haven't stepped through the haveNoCommonBitsSetCommutative logic, but `isADDLike` would be buggy (per its documented semantics) if the `or` couldn't freely be replaced with an `add` when it returns true.

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


More information about the llvm-commits mailing list