Simplify some code now that the RHS of a rem can't be 0
authorChris Lattner <sabre@nondot.org>
Tue, 28 Feb 2006 05:40:55 +0000 (05:40 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 28 Feb 2006 05:40:55 +0000 (05:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26413 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 80444028d2e3877c1b4507acef4fa3cd712d2cf0..3caa4cf10e9ffc74cce5ececafd545dcb80b404d 100644 (file)
@@ -1867,14 +1867,12 @@ Instruction *InstCombiner::visitRem(BinaryOperator &I) {
       if (isPowerOf2_64(C->getValue()))
         return BinaryOperator::createAnd(Op0, SubOne(C));
 
-    if (!RHS->isNullValue()) {
-      if (SelectInst *SI = dyn_cast<SelectInst>(Op0))
-        if (Instruction *R = FoldOpIntoSelect(I, SI, this))
-          return R;
-      if (isa<PHINode>(Op0))
-        if (Instruction *NV = FoldOpIntoPhi(I))
-          return NV;
-    }
+    if (SelectInst *SI = dyn_cast<SelectInst>(Op0))
+      if (Instruction *R = FoldOpIntoSelect(I, SI, this))
+        return R;
+    if (isa<PHINode>(Op0))
+      if (Instruction *NV = FoldOpIntoPhi(I))
+        return NV;
   }
 
   if (Instruction *RHSI = dyn_cast<Instruction>(I.getOperand(1))) {