[llvm] [LV] Support multiplies by constants when forming scaled reductions. (PR #161092)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 11:24:44 PDT 2025


fhahn wrote:

> Does this work when the multiply has `nsw`? I tried modifying `@src2` and `@tgt2` in your alive example by adding `nsw` to the `mul` and the alive seems to fail.

`@src2/@tgt2` highlight a case that is not safe, independent of `nsw` flags I think. This should not be transformed by the current patch due to trunc `(sext i8 128 to i32) to i8 != 128`

Here's versions of the generalized proofs with `nsw`: https://alive2.llvm.org/ce/z/iWRMr6 (bitwidth limited to `i4/i8` otherwise there's a timeout)

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


More information about the llvm-commits mailing list