[llvm-commits] [llvm] r121676 - /llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Chris Lattner sabre at nondot.org
Sun Dec 12 20:18:32 PST 2010


Author: lattner
Date: Sun Dec 12 22:18:32 2010
New Revision: 121676

URL: http://llvm.org/viewvc/llvm-project?rev=121676&view=rev
Log:
don't bother handling non-canonical icmp's

Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=121676&r1=121675&r2=121676&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Sun Dec 12 22:18:32 2010
@@ -306,11 +306,10 @@
       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 @@
   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)





More information about the llvm-commits mailing list