[PATCH] D23764: Remove MVT:i1 xor instruction before SELECT. (Performance improvement).

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 28 02:01:54 PDT 2016


hfinkel added inline comments.

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5244
@@ +5243,3 @@
+  if (VT0 == MVT::i1) {
+    if (N0->getOpcode() == ISD::XOR && N0->hasOneUse()) {
+      if(auto *C = dyn_cast<ConstantSDNode>(N0->getOperand(1))) {
----------------
It seems like this will be generally profitable regardless of how many uses N0 has (because it will break the dependence on the xor result, plus handles the case where several selects depend on the same condition).

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5245
@@ +5244,3 @@
+    if (N0->getOpcode() == ISD::XOR && N0->hasOneUse()) {
+      if(auto *C = dyn_cast<ConstantSDNode>(N0->getOperand(1))) {
+        SDValue Cond0 = N0->getOperand(0);
----------------
Add space after if.

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5247
@@ +5246,3 @@
+        SDValue Cond0 = N0->getOperand(0);
+        if (C->getAPIntValue() == 1) 
+          return DAG.getNode(ISD::SELECT, SDLoc(N), N1.getValueType(), 
----------------
C->isOne()


https://reviews.llvm.org/D23764





More information about the llvm-commits mailing list