[PATCH] D48223: Allow binop C1, (select cc, CF, CT) -> select folding

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 16:04:37 PDT 2018


spatel added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1904
+  // Bail out if any constants are opaque because we can't constant fold those.
+  SDValue C1 = BO->getOperand(SelOpNo ^ 1);
+  if (!isConstantOrConstantVector(C1, true) &&
----------------
Nit: I'd call this 'C' or 'CBO' or 'CBinOp' since it's not always operand 1 now.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1913-1914
   EVT VT = Sel.getValueType();
+  if (SelOpNo && VT != C1.getValueType())
+    return SDValue();
+
----------------
When does this happen (is there a test)? Why does this only happen when the select is operand 1 of the binop? Better to remove the 'SelOpNo' condition to be safer?


https://reviews.llvm.org/D48223





More information about the llvm-commits mailing list