[llvm] [LV] Create in-loop sub reductions (PR #147026)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 02:00:53 PDT 2025
================
@@ -22344,6 +22344,7 @@ class HorizontalReduction {
return Builder.CreateBinOp((Instruction::BinaryOps)RdxOpcode, LHS, RHS,
Name);
}
+ case RecurKind::Sub:
----------------
sdesmalen-arm wrote:
I'm not so sure this is the right approach, because it suggests that Sub is somehow supported, which it isn't (yet).
My suggestion would be to do the following:
* if a switch-statement has no `default` case, then we should add a `llvm_unreachable` to make it clear that `RecurKind::Sub` is unexpected and unsupported.
* if the switch-statement has a `default` case with an `llvm_unreachable` to catch unimplemented RecurKind's, then strictly speaking no action is required, although a specific `llvm_unreachable` might still be helpful.
>From looking at the SLPVectorizer code, it never tries to match a `RecurKind::Sub` so in other places it should never encounter one either, and so a `llvm_unreachable` would be fine.
https://github.com/llvm/llvm-project/pull/147026
More information about the llvm-commits
mailing list