InstCombine: Respect recursion depth in visitUDivOperand
authorDavid Majnemer <david.majnemer@gmail.com>
Sat, 30 Aug 2014 09:19:05 +0000 (09:19 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sat, 30 Aug 2014 09:19:05 +0000 (09:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216817 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

index e7b8ed71486d16b1fc64a2933a50c61f6267a168..3f86ddfd104e01a1e505eeb170ab4fa4a90c7ab7 100644 (file)
@@ -936,10 +936,10 @@ static size_t visitUDivOperand(Value *Op0, Value *Op1, const BinaryOperator &I,
     return 0;
 
   if (SelectInst *SI = dyn_cast<SelectInst>(Op1))
-    if (size_t LHSIdx = visitUDivOperand(Op0, SI->getOperand(1), I, Actions))
-      if (visitUDivOperand(Op0, SI->getOperand(2), I, Actions)) {
-        Actions.push_back(UDivFoldAction((FoldUDivOperandCb)nullptr, Op1,
-                                         LHSIdx-1));
+    if (size_t LHSIdx =
+            visitUDivOperand(Op0, SI->getOperand(1), I, Actions, Depth))
+      if (visitUDivOperand(Op0, SI->getOperand(2), I, Actions, Depth)) {
+        Actions.push_back(UDivFoldAction(nullptr, Op1, LHSIdx - 1));
         return Actions.size();
       }