[PATCH] Select Elimination in InstCombine

David Majnemer david.majnemer at gmail.com
Wed Sep 10 20:36:00 PDT 2014


================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2459-2461
@@ +2458,5 @@
+  auto *IC = dyn_cast<ICmpInst>(BI->getCondition());
+  if (!IC || IC->getOperand(0) != SI)
+    return false;
+  return true;
+}
----------------
majnemer wrote:
> Gerolf wrote:
> > majnemer wrote:
> > > You could make this `return IC && IC->getOperand(0) == SI;`
> > > 
> > > Are we interested in doing anything if the other operand to the `ICmpInst` is the `SelectInst`?
> > No, rhs is expected to be a constant.
> Where do we check this?
Thinking about this, isChainSelectCmpBranch is very specific to this transform; I think this makes more sense as a static function instead of a member function.

http://reviews.llvm.org/D5258






More information about the llvm-commits mailing list