[PATCH] D79001: [ARM][MVE] Tail-predication: support nested loops with dependent iterators.
Sam Parker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 06:46:39 PDT 2020
samparker added a comment.
I'm not convinced that this is the route to take, I think we should be questioning whether it's necessary to back substitute the NumElements through MatchElemCountLoopSetup. If we don't have to do that, then I think we can use SCEV arithmetic, instead of pattern matching, to get our count:
--- a/llvm/lib/Target/ARM/MVETailPredication.cpp
+++ b/llvm/lib/Target/ARM/MVETailPredication.cpp
@@ -494,16 +494,12 @@ bool MVETailPredication::ComputeRuntimeElements(TripCountPattern &TCP) {
} else
return nullptr;
- if (auto *RoundUp = dyn_cast<SCEVAddExpr>(S->getLHS())) {
- if (auto *Const = dyn_cast<SCEVConstant>(RoundUp->getOperand(0))) {
- if (Const->getAPInt() != (VF->getValue() - 1))
- return nullptr;
- } else
- return nullptr;
-
- return RoundUp->getOperand(1);
- }
- return nullptr;
+ auto *RoundUp = S->getLHS();
+ auto VFMinusOne =
+ SE->getAddExpr(S->getRHS(),
+ SE->getNegativeSCEV(SE->getOne(S->getType())));
+ auto UndoRound = SE->getAddExpr(RoundUp, SE->getNegativeSCEV(VFMinusOne));
+ return UndoRound;
};
// TODO: Can we use SCEV helpers, such as findArrayDimensions, and friends to
@@ -534,9 +530,6 @@ bool MVETailPredication::ComputeRuntimeElements(TripCountPattern &TCP) {
SCEVExpander Expander(*SE, DL, "elements");
TCP.NumElements = Expander.expandCodeFor(Elems, Elems->getType(), InsertPt);
- if (!MatchElemCountLoopSetup(L, TCP.Shuffle, TCP.NumElements))
- return false;
-
return true;
}
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79001/new/
https://reviews.llvm.org/D79001
More information about the llvm-commits
mailing list