[PATCH] D22779: Clone block with icmp+branch if it likely results in further jump threading

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 08:19:34 PDT 2016


mcrosier added inline comments.

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:894
@@ +893,3 @@
+        continue;
+      BranchInst *SuccBranch = dyn_cast<BranchInst>(Succ->getTerminator());
+      if (!SuccBranch->isConditional())
----------------
This should be a cast, rather than a dyn_cast.

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:899
@@ +898,3 @@
+      if (!isa<Instruction>(Cond) ||
+          dyn_cast<Instruction>(Cond)->getParent() == Succ ||
+          dyn_cast<Instruction>(Cond)->getParent() == BB)
----------------
dyn_cast -> cast.

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:900
@@ +899,3 @@
+          dyn_cast<Instruction>(Cond)->getParent() == Succ ||
+          dyn_cast<Instruction>(Cond)->getParent() == BB)
+        continue;
----------------
dyn_cast -> cast.

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1304
@@ -1273,7 +1303,3 @@
 
-/// ProcessBranchOnPHI - We have an otherwise unthreadable conditional branch on
-/// a PHI node in the current block.  See if there are any simplifications we
-/// can do based on inputs to the phi node.
-///
-bool JumpThreadingPass::ProcessBranchOnPHI(PHINode *PN) {
-  BasicBlock *BB = PN->getParent();
+/// If any of the predecessors of BB ends with an unconditional branch,
+/// see if we can duplicate BB into its predecessors. BB is duplicated into
----------------
ends -> end

================
Comment at: test/Transforms/JumpThreading/basic.ll:181
@@ +180,3 @@
+;; condition is known at a predecessor.
+
+
----------------
Please remove the extra whitespace.


https://reviews.llvm.org/D22779





More information about the llvm-commits mailing list