[DagCombiner] Don't bother adding to the work list if TLI.BuildSDIVPow2 failed. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 15 Aug 2018 10:02:54 +0000 (10:02 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 15 Aug 2018 10:02:54 +0000 (10:02 +0000)
Matches the code in BuildSDIV/BuildUDIV

llvm-svn: 339757

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 12a177a343ac76775381dbf499a364ec92b1c53c..a85feff44c0586a40aae38ed0bd710f980dda549 100644 (file)
@@ -18089,11 +18089,13 @@ SDValue DAGCombiner::BuildSDIVPow2(SDNode *N) {
     return SDValue();
 
   SmallVector<SDNode *, 8> Built;
-  SDValue S = TLI.BuildSDIVPow2(N, C->getAPIntValue(), DAG, Built);
+  if (SDValue S = TLI.BuildSDIVPow2(N, C->getAPIntValue(), DAG, Built)) {
+    for (SDNode *N : Built)
+      AddToWorklist(N);
+    return S;
+  }
 
-  for (SDNode *N : Built)
-    AddToWorklist(N);
-  return S;
+  return SDValue();
 }
 
 /// Given an ISD::UDIV node expressing a divide by constant, return a DAG