[PATCH] Select Elimination in InstCombine

hfinkel at anl.gov hfinkel at anl.gov
Mon Nov 10 23:28:32 PST 2014


================
Comment at: include/llvm/IR/Value.h:264
@@ +263,3 @@
+  /// block
+  ///
+  void replaceUsesOutsideBlock(Value *V, BasicBlock *ExceptionBB);
----------------
Add period after block and remove empty comment line.

The other differences from RAUW (as noted above the implementation) should also be noted here.

There is no need to name the BB argument ExceptionBB, BB is fine.

================
Comment at: lib/IR/Value.cpp:360
@@ +359,3 @@
+// This routine leaves uses within ExceptionBB.
+void Value::replaceUsesOutsideBlock(Value *New, BasicBlock *ExceptionBB) {
+  assert(New && "Value::replaceUsesOutsideBlock(<null>) is invalid!");
----------------
We don't need to use the name ExceptionBB, or refer to this as the "exception block" in the assert below.

================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2566
@@ +2565,3 @@
+    if (InstCombiner::dominatesAllUses(SI, Icmp, Succ) &&
+        Succ->getUniquePredecessor()) {
+      NumSel++;
----------------
I assume that Succ->getUniquePredecessor() is cheaper to evaluate than InstCombiner::dominatesAllUses(SI, Icmp, Succ), so I'd check that first. Also, you can drop the InstCombiner::

http://reviews.llvm.org/D5258






More information about the llvm-commits mailing list