[PATCH] D22143: [SimplifyCFG] Rewrite SinkThenElseCodeToEnd

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 13:56:33 PDT 2016


hans added a comment.

Looks good as far as I can tell. It would be good to hear if Sanjoy's happy with it too though, since he started reviewing it.


================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1388
@@ +1387,3 @@
+  // common PHI instruction in the successor.
+  if (!llvm::all_of(Insts, [](const Instruction *I) {
+        // These instructions may change or break semantics if moved.
----------------
I know I'm oldfashioned, but I'd find this easier to read as a simple loop over Insts rather than all_of :-)

Since we want to return false for the cases below, we might as well do that directly rather than returning false in the lambda and then checking that return value.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:1408
@@ +1407,3 @@
+        return I->isSameOperationAs(I0);
+      }))
+    return false;
----------------
I think this would be easier to read as a for-loop too.


Repository:
  rL LLVM

https://reviews.llvm.org/D22143





More information about the llvm-commits mailing list