[llvm] [DAG] fold avgu(zext(x), zext(y)) -> zext(avgu(x, y)) (PR #95134)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 05:30:24 PDT 2024


dtcxzyw wrote:

> > > > Any plans to do avgs(sext(x), sext(y)) -> sext(avgs(x, y)) ?
> > > 
> > > 
> > > IIRC the constraints on that pattern aren't as easy as the unsigned cases.
> > 
> > 
> > Really? My instinct is that it should Just Work, but I have not thought about it deeply.
> 
> I'm miss-remembering - it looks like it just needs an explicit freeze in the alive test where the unsigned cases didn't https://alive2.llvm.org/ce/z/qgp7bF

I don't think we need freeze here because this fold doesn't introduce multiple uses as `xor + or` does. BTW, we already gave up on correct undef semantics in https://github.com/llvm/llvm-project/pull/90097.




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


More information about the llvm-commits mailing list