[PATCH] D110234: [LoopFlatten] Updating Phi nodes after IV widening
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 27 07:30:05 PDT 2021
SjoerdMeijer added a comment.
@dmgreen : I propose to keep this revision. The extra bit of state for `NarrowInnerInductionPHI` and `NarrowOuterInductionPHI` is needed anyway, to checks on the phi nodes (and skip these ones). That's why e.g. just this is not enough:
diff --git a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
index 931bcc2aada6..f81eb07b5425 100644
--- a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp
@@ -711,7 +711,7 @@ static bool CanWidenIV(FlattenInfo &FI, DominatorTree *DT, LoopInfo *LI,
// If the inner Phi node cannot be trivially deleted, we need to at least
// bring it in a consistent state.
if (!Deleted)
- FI.InnerInductionPHI->removeIncomingValue(FI.InnerLoop->getLoopLatch());
+ FI.InnerPHIsToTransform.insert(FI.InnerInductionPHI);
if (!CreateWideIV({FI.OuterInductionPHI, MaxLegalType, false }, Deleted))
return false;
And I think it is clearer to keep these narrow phi separate from InnerPHIsToTransform. Let me know what you think.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110234/new/
https://reviews.llvm.org/D110234
More information about the llvm-commits
mailing list