[llvm] [VPlan] Don't collect live-ins in collectUsersInExitBlocks. (NFC) (PR #123819)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 13:13:19 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Florian Hahn (fhahn)
<details>
<summary>Changes</summary>
Live-ins don't need to be handled, other than adding to the exit phi recipe. Do that early and assert that otherwise the exit value is defined in the vector loop region.
This should enable simply skipping other exit values that do not need further fixing, e.g. if handling the exit value from the early exit directly in handleUncountableEarlyExit.
---
Full diff: https://github.com/llvm/llvm-project/pull/123819.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (+5-6)
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index df64bb2884ab88..68406ecdff096c 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9052,8 +9052,12 @@ collectUsersInExitBlocks(Loop *OrigLoop, VPRecipeBuilder &Builder,
}
Value *IncomingValue = ExitPhi->getIncomingValueForBlock(ExitingBB);
VPValue *V = Builder.getVPValueOrAddLiveIn(IncomingValue);
- ExitUsersToFix.insert(ExitIRI);
ExitIRI->addOperand(V);
+ if (V->isLiveIn())
+ continue;
+ assert(V->getDefiningRecipe()->getParent()->getEnclosingLoopRegion() &&
+ "Only recipes defined inside a region should need fixing.");
+ ExitUsersToFix.insert(ExitIRI);
}
}
}
@@ -9077,11 +9081,6 @@ addUsersInExitBlocks(VPlan &Plan,
// modeling the corresponding LCSSA phis.
for (VPIRInstruction *ExitIRI : ExitUsersToFix) {
for (const auto &[Idx, Op] : enumerate(ExitIRI->operands())) {
- // Pass live-in values used by exit phis directly through to their users
- // in the exit block.
- if (Op->isLiveIn())
- continue;
-
// Currently only live-ins can be used by exit values from blocks not
// exiting via the vector latch through to the middle block.
if (ExitIRI->getParent()->getSinglePredecessor() != MiddleVPBB)
``````````
</details>
https://github.com/llvm/llvm-project/pull/123819
More information about the llvm-commits
mailing list