Changes in directory llvm/lib/Transforms/Scalar:
IndVarSimplify.cpp updated: 1.104 -> 1.105 InstructionCombining.cpp updated: 1.595 -> 1.596 LoopStrengthReduce.cpp updated: 1.105 -> 1.106 ScalarReplAggregates.cpp updated: 1.64 -> 1.65 --- Log message: Eliminate calls to isInteger, generalizing code and tightening checks as needed. --- Diffs of the changes: (+18 -18) IndVarSimplify.cpp | 6 +++--- InstructionCombining.cpp | 24 ++++++++++++------------ LoopStrengthReduce.cpp | 2 +- ScalarReplAggregates.cpp | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.104 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.105 --- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.104 Fri Jan 12 16:51:20 2007 +++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp Sun Jan 14 19:55:30 2007 @@ -325,7 +325,7 @@ if (LI->getLoopFor(L->getBlocks()[i]) == L) { // Not in a subloop... BasicBlock *BB = L->getBlocks()[i]; for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) { - if (I->getType()->isInteger()) { // Is an integer instruction + if (I->getType()->isIntegral()) { // Is an integer instruction SCEVHandle SH = SE->getSCEV(I); if (SH->hasComputableLoopEvolution(L) || // Varies predictably HasConstantItCount) { @@ -460,7 +460,7 @@ for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) { PHINode *PN = cast<PHINode>(I); - if (PN->getType()->isInteger()) { // FIXME: when we have fast-math, enable! + if (PN->getType()->isIntegral()) { // FIXME: when we have fast-math, enable! SCEVHandle SCEV = SE->getSCEV(PN); if (SCEV->hasComputableLoopEvolution(L)) // FIXME: It is an extremely bad idea to indvar substitute anything more @@ -574,7 +574,7 @@ if (LI->getLoopFor(L->getBlocks()[i]) == L) { // Not in a subloop... BasicBlock *BB = L->getBlocks()[i]; for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) - if (I->getType()->isInteger() && // Is an integer instruction + if (I->getType()->isIntegral() && // Is an integer instruction !I->use_empty() && !Rewriter.isInsertedInstruction(I)) { SCEVHandle SH = SE->getSCEV(I); Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.595 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.596 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.595 Sun Jan 14 13:42:17 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Jan 14 19:55:30 2007 @@ -495,7 +495,7 @@ // Otherwise, return null. // static inline Value *dyn_castFoldableMul(Value *V, ConstantInt *&CST) { - if (V->hasOneUse() && V->getType()->isInteger()) + if (V->hasOneUse() && V->getType()->isIntegral()) if (Instruction *I = dyn_cast<Instruction>(V)) { if (I->getOpcode() == Instruction::Mul) if ((CST = dyn_cast<ConstantInt>(I->getOperand(1)))) @@ -1808,7 +1808,7 @@ } // X + X --> X << 1 - if (I.getType()->isInteger()) { + if (I.getType()->isIntegral() && I.getType() != Type::Int1Ty) { if (Instruction *Result = AssociativeOpt(I, AddRHS(RHS))) return Result; if (Instruction *RHSI = dyn_cast<Instruction>(RHS)) { @@ -1933,7 +1933,7 @@ if (CastInst *CI = dyn_cast<CastInst>(V)) { const Type *CTy = CI->getType(); const Type *OpTy = CI->getOperand(0)->getType(); - if (CTy->isInteger() && OpTy->isInteger()) { + if (CTy->isIntegral() && OpTy->isIntegral()) { if (CTy->getPrimitiveSizeInBits() == OpTy->getPrimitiveSizeInBits()) return RemoveNoopCast(CI->getOperand(0)); } else if (isa<PointerType>(CTy) && isa<PointerType>(OpTy)) @@ -2412,7 +2412,7 @@ // If the sign bits of both operands are zero (i.e. we can prove they are // unsigned inputs), turn this into a udiv. - if (I.getType()->isInteger()) { + if (I.getType()->isIntegral()) { uint64_t Mask = 1ULL << (I.getType()->getPrimitiveSizeInBits()-1); if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) { return BinaryOperator::createUDiv(Op0, Op1, I.getName()); @@ -5062,7 +5062,7 @@ Value *CastOp = Cast->getOperand(0); const Type *SrcTy = CastOp->getType(); unsigned SrcTySize = SrcTy->getPrimitiveSizeInBits(); - if (SrcTy->isInteger() && + if (SrcTy->isIntegral() && SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { // If this is an unsigned comparison, try to make the comparison use // smaller constant values. @@ -6395,7 +6395,7 @@ const Type *SrcTy = Src->getType(); const Type *DestTy = CI.getType(); - if (SrcTy->isInteger() && DestTy->isInteger()) { + if (SrcTy->isIntegral() && DestTy->isIntegral()) { if (Instruction *Result = commonIntCastTransforms(CI)) return Result; } else { @@ -6816,7 +6816,7 @@ } // See if we can fold the select into one of our operands. - if (SI.getType()->isInteger()) { + if (SI.getType()->isIntegral()) { // See the comment above GetSelectFoldableOperands for a description of the // transformation we are doing here. if (Instruction *TVI = dyn_cast<Instruction>(TrueVal)) @@ -7667,7 +7667,7 @@ Value *Src = CI->getOperand(0); const Type *SrcTy = Src->getType(); const Type *DestTy = CI->getType(); - if (Src->getType()->isInteger()) { + if (Src->getType()->isIntegral()) { if (SrcTy->getPrimitiveSizeInBits() == DestTy->getPrimitiveSizeInBits()) { // We can always eliminate a cast from ulong or long to the other. @@ -7998,7 +7998,7 @@ if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) { const Type *SrcPTy = SrcTy->getElementType(); - if (DestPTy->isInteger() || isa<PointerType>(DestPTy) || + if (DestPTy->isIntegral() || isa<PointerType>(DestPTy) || isa<PackedType>(DestPTy)) { // If the source is an array, the code below will not succeed. Check to // see if a trivial 'gep P, 0, 0' will help matters. Only do this for @@ -8012,7 +8012,7 @@ SrcPTy = SrcTy->getElementType(); } - if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy) || + if ((SrcPTy->isIntegral() || isa<PointerType>(SrcPTy) || isa<PackedType>(SrcPTy)) && // Do not allow turning this into a load of an integer, which is then // casted to a pointer, this pessimizes pointer analysis a lot. @@ -8186,7 +8186,7 @@ if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) { const Type *SrcPTy = SrcTy->getElementType(); - if (DestPTy->isInteger() || isa<PointerType>(DestPTy)) { + if (DestPTy->isIntegral() || isa<PointerType>(DestPTy)) { // If the source is an array, the code below will not succeed. Check to // see if a trivial 'gep P, 0, 0' will help matters. Only do this for // constants. @@ -8199,7 +8199,7 @@ SrcPTy = SrcTy->getElementType(); } - if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy)) && + if ((SrcPTy->isIntegral() || isa<PointerType>(SrcPTy)) && IC.getTargetData().getTypeSize(SrcPTy) == IC.getTargetData().getTypeSize(DestPTy)) { Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.105 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.106 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.105 Mon Jan 8 10:17:51 2007 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Jan 14 19:55:30 2007 @@ -398,7 +398,7 @@ /// return true. Otherwise, return false. bool LoopStrengthReduce::AddUsersIfInteresting(Instruction *I, Loop *L, std::set<Instruction*> &Processed) { - if (!I->getType()->isInteger() && !isa<PointerType>(I->getType())) + if (!I->getType()->isIntegral() && !isa<PointerType>(I->getType())) return false; // Void and FP expressions cannot be reduced. if (!Processed.insert(I).second) return true; // Instruction already handled. Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.64 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.65 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.64 Fri Jan 12 01:05:14 2007 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sun Jan 14 19:55:30 2007 @@ -541,7 +541,7 @@ IsNotTrivial = true; const Type *SubElt = CanConvertToScalar(GEP, IsNotTrivial); if (SubElt == 0) return 0; - if (SubElt != Type::VoidTy && SubElt->isInteger()) { + if (SubElt != Type::VoidTy && SubElt->isIntegral()) { const Type *NewTy = getUIntAtLeastAsBitAs(TD.getTypeSize(SubElt)*8+BitOffset); if (NewTy == 0 || MergeInType(NewTy, UsedType, TD)) return 0; @@ -653,7 +653,7 @@ // an integer. NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); } else { - assert(NV->getType()->isInteger() && "Unknown promotion!"); + assert(NV->getType()->isIntegral() && "Unknown promotion!"); if (Offset && Offset < TD.getTypeSize(NV->getType())*8) { NV = new ShiftInst(Instruction::LShr, NV, ConstantInt::get(Type::Int8Ty, Offset), _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits