[llvm] [CVP]: Fold `icmp eq X, C` to `trunc X to i1` if C=2k+1 and X in [2k, 2k+1] (PR #83829)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 11:48:58 PST 2024
YanWQ-monad wrote:
> @YanWQ-monad Looking at your [godbolt](https://godbolt.org/z/xMTbP94Yn), doesn't that still have the useless `and` with 1 on ARM?
Yes, it seems that ARM backend generates an `and` instruction for `trunc`, while RISC-V doesn't.
Putting that aside, the canonicalization of `trunc`, which dtcxzyw pointed out, makes this optimization actually useless (https://godbolt.org/z/f5drrv556). So I am going to close this PR and re-implement this optimization on backend.
https://github.com/llvm/llvm-project/pull/83829
More information about the llvm-commits
mailing list