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

Reid Spencer reid at x10sys.com
Wed Dec 13 00:04:47 PST 2006



Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.75 -> 1.76
---
Log message:

Fix some casts. isdigit(c) returns 0 or 1, not 0 or -1


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

 SimplifyLibCalls.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.75 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.76
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.75	Tue Dec 12 18:50:17 2006
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp	Wed Dec 13 02:04:32 2006
@@ -1747,7 +1747,7 @@
     SetCondInst* setcond_inst = new SetCondInst(Instruction::SetLE,sub_inst,
         ConstantInt::get(Type::UIntTy,9),
         ci->getOperand(1)->getName()+".cmp",ci);
-    CastInst* c2 = new SExtInst(setcond_inst, Type::IntTy, 
+    CastInst* c2 = new ZExtInst(setcond_inst, Type::IntTy, 
         ci->getOperand(1)->getName()+".isdigit", ci);
     ci->replaceAllUsesWith(c2);
     ci->eraseFromParent();
@@ -1873,7 +1873,7 @@
     Value *V = CastInst::createIntegerCast(TheCall->getOperand(1), ArgType, 
                                            false/*ZExt*/, "tmp", TheCall);
     Value *V2 = new CallInst(F, V, "tmp", TheCall);
-    V2 = CastInst::createIntegerCast(V2, Type::IntTy, true/*SExt*/, 
+    V2 = CastInst::createIntegerCast(V2, Type::IntTy, false/*ZExt*/, 
                                      "tmp", TheCall);
     V2 = BinaryOperator::createAdd(V2, ConstantInt::get(Type::IntTy, 1),
                                    "tmp", TheCall);
@@ -2117,7 +2117,7 @@
 /// inserting the cast before IP, and return the cast.
 /// @brief Cast a value to a "C" string.
 Value *CastToCStr(Value *V, Instruction &IP) {
-  assert(V->getType()->getTypeID() == Type::PointerTyID && 
+  assert(isa<PointerType>(V->getType()) && 
          "Can't cast non-pointer type to C string type");
   const Type *SBPTy = PointerType::get(Type::SByteTy);
   if (V->getType() != SBPTy)






More information about the llvm-commits mailing list