[PATCH] D15508: [JumpThreading] Split select that has constant conditions coming from the PHI node

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 4 10:45:22 PST 2016


mssimpso added inline comments.

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1898
@@ +1897,3 @@
+///
+/// And expand the select into a branch structure and this later enables
+/// threading over bb.  Similar to SimplifyCFG::FoldCondBranchOnPHI(), unfold
----------------
Please reword the sentence beginning with "And expand..." as its confusing. I think you're saying that SimplifyCFG will perform the optimization you want if the select is unfolded?

================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1943
@@ +1942,3 @@
+    bool hasConst = false;
+    for (unsigned i = 0; i != NumPHIValues; ++i) {
+      if (PN->getIncomingBlock(i) == BB)
----------------
Adding "&& !hasConst" to the terminating condition will break the loop early if you find an incoming constant.


Repository:
  rL LLVM

http://reviews.llvm.org/D15508





More information about the llvm-commits mailing list