[llvm] [LV] Support multiplies by constants when forming scaled reductions. (PR #161092)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 2 01:32:46 PDT 2025
================
@@ -7937,6 +7937,13 @@ bool VPRecipeBuilder::getScaledReductions(
auto CollectExtInfo = [this, &Exts, &ExtOpTypes,
&ExtKinds](SmallVectorImpl<Value *> &Ops) -> bool {
for (const auto &[I, OpI] : enumerate(Ops)) {
+ auto *CI = dyn_cast<ConstantInt>(OpI);
+ if (I > 0 && CI &&
+ canConstantBeExtended(CI, ExtOpTypes[0], ExtKinds[0])) {
+ ExtOpTypes[I] = ExtOpTypes[0];
+ ExtKinds[I] = ExtKinds[0];
+ continue;
+ }
----------------
fhahn wrote:
I think there are still cases that are covered by the TODO, e.g. we one operand could be a SExt/ZExt outside the loop, which we could support by materializing a new SExt/ZExt in the plan, although that is probably not that easy to do with the current structure.
Another case would be non-constant live-ins where we know that only the lowest 7/6 bits are set (depending on the type of extend)
https://github.com/llvm/llvm-project/pull/161092
More information about the llvm-commits
mailing list