[PATCH] D157276: [NFC][LoopPredication] Extract guard parsing to GuardUtils
Aleksandr Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 04:33:41 PDT 2023
aleksandr.popov added inline comments.
================
Comment at: llvm/lib/Analysis/GuardUtils.cpp:123
+ SmallPtrSet<Value *, 4> Visited;
+ Visited.insert(Condition);
+ do {
----------------
aleksandr.popov wrote:
> anna wrote:
> > You can delay adding `Condition` into `Visited` and make this entire loop as:
> > ```
> > do {
> > Value *Check = Worklist.pop_back_val();
> > if (!Visited.insert(Check).second)
> > continue;
> > Value *LHS, *RHS;
> > if (match(Check, m_And(m_Value(LHS), m_Value(RHS)))) {
> > Worklist.push_back(LHS);
> > Worklist.push_back(RHS);
> > continue;
> > }
> > if (!Callback(Check))
> > break;
> > } while (!Worklist.empty());
> > ```
> Do you mind if I do that refactoring in the next separate patch?
> I've intended just to extract logic from LoopPredication::collectChecks and move it here straightforwardly.
https://reviews.llvm.org/D157490
================
Comment at: llvm/lib/Transforms/Scalar/LoopPredication.cpp:776
+ parseWidenableGuard(Guard, Checks);
+ LLVM_DEBUG(dbgs() << "Found checks:\n");
+ std::for_each(Checks.begin(), Checks.end(), [](const Value *Check) {
----------------
aleksandr.popov wrote:
> anna wrote:
> > Pls land this and the added debug statement in the test separately (can land without review), since it is unrelated to patch.
> Ok, will do it in the separate patch, thanks!
https://reviews.llvm.org/D157490
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157276/new/
https://reviews.llvm.org/D157276
More information about the llvm-commits
mailing list