[PATCH] D30712: [JumpThread] Try to fold SwitchInst before attempting to jumpthread it

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 11:59:25 PST 2017


trentxintong updated this revision to Diff 90906.
trentxintong added a comment.

efriedma is right about simplifycfg converting switch(i1) to condbr. so this patch is now
a comment change =).


https://reviews.llvm.org/D30712

Files:
  lib/Transforms/Scalar/JumpThreading.cpp


Index: lib/Transforms/Scalar/JumpThreading.cpp
===================================================================
--- lib/Transforms/Scalar/JumpThreading.cpp
+++ lib/Transforms/Scalar/JumpThreading.cpp
@@ -805,7 +805,9 @@
     // If we're branching on a conditional, LVI might be able to determine
     // it's value at the branch instruction.  We only handle comparisons
     // against a constant at this time.
-    // TODO: This should be extended to handle switches as well.
+    //
+    // Switch(i1) will be converted to CondBr by SimplifyCFG and therefore
+    // handled by the CondBr folding here..
     BranchInst *CondBr = dyn_cast<BranchInst>(BB->getTerminator());
     Constant *CondConst = dyn_cast<Constant>(CondCmp->getOperand(1));
     if (CondBr && CondConst) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30712.90906.patch
Type: text/x-patch
Size: 781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170307/02396ee8/attachment.bin>


More information about the llvm-commits mailing list