[llvm-commits] CVS: llvm/lib/VMCore/ConstantFold.cpp

Reid Spencer reid at x10sys.com
Thu Mar 1 16:29:21 PST 2007



Changes in directory llvm/lib/VMCore:

ConstantFold.cpp updated: 1.145 -> 1.146
---
Log message:

Prefer non-virtual calls to ConstantInt::isZero over virtual calls to 
Constant::isNullValue() in situations where it is possible.


---
Diffs of the changes:  (+6 -6)

 ConstantFold.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/VMCore/ConstantFold.cpp
diff -u llvm/lib/VMCore/ConstantFold.cpp:1.145 llvm/lib/VMCore/ConstantFold.cpp:1.146
--- llvm/lib/VMCore/ConstantFold.cpp:1.145	Thu Mar  1 14:44:23 2007
+++ llvm/lib/VMCore/ConstantFold.cpp	Thu Mar  1 18:28:52 2007
@@ -783,15 +783,15 @@
       Constant *C2 = const_cast<Constant*>(V2);
       R = dyn_cast<ConstantInt>(
                              ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, C1, C2));
-      if (R && !R->isNullValue()) 
+      if (R && !R->isZero()) 
         return FCmpInst::FCMP_OEQ;
       R = dyn_cast<ConstantInt>(
                              ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, C1, C2));
-      if (R && !R->isNullValue()) 
+      if (R && !R->isZero()) 
         return FCmpInst::FCMP_OLT;
       R = dyn_cast<ConstantInt>(
                              ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, C1, C2));
-      if (R && !R->isNullValue()) 
+      if (R && !R->isZero()) 
         return FCmpInst::FCMP_OGT;
 
       // Nothing more we can do
@@ -850,15 +850,15 @@
       Constant *C2 = const_cast<Constant*>(V2);
       ICmpInst::Predicate pred = ICmpInst::ICMP_EQ;
       R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
-      if (R && !R->isNullValue()) 
+      if (R && !R->isZero()) 
         return pred;
       pred = isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
       R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
-      if (R && !R->isNullValue())
+      if (R && !R->isZero())
         return pred;
       pred = isSigned ?  ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
       R = dyn_cast<ConstantInt>(ConstantExpr::getICmp(pred, C1, C2));
-      if (R && !R->isNullValue())
+      if (R && !R->isZero())
         return pred;
       
       // If we couldn't figure it out, bail.






More information about the llvm-commits mailing list