[PATCH] D30774: [SimplifyCFG] Merging duplicated basic blocks
Sean Fertile via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 12:45:16 PDT 2017
sfertile added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1685
+static unsigned getNumNonDbgInstrInBB(BasicBlock *BB) {
+ unsigned count = 0;
+ for (Instruction &Instr : *BB)
----------------
Variable name should start with an uppercase letter.
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1694
+/// If it is true, merge these BBs into one BB.
+static bool MergeDuplicatedBlock(BranchInst *BI, const SmallPtrSetImpl<BasicBlock *> *LoopHeaders) {
+ assert(BI->isUnconditional());
----------------
Function name should start with a lower case letter.
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1719
+ // For the edge(s) from (potentially multiple) BB0 to BB1,
+ // we support only conditional or unconditional branch instrcutions.
+ // For the edge from BB1 to BBsucc and BB2 to BBsucc,
----------------
instrcutions --> instructions
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1744
+ // We do not optimize if multiple PHI instructions exist
+ // in the successor for ease of analysis
+ if (++II != BBSucc->end() && isa<PHINode>(II)) return false;
----------------
Missing period at the end of the comment, (most of the comments past here need a period added at the end).
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1769
+
+ // We can merge control flow if incomming values to the PHI node
+ // at the succesor are same values or both defined in the BBs to merge.
----------------
incomming --> incoming
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1801
+
+ // We replace the destination of incomming edges of BBToErase by BBToRetain
+ SmallVector<BasicBlock *, 8> BBToUpdate(predecessors(BBToErase));
----------------
incomming --> incoming
================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1815
+
+ // Now we can remove the BB, which has no incomming edge
+ DeleteDeadBlock(BBToErase);
----------------
incomming --> incoming
https://reviews.llvm.org/D30774
More information about the llvm-commits
mailing list