[llvm] [InstCombine] Split div/rem by a select of constants with a variable dividend (PR #216908)

Adam Scott via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 00:44:15 PDT 2026


as4230 wrote:

> Looks like this optimization could also be applied to fdiv under fastmath?

yes fdiv looks like the same shape so we can fold that too. 

> Perhaps we can implement the transformation in VectorCombine (for both scalar and vector cases) after it lands.

I will try moving this to VectorCombine. I think vectorizing with this would be faster because it would use vpmulhuw/vpsrlw instead of vcvtdq2ps/vdivps which is what would hit once the cost model is updated.

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


More information about the llvm-commits mailing list