]> granicus.if.org Git - llvm/commitdiff
Merged nested ifs. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 19 Oct 2016 17:30:24 +0000 (17:30 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 19 Oct 2016 17:30:24 +0000 (17:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284616 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 6fb4c9a8365d8e2ec65413b04df8d295189cc83b..604e2313263df504e9986dd0964701f64b3643d1 100644 (file)
@@ -4678,13 +4678,12 @@ SDValue DAGCombiner::visitSHL(SDNode *N) {
   }
 
   // fold (shl (mul x, c1), c2) -> (mul x, c1 << c2)
-  if (N0.getOpcode() == ISD::MUL && N0.getNode()->hasOneUse()) {
-    if (isConstantOrConstantVector(N1, /* No Opaques */ true) &&
-        isConstantOrConstantVector(N0.getOperand(1), /* No Opaques */ true)) {
-      SDValue Shl = DAG.getNode(ISD::SHL, SDLoc(N1), VT, N0.getOperand(1), N1);
-      AddToWorklist(Shl.getNode());
-      return DAG.getNode(ISD::MUL, SDLoc(N), VT, N0.getOperand(0), Shl);
-    }
+  if (N0.getOpcode() == ISD::MUL && N0.getNode()->hasOneUse() &&
+      isConstantOrConstantVector(N1, /* No Opaques */ true) &&
+      isConstantOrConstantVector(N0.getOperand(1), /* No Opaques */ true)) {
+    SDValue Shl = DAG.getNode(ISD::SHL, SDLoc(N1), VT, N0.getOperand(1), N1);
+    AddToWorklist(Shl.getNode());
+    return DAG.getNode(ISD::MUL, SDLoc(N), VT, N0.getOperand(0), Shl);
   }
 
   if (N1C && !N1C->isOpaque())