[PATCH] D33942: [Polly] [ScopInfo] Do not use ScopStmt in Domain derivation of ScopInfo. NFC

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 05:12:01 PDT 2017


Meinersbur added a comment.

Could you make use of `getFirstNonBoxedLoopFor`? Then it LGTM.



================
Comment at: lib/Analysis/ScopInfo.cpp:2810
   }
-
   return true;
----------------
Please try to avoid unrelated and unnecessary changes.


================
Comment at: lib/Analysis/ScopInfo.cpp:2867-2870
+  auto *ExitBBLoop = LI.getLoopFor(ExitBB);
+  auto &BoxedLoops = getBoxedLoops();
+  while (BoxedLoops.count(ExitBBLoop))
+    ExitBBLoop = ExitBBLoop->getParentLoop();
----------------
Could you extract this into its own function?

We once had the following code in ScopHelper.cpp, you could revive them:
```
llvm::Loop *polly::getFirstNonBoxedLoopFor(llvm::Loop *L, llvm::LoopInfo &LI,
                                           const BoxedLoopsSetTy &BoxedLoops) {
  while (BoxedLoops.count(L))
    L = L->getParentLoop();
  return L;
}

llvm::Loop *polly::getFirstNonBoxedLoopFor(llvm::BasicBlock *BB,
                                           llvm::LoopInfo &LI,
                                           const BoxedLoopsSetTy &BoxedLoops) {
  Loop *L = LI.getLoopFor(BB);
  return getFirstNonBoxedLoopFor(L, LI, BoxedLoops);
}
```

Please don't forget to also the change the other place where `getFirstNonBoxedLoopFor` could be used.


https://reviews.llvm.org/D33942





More information about the llvm-commits mailing list