[clang] [libcxx] [flang] [mlir] [clang-tools-extra] [llvm] [LV] Improve AnyOf reduction codegen. (PR #78304)

Florian Hahn via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 5 06:29:40 PST 2024


================
@@ -9142,7 +9178,9 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
     // then extend the loop exit value to enable InstCombine to evaluate the
     // entire expression in the smaller type.
     Type *PhiTy = PhiR->getStartValue()->getLiveInIRValue()->getType();
-    if (MinVF.isVector() && PhiTy != RdxDesc.getRecurrenceType()) {
+    if (MinVF.isVector() && PhiTy != RdxDesc.getRecurrenceType() &&
+        !RecurrenceDescriptor::isAnyOfRecurrenceKind(
+            RdxDesc.getRecurrenceKind())) {
----------------
fhahn wrote:

We only reach this path now because we adjust PhiR's start value to a bool. It requires more than plain truncates as below, so I think it's probably worth to keep it separate. I *think* it also needs handling before introducing selects for tail-folding; otherwise those selects would also need updating.

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


More information about the cfe-commits mailing list