[llvm] r337491 - [X86] Fix some 'return SDValue()' after DCI.CombineTo instead return the output of CombineTo

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 13:10:44 PDT 2018


Author: ctopper
Date: Thu Jul 19 13:10:44 2018
New Revision: 337491

URL: http://llvm.org/viewvc/llvm-project?rev=337491&view=rev
Log:
[X86] Fix some 'return SDValue()' after DCI.CombineTo instead return the output of CombineTo

Returning SDValue() means nothing was changed. Returning the result of CombineTo returns the first argument of CombineTo. This is specially detected by DAGCombiner as meaning that something changed, but worklist management was already taken care of.

I think the only real effect of this change is that we now properly update the Statistic the counts the number of combines performed. That's the only thing between the check for null and the check for N in the DAGCombiner.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=337491&r1=337490&r2=337491&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Jul 19 13:10:44 2018
@@ -31291,8 +31291,7 @@ static SDValue combineShuffle(SDNode *N,
     if (SDValue Res = combineX86ShufflesRecursively(
             {Op}, 0, Op, {0}, {}, /*Depth*/ 1,
             /*HasVarMask*/ false, DAG, Subtarget)) {
-      DCI.CombineTo(N, Res);
-      return SDValue();
+      return DCI.CombineTo(N, Res);
     }
   }
 
@@ -33969,7 +33968,7 @@ static SDValue combineMul(SDNode *N, Sel
 
   if (NewMul)
     // Do not add new nodes to DAG combiner worklist.
-    DCI.CombineTo(N, NewMul, false);
+    return DCI.CombineTo(N, NewMul, false);
 
   return SDValue();
 }
@@ -34230,8 +34229,7 @@ static SDValue combineVectorPack(SDNode
   if (SDValue Res =
           combineX86ShufflesRecursively({Op}, 0, Op, {0}, {}, /*Depth*/ 1,
                                         /*HasVarMask*/ false, DAG, Subtarget)) {
-    DCI.CombineTo(N, Res);
-    return SDValue();
+    return DCI.CombineTo(N, Res);
   }
 
   return SDValue();
@@ -34292,8 +34290,7 @@ static SDValue combineVectorShiftImm(SDN
     if (SDValue Res = combineX86ShufflesRecursively(
             {Op}, 0, Op, {0}, {}, /*Depth*/ 1,
             /*HasVarMask*/ false, DAG, Subtarget)) {
-      DCI.CombineTo(N, Res);
-      return SDValue();
+      return DCI.CombineTo(N, Res);
     }
   }
 
@@ -34333,8 +34330,7 @@ static SDValue combineVectorInsert(SDNod
   if (SDValue Res =
           combineX86ShufflesRecursively({Op}, 0, Op, {0}, {}, /*Depth*/ 1,
                                         /*HasVarMask*/ false, DAG, Subtarget)) {
-    DCI.CombineTo(N, Res);
-    return SDValue();
+    return DCI.CombineTo(N, Res);
   }
 
   return SDValue();
@@ -34790,8 +34786,7 @@ static SDValue combineAnd(SDNode *N, Sel
     if (SDValue Res = combineX86ShufflesRecursively(
             {Op}, 0, Op, {0}, {}, /*Depth*/ 1,
             /*HasVarMask*/ false, DAG, Subtarget)) {
-      DCI.CombineTo(N, Res);
-      return SDValue();
+      return DCI.CombineTo(N, Res);
     }
   }
 
@@ -37201,8 +37196,7 @@ static SDValue combineAndnp(SDNode *N, S
     if (SDValue Res = combineX86ShufflesRecursively(
             {Op}, 0, Op, {0}, {}, /*Depth*/ 1,
             /*HasVarMask*/ false, DAG, Subtarget)) {
-      DCI.CombineTo(N, Res);
-      return SDValue();
+      return DCI.CombineTo(N, Res);
     }
   }
 




More information about the llvm-commits mailing list