[PATCH] Select Elimination in InstCombine

Joey Gouly joey.gouly at gmail.com
Tue Sep 9 02:10:23 PDT 2014


Drive-by comments.

================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2431
@@ +2430,3 @@
+//
+bool InstCombiner::dominatesAllUses(SelectInst *SI, ICmpInst &ICmp,
+                                    BasicBlock *D) {
----------------
I'm wondering if this name is too general, or if the parameter types are too strict.

================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2957
@@ +2956,3 @@
+            if (Op2)
+              if (ConstantInt *CI = dyn_cast<ConstantInt>(Op2))
+                if (CI->getValue().getBoolValue())
----------------
I think you can use dyn_cast_or_null here to combine these two if statements, to reduce indentation.

================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2965
@@ +2964,3 @@
+            if (Op1)
+              if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1))
+                if (CI->getValue().getBoolValue())
----------------
dyn_cast_or_null again.

http://reviews.llvm.org/D5258






More information about the llvm-commits mailing list