[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 21:54:15 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's 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.
> 
> Could you create an issue and link back to [rust-lang/rust#121673](https://github.com/rust-lang/rust/issues/121673)?

Sure, is it done like this: #84605?

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


More information about the llvm-commits mailing list