[PATCH] D93665: [LoopNest] Allow empty basic blocks without loops

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 13:48:08 PST 2020


Meinersbur added a comment.

Alternatively, we could rely on SimplifyCFG to remote such empty BBs?

Would we want to allow such empty blocks between outer header and inner preheader as well?



================
Comment at: llvm/lib/Analysis/LoopNestAnalysis.cpp:214
+                                      const BasicBlock *End) {
+  assert((From != nullptr && End != nullptr) && "Expecting valid arguments");
+
----------------
I'd prefer them as separate asserts.


================
Comment at: llvm/lib/Analysis/LoopNestAnalysis.cpp:223
+
+  SmallPtrSet<const BasicBlock *, 4> Visited;
+  const BasicBlock *BB = From->getSingleSuccessor();
----------------
To clarify: the `Visited` set is used to detect an infinite loop?


================
Comment at: llvm/lib/Analysis/LoopNestAnalysis.cpp:226
+  const BasicBlock *PredBB = BB;
+  while (BB && BB != End && isEmpty(BB) && Visited.count(BB) == 0) {
+    Visited.insert(BB);
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93665/new/

https://reviews.llvm.org/D93665



More information about the llvm-commits mailing list