[llvm] 7f36981 - [LV] Adjust trip count based on IsOrdered in widenPHIInstruction (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 26 05:13:52 PDT 2021
Author: Florian Hahn
Date: 2021-06-26T13:13:25+01:00
New Revision: 7f369819774d376f043200220f1a2d36d53487a2
URL: https://github.com/llvm/llvm-project/commit/7f369819774d376f043200220f1a2d36d53487a2
DIFF: https://github.com/llvm/llvm-project/commit/7f369819774d376f043200220f1a2d36d53487a2.diff
LOG: [LV] Adjust trip count based on IsOrdered in widenPHIInstruction (NFC).
Suggested in D104197, avoids the early exit.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index f28dbaac2d45..b53c14424a70 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4801,11 +4801,8 @@ void InnerLoopVectorizer::widenPHIInstruction(Instruction *PN,
bool IsOrdered = State.VF.isVector() &&
Cost->isInLoopReduction(cast<PHINode>(PN)) &&
Cost->useOrderedReductions(*RdxDesc);
-
- for (unsigned Part = 0; Part < State.UF; ++Part) {
- // This is phase one of vectorizing PHIs.
- if (Part > 0 && IsOrdered)
- return;
+ unsigned LastPartForNewPhi = IsOrdered ? 1 : State.UF;
+ for (unsigned Part = 0; Part < LastPartForNewPhi; ++Part) {
Value *EntryPart = PHINode::Create(
VecTy, 2, "vec.phi", &*LoopVectorBody->getFirstInsertionPt());
State.set(PhiR, EntryPart, Part);
More information about the llvm-commits
mailing list