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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 11:31:27 PST 2024


topperc 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.

I don't have correctness concerns, just that we should have new tests.

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


More information about the llvm-commits mailing list