[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp SimplifyLibCalls.cpp

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



Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.98 -> 1.99
SimplifyLibCalls.cpp updated: 1.93 -> 1.94
---
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:  (+4 -4)

 GlobalOpt.cpp        |    2 +-
 SimplifyLibCalls.cpp |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.98 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.99
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.98	Wed Feb 14 20:26:10 2007
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp	Thu Mar  1 18:28:51 2007
@@ -1155,7 +1155,7 @@
   // instead of a select to synthesize the desired value.
   bool IsOneZero = false;
   if (ConstantInt *CI = dyn_cast<ConstantInt>(OtherVal))
-    IsOneZero = InitVal->isNullValue() && CI->equalsInt(1);
+    IsOneZero = InitVal->isNullValue() && CI->isOne();
 
   while (!GV->use_empty()) {
     Instruction *UI = cast<Instruction>(GV->use_back());


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.93 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.94
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.93	Mon Feb 12 23:58:53 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp	Thu Mar  1 18:28:51 2007
@@ -584,7 +584,7 @@
     for (uint64_t i = 0; i < len; ++i) {
       if (ConstantInt* CI = dyn_cast<ConstantInt>(CA->getOperand(i))) {
         // Check for the null terminator
-        if (CI->isNullValue())
+        if (CI->isZero())
           break; // we found end of string
         else if (CI->getSExtValue() == chr) {
           char_found = true;
@@ -2023,7 +2023,7 @@
   // Check to make sure that the first operand of the GEP is an integer and
   // has value 0 so that we are sure we're indexing into the initializer.
   if (ConstantInt* op1 = dyn_cast<ConstantInt>(GEP->getOperand(1))) {
-    if (!op1->isNullValue())
+    if (!op1->isZero())
       return false;
   } else
     return false;
@@ -2069,7 +2069,7 @@
   for (len = start_idx; len < max_elems; len++) {
     if (ConstantInt *CI = dyn_cast<ConstantInt>(A->getOperand(len))) {
       // Check for the null terminator
-      if (CI->isNullValue())
+      if (CI->isZero())
         break; // we found end of string
     } else
       return false; // This array isn't suitable, non-int initializer






More information about the llvm-commits mailing list