diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-13 08:04:32 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-13 08:04:32 +0000 |
commit | dccd9fe161135bffd3fddf0091f8e8efd4fd259b (patch) | |
tree | 280da722437622fb7326c2baa88fc99f324d0cd2 | |
parent | e922eb6f179969e79b40afd84e482d11beb7eb56 (diff) |
Fix some casts. isdigit(c) returns 0 or 1, not 0 or -1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32534 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/IPO/SimplifyLibCalls.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp index 8f2b94d1d8..2c3b66600b 100644 --- a/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -1747,7 +1747,7 @@ public: 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 @@ public: 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 @@ bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA) { /// 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) |