[PATCH] D49954: [InstCombine] Fold Select with binary op

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 11:11:41 PDT 2018


xbolva00 added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:79
+  if (BO && match(BO, m_c_BinOp(m_Specific(X), m_Value(Z))) &&
+      ConstantExpr::getBinOpIdentity(BO->getOpcode(), X->getType()) == C) {
+    Sel.setOperand(IsEq ? 1 : 2, Z);
----------------
lebedev.ri wrote:
> I suspect the cases with `undef` do not fold only because of this.
> I can't tell if it is intentional or not, but i'd make it more explicit, at least with a comment.
Yes, a helper method would be needed to extend it and allow undefs.
Added a comment to test file.


https://reviews.llvm.org/D49954





More information about the llvm-commits mailing list