[llvm] [LV] Only fold outer extend into narrow mul if it cannot wrap. (PR #229230)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 03:58:24 PDT 2026
fhahn wrote:
> Somewhat related to this change, I recall that for in-order reductions the code checks the case of `zext(mul(sext(A), sext(A))` and makes assumptions that the result from the `mul` can never be negative, and so the outer extend can safely be moved into the inner extend. But without nsw/nuw flags, that doesn't seem correct either, see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp#L3943
>
> https://godbolt.org/z/xafb11YEc https://alive2.llvm.org/ce/z/m-Bzac
Yep for in-loop reductions, there are more problems. I was planning on fixing them re-using the helper added here (0b861d66020ce6094d26a1fc39a869d8fd93456b)
https://github.com/llvm/llvm-project/pull/229230
More information about the llvm-commits
mailing list