[llvm] KnownBits: refine high-bits of mul in signed case (PR #113051)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 03:03:55 PDT 2024


artagnon wrote:

> > > > For future work: I suspect that what you have implemented here is not quite optimal for the high bits. We could fix that and extend #113316 to check optimality of high bits as well as low bits.
> > > 
> > > 
> > > I also suspect that it's not optimal for high bits: I think we need some logic similar to the low-bits logic later in the function.
> > 
> > 
> > Quick remark: I think this is sub-optimal due to the mul_ov overflowing in many cases.
> 
> Yeah, I have thought about this a bit more. I suspect that making high bits optimal in all cases is just as hard as making "middle" bits optimal. So we might have to give up on that goal.

I have a question. Can we simply mul_ov with twice the bitwidth to get the optimal result?

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


More information about the llvm-commits mailing list