don't bother handling non-canonical icmp's
authorChris Lattner <sabre@nondot.org>
Mon, 13 Dec 2010 04:18:32 +0000 (04:18 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 13 Dec 2010 04:18:32 +0000 (04:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121676 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/SimplifyCFG.cpp

index d3181b138a77e88f326da8afa56753a286312c25..a1e7486ba50356c6460475a515f4613d59c6ed5b 100644 (file)
@@ -306,11 +306,10 @@ GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values,
       Values.push_back(C);
       return Inst->getOperand(0);
     }
-    if (ConstantInt *C = GetConstantInt(Inst->getOperand(0), TD)) {
-      Values.push_back(C);
-      return Inst->getOperand(1);
-    }
-  } else if (Inst->getOpcode() == Instruction::Or) {
+    return 0;
+  }
+  
+  if (Inst->getOpcode() == Instruction::Or) {
     if (Value *LHS = GatherConstantSetEQs(Inst->getOperand(0), Values, TD))
       if (Value *RHS = GatherConstantSetEQs(Inst->getOperand(1), Values, TD))
         if (LHS == RHS)
@@ -329,16 +328,15 @@ GatherConstantSetNEs(Value *V, std::vector<ConstantInt*> &Values,
   if (Inst == 0) return 0;
 
   if (Inst->getOpcode() == Instruction::ICmp &&
-             cast<ICmpInst>(Inst)->getPredicate() == ICmpInst::ICMP_NE) {
+      cast<ICmpInst>(Inst)->getPredicate() == ICmpInst::ICMP_NE) {
     if (ConstantInt *C = GetConstantInt(Inst->getOperand(1), TD)) {
       Values.push_back(C);
       return Inst->getOperand(0);
     }
-    if (ConstantInt *C = GetConstantInt(Inst->getOperand(0), TD)) {
-      Values.push_back(C);
-      return Inst->getOperand(1);
-    }
-  } else if (Inst->getOpcode() == Instruction::And) {
+    return 0;
+  }
+  
+  if (Inst->getOpcode() == Instruction::And) {
     if (Value *LHS = GatherConstantSetNEs(Inst->getOperand(0), Values, TD))
       if (Value *RHS = GatherConstantSetNEs(Inst->getOperand(1), Values, TD))
         if (LHS == RHS)