[PATCH] D30342: [SimplifyCFG] Do not split blocks if breaking a loop

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 14:28:42 PDT 2017


efriedma added a comment.

Added some code review comments.

At a higher level, we should consider changing SimplifyCFG so it doesn't fight LoopSimplify over the canonical form of a loop... but just fixing the bug is fine for now.



================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:172
   AssumptionCache *AC;
-  SmallPtrSetImpl<BasicBlock *> *LoopHeaders;
+  LoopHeaderList *LoopHeaders;
   Value *isValueEqualityComparison(TerminatorInst *TI);
----------------
Do we need to do any additional work to keep this map up-to-date?  The predecessors of the loop header could get folded.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1800
+
+    if (LoopHeaders && LoopHeaders->count(BI1->getSuccessor(0))) {
+      // If we are handling a loop header and both backedges and non-backedges
----------------
BBEnd instead of BI1->getSuccessor(0)?




================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1802
+      // If we are handling a loop header and both backedges and non-backedges
+      // are hooked to the new block, this will make the loop irreduciable
+      // because the new block is not dominated by the loop header. In such
----------------
*irreducible


https://reviews.llvm.org/D30342





More information about the llvm-commits mailing list