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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 11:05:04 PDT 2018


lebedev.ri 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);
----------------
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.


https://reviews.llvm.org/D49954





More information about the llvm-commits mailing list