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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 05:10:02 PDT 2024


jayfoad wrote:

> > Right. I _think_ I can work on a follow-up doing the mul_ov with twice the bitwidth, and make the high bits exhaustive. Will investigate after this patch lands.
> 
> I thought about it some more, and have come to the same conclusion as you: making high bits optimal is as hard as making the entire mul optimal.

Right. To explain my thinking, it is easy to make the high bits optimal for a (signed or unsigned) _extending_ multiply where the result is twice the width of the inputs, just based on the range of the inputs. But the high bits of a normal (non-extending) multiply come from somewhere in the middle of an extending multiply's result.

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


More information about the llvm-commits mailing list