[PATCH] D92200: Ensure SplitEdge to return the new block between the two given blocks

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 18:00:49 PST 2020


Meinersbur added a comment.

Is your goal related to what https://github.com/llvm/llvm-project/blob/a8a43b63388f4d348eaa1f1017d6ab3be89b4945/polly/lib/CodeGen/Utils.cpp#L31 does?



================
Comment at: llvm/include/llvm/IR/BasicBlock.h:421
+  }
+  /// Split the basic block into two basic blocks at the specified instruction
+  /// and insert the new basic blocks as the predecessor of the current block.
----------------
Add an empty line here


================
Comment at: llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp:87
+
+  auto *F = M->getFunction("foo");
+  DominatorTree DT(*F);
----------------
Use concrete type `Function *`


================
Comment at: llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp:103
+  bool BBFlag = false;
+  for (Function::iterator b = F->begin(), be = F->end(); b != be; ++b) {
+    if (b->getName() == NewBB->getName()) {
----------------
Use a range-based for-loop: `for (BasicBlock &BB : *F)` (or `llvm::any_of`).

Applies to occurances below as well


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92200



More information about the llvm-commits mailing list