[PATCH] D35411: [SimplifyCFG] Defer folding unconditional branches to LateSimplifyCFG if it can destroy canonical loop structure.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 15:02:51 PDT 2017


efriedma added a comment.

Needs testcases for the jump threading and CGP changes.

Why do we need the empty block folding in both LateSimplifyCFG and CGP?



================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:668
 
     eliminateMostlyEmptyBlock(BB);
     MadeChange = true;
----------------
efriedma wrote:
> Do you need to update the latch set here?
While you're here, do we also need to update the Preheaders set?


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:705
+  //  the jump through the backedge, so it is profitable to merge.
+  if (DestBB->getTerminator() == DestBB->getFirstNonPHI() && isLatch)
+    return true;
----------------
Put isLatch first?


================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:243
+          !LoopHeaders.count(
+              cast<BranchInst>(BB->getTerminator())->getSuccessor(0))) {
         // FIXME: It is always conservatively correct to drop the info
----------------
`BI->getSuccessor(0)`?


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:5659
   BasicBlock *BB = BI->getParent();
+  BasicBlock *Succ = cast<BranchInst>(BB->getTerminator())->getSuccessor(0);
 
----------------
`BI->getSuccessor(0)`?


https://reviews.llvm.org/D35411





More information about the llvm-commits mailing list