[llvm] [LoopVectorize] Vectorize select-cmp reduction pattern for increasing integer induction variable (PR #67812)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 01:51:06 PDT 2024


================
@@ -900,6 +991,11 @@ bool RecurrenceDescriptor::isReductionPHI(PHINode *Phi, Loop *TheLoop,
                       << *Phi << "\n");
     return true;
   }
+  if (AddReductionVar(Phi, RecurKind::IFindLastIV, TheLoop, FMF, RedDes, DB, AC,
+                      DT, SE)) {
+    LLVM_DEBUG(dbgs() << "Found a FindLastIV reduction PHI." << *Phi << "\n");
----------------
Mel-Chen wrote:

9a0bf28b07b38dd8d3c934fa6fe1229c9306f188
Sure, I agree that explicitly indicating IFindLast or FFindLast is better. 
The new modification directly determines whether to print IFindLast or FFindLast based on the final result. This way, there is no need to call `AddReductionVar` twice, and the correct result can be indicated. 
If you feel that detecting IFindLast and FFindLast separately would be clearer, please let me know.

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


More information about the llvm-commits mailing list