diff options
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 62 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/LowerPacked.cpp | 38 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 28 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 4 |
7 files changed, 74 insertions, 74 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index e2e707c4d83..dbdea1ecdd7 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -278,7 +278,7 @@ static Constant *getAggregateConstantElement(Constant *Agg, Constant *Idx) { if (IdxV < CS->getNumOperands()) return CS->getOperand(IdxV); } else if (ConstantArray *CA = dyn_cast<ConstantArray>(Agg)) { if (IdxV < CA->getNumOperands()) return CA->getOperand(IdxV); - } else if (ConstantPacked *CP = dyn_cast<ConstantPacked>(Agg)) { + } else if (ConstantVector *CP = dyn_cast<ConstantVector>(Agg)) { if (IdxV < CP->getNumOperands()) return CP->getOperand(IdxV); } else if (isa<ConstantAggregateZero>(Agg)) { if (const StructType *STy = dyn_cast<StructType>(Agg->getType())) { @@ -398,7 +398,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) { unsigned NumElements = 0; if (const ArrayType *ATy = dyn_cast<ArrayType>(STy)) NumElements = ATy->getNumElements(); - else if (const PackedType *PTy = dyn_cast<PackedType>(STy)) + else if (const VectorType *PTy = dyn_cast<VectorType>(STy)) NumElements = PTy->getNumElements(); else assert(0 && "Unknown aggregate sequential type!"); @@ -1346,7 +1346,7 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV, if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue)) if (GV->getType()->getElementType() != Type::Int1Ty && !GV->getType()->getElementType()->isFloatingPoint() && - !isa<PackedType>(GV->getType()->getElementType()) && + !isa<VectorType>(GV->getType()->getElementType()) && !GS.HasPHIUser) { DOUT << " *** SHRINKING TO BOOL: " << *GV; ShrinkGlobalToBoolean(GV, SOVConstant); diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 84b83116228..65b1eb4a0f0 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1262,7 +1262,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask, Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts, uint64_t &UndefElts, unsigned Depth) { - unsigned VWidth = cast<PackedType>(V->getType())->getNumElements(); + unsigned VWidth = cast<VectorType>(V->getType())->getNumElements(); assert(VWidth <= 64 && "Vector too wide to analyze!"); uint64_t EltMask = ~0ULL >> (64-VWidth); assert(DemandedElts != EltMask && (DemandedElts & ~EltMask) == 0 && @@ -1278,8 +1278,8 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts, } UndefElts = 0; - if (ConstantPacked *CP = dyn_cast<ConstantPacked>(V)) { - const Type *EltTy = cast<PackedType>(V->getType())->getElementType(); + if (ConstantVector *CP = dyn_cast<ConstantVector>(V)) { + const Type *EltTy = cast<VectorType>(V->getType())->getElementType(); Constant *Undef = UndefValue::get(EltTy); std::vector<Constant*> Elts; @@ -1295,19 +1295,19 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts, } // If we changed the constant, return it. - Constant *NewCP = ConstantPacked::get(Elts); + Constant *NewCP = ConstantVector::get(Elts); return NewCP != CP ? NewCP : 0; } else if (isa<ConstantAggregateZero>(V)) { - // Simplify the CAZ to a ConstantPacked where the non-demanded elements are + // Simplify the CAZ to a ConstantVector where the non-demanded elements are // set to undef. - const Type *EltTy = cast<PackedType>(V->getType())->getElementType(); + const Type *EltTy = cast<VectorType>(V->getType())->getElementType(); Constant *Zero = Constant::getNullValue(EltTy); Constant *Undef = UndefValue::get(EltTy); std::vector<Constant*> Elts; for (unsigned i = 0; i != VWidth; ++i) Elts.push_back((DemandedElts & (1ULL << i)) ? Zero : Undef); UndefElts = DemandedElts ^ EltMask; - return ConstantPacked::get(Elts); + return ConstantVector::get(Elts); } if (!V->hasOneUse()) { // Other users may use these bits. @@ -1743,7 +1743,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { // See if SimplifyDemandedBits can simplify this. This handles stuff like // (X & 254)+1 -> (X&254)|1 uint64_t KnownZero, KnownOne; - if (!isa<PackedType>(I.getType()) && + if (!isa<VectorType>(I.getType()) && SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(), KnownZero, KnownOne)) return &I; @@ -3064,12 +3064,12 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) { // See if we can simplify any instructions used by the instruction whose sole // purpose is to compute bits we don't care about. uint64_t KnownZero, KnownOne; - if (!isa<PackedType>(I.getType())) { + if (!isa<VectorType>(I.getType())) { if (SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(), KnownZero, KnownOne)) return &I; } else { - if (ConstantPacked *CP = dyn_cast<ConstantPacked>(Op1)) { + if (ConstantVector *CP = dyn_cast<ConstantVector>(Op1)) { if (CP->isAllOnesValue()) return ReplaceInstUsesWith(I, I.getOperand(0)); } @@ -3543,7 +3543,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { // See if we can simplify any instructions used by the instruction whose sole // purpose is to compute bits we don't care about. uint64_t KnownZero, KnownOne; - if (!isa<PackedType>(I.getType()) && + if (!isa<VectorType>(I.getType()) && SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(), KnownZero, KnownOne)) return &I; @@ -3874,7 +3874,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { // See if we can simplify any instructions used by the instruction whose sole // purpose is to compute bits we don't care about. uint64_t KnownZero, KnownOne; - if (!isa<PackedType>(I.getType()) && + if (!isa<VectorType>(I.getType()) && SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(), KnownZero, KnownOne)) return &I; @@ -6460,8 +6460,8 @@ Instruction *InstCombiner::visitBitCast(CastInst &CI) { if (SVI->hasOneUse()) { // Okay, we have (bitconvert (shuffle ..)). Check to see if this is // a bitconvert to a vector with the same # elts. - if (isa<PackedType>(DestTy) && - cast<PackedType>(DestTy)->getNumElements() == + if (isa<VectorType>(DestTy) && + cast<VectorType>(DestTy)->getNumElements() == SVI->getType()->getNumElements()) { CastInst *Tmp; // If either of the operands is a cast from CI.getType(), then @@ -7082,7 +7082,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { case Intrinsic::ppc_altivec_vperm: // Turn vperm(V1,V2,mask) -> shuffle(V1,V2,mask) if mask is a constant. - if (ConstantPacked *Mask = dyn_cast<ConstantPacked>(II->getOperand(3))) { + if (ConstantVector *Mask = dyn_cast<ConstantVector>(II->getOperand(3))) { assert(Mask->getNumOperands() == 16 && "Bad type for intrinsic!"); // Check that all of the elements are integer constants or undefs. @@ -8037,7 +8037,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) { const Type *SrcPTy = SrcTy->getElementType(); if (DestPTy->isInteger() || isa<PointerType>(DestPTy) || - isa<PackedType>(DestPTy)) { + isa<VectorType>(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. @@ -8052,7 +8052,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) { } if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy) || - isa<PackedType>(SrcPTy)) && + isa<VectorType>(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. (isa<PointerType>(SrcPTy) == isa<PointerType>(LI.getType())) && @@ -8516,7 +8516,7 @@ Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) { static bool CheapToScalarize(Value *V, bool isConstant) { if (isa<ConstantAggregateZero>(V)) return true; - if (ConstantPacked *C = dyn_cast<ConstantPacked>(V)) { + if (ConstantVector *C = dyn_cast<ConstantVector>(V)) { if (isConstant) return true; // If all elts are the same, we can extract. Constant *Op0 = C->getOperand(0); @@ -8561,7 +8561,7 @@ static std::vector<unsigned> getShuffleMask(const ShuffleVectorInst *SVI) { return std::vector<unsigned>(NElts, 2*NElts); std::vector<unsigned> Result; - const ConstantPacked *CP = cast<ConstantPacked>(SVI->getOperand(2)); + const ConstantVector *CP = cast<ConstantVector>(SVI->getOperand(2)); for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) if (isa<UndefValue>(CP->getOperand(i))) Result.push_back(NElts*2); // undef -> 8 @@ -8574,8 +8574,8 @@ static std::vector<unsigned> getShuffleMask(const ShuffleVectorInst *SVI) { /// value is already around as a register, for example if it were inserted then /// extracted from the vector. static Value *FindScalarElement(Value *V, unsigned EltNo) { - assert(isa<PackedType>(V->getType()) && "Not looking at a vector?"); - const PackedType *PTy = cast<PackedType>(V->getType()); + assert(isa<VectorType>(V->getType()) && "Not looking at a vector?"); + const VectorType *PTy = cast<VectorType>(V->getType()); unsigned Width = PTy->getNumElements(); if (EltNo >= Width) // Out of range access. return UndefValue::get(PTy->getElementType()); @@ -8584,7 +8584,7 @@ static Value *FindScalarElement(Value *V, unsigned EltNo) { return UndefValue::get(PTy->getElementType()); else if (isa<ConstantAggregateZero>(V)) return Constant::getNullValue(PTy->getElementType()); - else if (ConstantPacked *CP = dyn_cast<ConstantPacked>(V)) + else if (ConstantVector *CP = dyn_cast<ConstantVector>(V)) return CP->getOperand(EltNo); else if (InsertElementInst *III = dyn_cast<InsertElementInst>(V)) { // If this is an insert to a variable element, we don't know what it is. @@ -8624,7 +8624,7 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) { if (isa<ConstantAggregateZero>(EI.getOperand(0))) return ReplaceInstUsesWith(EI, Constant::getNullValue(EI.getType())); - if (ConstantPacked *C = dyn_cast<ConstantPacked>(EI.getOperand(0))) { + if (ConstantVector *C = dyn_cast<ConstantVector>(EI.getOperand(0))) { // If packed val is constant with uniform operands, replace EI // with that operand Constant *op0 = C->getOperand(0); @@ -8724,7 +8724,7 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS, std::vector<Constant*> &Mask) { assert(V->getType() == LHS->getType() && V->getType() == RHS->getType() && "Invalid CollectSingleShuffleElements"); - unsigned NumElts = cast<PackedType>(V->getType())->getNumElements(); + unsigned NumElts = cast<VectorType>(V->getType())->getNumElements(); if (isa<UndefValue>(V)) { Mask.assign(NumElts, UndefValue::get(Type::Int32Ty)); @@ -8792,10 +8792,10 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS, /// that computes V and the LHS value of the shuffle. static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask, Value *&RHS) { - assert(isa<PackedType>(V->getType()) && + assert(isa<VectorType>(V->getType()) && (RHS == 0 || V->getType() == RHS->getType()) && "Invalid shuffle!"); - unsigned NumElts = cast<PackedType>(V->getType())->getNumElements(); + unsigned NumElts = cast<VectorType>(V->getType())->getNumElements(); if (isa<UndefValue>(V)) { Mask.assign(NumElts, UndefValue::get(Type::Int32Ty)); @@ -8895,7 +8895,7 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) { } Mask[InsertedIdx] = ConstantInt::get(Type::Int32Ty, ExtractedIdx); return new ShuffleVectorInst(EI->getOperand(0), VecOp, - ConstantPacked::get(Mask)); + ConstantVector::get(Mask)); } // If this insertelement isn't used by some other insertelement, turn it @@ -8906,7 +8906,7 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) { Value *LHS = CollectShuffleElements(&IE, Mask, RHS); if (RHS == 0) RHS = UndefValue::get(LHS->getType()); // We now have a shuffle of LHS, RHS, Mask. - return new ShuffleVectorInst(LHS, RHS, ConstantPacked::get(Mask)); + return new ShuffleVectorInst(LHS, RHS, ConstantVector::get(Mask)); } } } @@ -8947,7 +8947,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { else Elts.push_back(ConstantInt::get(Type::Int32Ty, Mask[i])); } - SVI.setOperand(2, ConstantPacked::get(Elts)); + SVI.setOperand(2, ConstantVector::get(Elts)); } } @@ -8975,7 +8975,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { } SVI.setOperand(0, SVI.getOperand(1)); SVI.setOperand(1, UndefValue::get(RHS->getType())); - SVI.setOperand(2, ConstantPacked::get(Elts)); + SVI.setOperand(2, ConstantVector::get(Elts)); LHS = SVI.getOperand(0); RHS = SVI.getOperand(1); MadeChange = true; @@ -9030,7 +9030,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { } return new ShuffleVectorInst(LHSSVI->getOperand(0), LHSSVI->getOperand(1), - ConstantPacked::get(Elts)); + ConstantVector::get(Elts)); } } } diff --git a/llvm/lib/Transforms/Scalar/LowerPacked.cpp b/llvm/lib/Transforms/Scalar/LowerPacked.cpp index 72307a18a40..d78f068e0e4 100644 --- a/llvm/lib/Transforms/Scalar/LowerPacked.cpp +++ b/llvm/lib/Transforms/Scalar/LowerPacked.cpp @@ -72,13 +72,13 @@ public: /// @param EI the insertelement operator to convert void visitInsertElementInst(InsertElementInst& IE); - /// This function asserts if the instruction is a PackedType but + /// This function asserts if the instruction is a VectorType but /// is handled by another function. /// - /// @brief Asserts if PackedType instruction is not handled elsewhere. + /// @brief Asserts if VectorType instruction is not handled elsewhere. /// @param I the unhandled instruction void visitInstruction(Instruction &I) { - if (isa<PackedType>(I.getType())) + if (isa<VectorType>(I.getType())) cerr << "Unhandled Instruction with Packed ReturnType: " << I << '\n'; } private: @@ -150,8 +150,8 @@ void LowerPacked::setValues(Value* value,const std::vector<Value*>& values) // the program. std::vector<Value*>& LowerPacked::getValues(Value* value) { - assert(isa<PackedType>(value->getType()) && - "Value must be PackedType"); + assert(isa<VectorType>(value->getType()) && + "Value must be VectorType"); // reject further processing if this one has // already been handled @@ -161,7 +161,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value) return it->second; } - if (ConstantPacked* CP = dyn_cast<ConstantPacked>(value)) { + if (ConstantVector* CP = dyn_cast<ConstantVector>(value)) { // non-zero constant case std::vector<Value*> results; results.reserve(CP->getNumOperands()); @@ -174,7 +174,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value) else if (ConstantAggregateZero* CAZ = dyn_cast<ConstantAggregateZero>(value)) { // zero constant - const PackedType* PKT = cast<PackedType>(CAZ->getType()); + const VectorType* PKT = cast<VectorType>(CAZ->getType()); std::vector<Value*> results; results.reserve(PKT->getNumElements()); @@ -187,7 +187,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value) } else if (isa<Instruction>(value)) { // foward reference - const PackedType* PKT = cast<PackedType>(value->getType()); + const VectorType* PKT = cast<VectorType>(value->getType()); std::vector<Value*> results; results.reserve(PKT->getNumElements()); @@ -200,7 +200,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value) else { // we don't know what it is, and we are trying to retrieve // a value for it - assert(false && "Unhandled PackedType value"); + assert(false && "Unhandled VectorType value"); abort(); } } @@ -208,7 +208,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value) void LowerPacked::visitLoadInst(LoadInst& LI) { // Make sure what we are dealing with is a packed type - if (const PackedType* PKT = dyn_cast<PackedType>(LI.getType())) { + if (const VectorType* PKT = dyn_cast<VectorType>(LI.getType())) { // Initialization, Idx is needed for getelementptr needed later std::vector<Value*> Idx(2); Idx[0] = ConstantInt::get(Type::Int32Ty,0); @@ -249,8 +249,8 @@ void LowerPacked::visitLoadInst(LoadInst& LI) void LowerPacked::visitBinaryOperator(BinaryOperator& BO) { - // Make sure both operands are PackedTypes - if (isa<PackedType>(BO.getOperand(0)->getType())) { + // Make sure both operands are VectorTypes + if (isa<VectorType>(BO.getOperand(0)->getType())) { std::vector<Value*>& op0Vals = getValues(BO.getOperand(0)); std::vector<Value*>& op1Vals = getValues(BO.getOperand(1)); std::vector<Value*> result; @@ -277,8 +277,8 @@ void LowerPacked::visitBinaryOperator(BinaryOperator& BO) void LowerPacked::visitICmpInst(ICmpInst& IC) { - // Make sure both operands are PackedTypes - if (isa<PackedType>(IC.getOperand(0)->getType())) { + // Make sure both operands are VectorTypes + if (isa<VectorType>(IC.getOperand(0)->getType())) { std::vector<Value*>& op0Vals = getValues(IC.getOperand(0)); std::vector<Value*>& op1Vals = getValues(IC.getOperand(1)); std::vector<Value*> result; @@ -306,8 +306,8 @@ void LowerPacked::visitICmpInst(ICmpInst& IC) void LowerPacked::visitStoreInst(StoreInst& SI) { - if (const PackedType* PKT = - dyn_cast<PackedType>(SI.getOperand(0)->getType())) { + if (const VectorType* PKT = + dyn_cast<VectorType>(SI.getOperand(0)->getType())) { // We will need this for getelementptr std::vector<Value*> Idx(2); Idx[0] = ConstantInt::get(Type::Int32Ty,0); @@ -343,8 +343,8 @@ void LowerPacked::visitStoreInst(StoreInst& SI) void LowerPacked::visitSelectInst(SelectInst& SELI) { - // Make sure both operands are PackedTypes - if (isa<PackedType>(SELI.getType())) { + // Make sure both operands are VectorTypes + if (isa<VectorType>(SELI.getType())) { std::vector<Value*>& op0Vals = getValues(SELI.getTrueValue()); std::vector<Value*>& op1Vals = getValues(SELI.getFalseValue()); std::vector<Value*> result; @@ -369,7 +369,7 @@ void LowerPacked::visitSelectInst(SelectInst& SELI) void LowerPacked::visitExtractElementInst(ExtractElementInst& EI) { std::vector<Value*>& op0Vals = getValues(EI.getOperand(0)); - const PackedType *PTy = cast<PackedType>(EI.getOperand(0)->getType()); + const VectorType *PTy = cast<VectorType>(EI.getOperand(0)->getType()); Value *op1 = EI.getOperand(1); if (ConstantInt *C = dyn_cast<ConstantInt>(op1)) { diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 2193777e250..e1dbb9b0d1b 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -752,7 +752,7 @@ void Reassociate::ReassociateBB(BasicBlock *BB) { // Reject cases where it is pointless to do this. if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint() || - isa<PackedType>(BI->getType())) + isa<VectorType>(BI->getType())) continue; // Floating point ops are not associative. // If this is a subtract instruction which is not already in negate form, diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 78377e74271..72093980efb 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -702,8 +702,8 @@ void SCCPSolver::visitBinaryOperator(Instruction &I) { // Could annihilate value. if (I.getOpcode() == Instruction::And) markConstant(IV, &I, Constant::getNullValue(I.getType())); - else if (const PackedType *PT = dyn_cast<PackedType>(I.getType())) - markConstant(IV, &I, ConstantPacked::getAllOnesValue(PT)); + else if (const VectorType *PT = dyn_cast<VectorType>(I.getType())) + markConstant(IV, &I, ConstantVector::getAllOnesValue(PT)); else markConstant(IV, &I, ConstantInt::getAllOnesValue(I.getType())); return; @@ -1237,8 +1237,8 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) { case Instruction::Or: // undef | X -> -1. X could be -1. - if (const PackedType *PTy = dyn_cast<PackedType>(ITy)) - markForcedConstant(LV, I, ConstantPacked::getAllOnesValue(PTy)); + if (const VectorType *PTy = dyn_cast<VectorType>(ITy)) + markForcedConstant(LV, I, ConstantVector::getAllOnesValue(PTy)); else markForcedConstant(LV, I, ConstantInt::getAllOnesValue(ITy)); return true; diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index bd0cf7476c8..480f2aae2ff 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -323,12 +323,12 @@ int SROA::isSafeUseOfAllocation(Instruction *User) { // // Scalar replacing *just* the outer index of the array is probably not // going to be a win anyway, so just give up. - for (++I; I != E && (isa<ArrayType>(*I) || isa<PackedType>(*I)); ++I) { + for (++I; I != E && (isa<ArrayType>(*I) || isa<VectorType>(*I)); ++I) { uint64_t NumElements; if (const ArrayType *SubArrayTy = dyn_cast<ArrayType>(*I)) NumElements = SubArrayTy->getNumElements(); else - NumElements = cast<PackedType>(*I)->getNumElements(); + NumElements = cast<VectorType>(*I)->getNumElements(); if (!isa<ConstantInt>(I.getOperand())) return 0; if (cast<ConstantInt>(I.getOperand())->getZExtValue() >= NumElements) @@ -440,7 +440,7 @@ void SROA::CanonicalizeAllocaUsers(AllocationInst *AI) { static bool MergeInType(const Type *In, const Type *&Accum, const TargetData &TD) { // If this is our first type, just use it. - const PackedType *PTy; + const VectorType *PTy; if (Accum == Type::VoidTy || In == Accum) { Accum = In; } else if (In == Type::VoidTy) { @@ -452,16 +452,16 @@ static bool MergeInType(const Type *In, const Type *&Accum, Accum = In; } else if (isa<PointerType>(In) && isa<PointerType>(Accum)) { // Pointer unions just stay as one of the pointers. - } else if (isa<PackedType>(In) || isa<PackedType>(Accum)) { - if ((PTy = dyn_cast<PackedType>(Accum)) && + } else if (isa<VectorType>(In) || isa<VectorType>(Accum)) { + if ((PTy = dyn_cast<VectorType>(Accum)) && PTy->getElementType() == In) { // Accum is a vector, and we are accessing an element: ok. - } else if ((PTy = dyn_cast<PackedType>(In)) && + } else if ((PTy = dyn_cast<VectorType>(In)) && PTy->getElementType() == Accum) { // In is a vector, and accum is an element: ok, remember In. Accum = In; - } else if ((PTy = dyn_cast<PackedType>(In)) && isa<PackedType>(Accum) && - PTy->getBitWidth() == cast<PackedType>(Accum)->getBitWidth()) { + } else if ((PTy = dyn_cast<VectorType>(In)) && isa<VectorType>(Accum) && + PTy->getBitWidth() == cast<VectorType>(Accum)->getBitWidth()) { // Two vectors of the same size: keep Accum. } else { // Cannot insert an short into a <4 x int> or handle @@ -561,7 +561,7 @@ const Type *SROA::CanConvertToScalar(Value *V, bool &IsNotTrivial) { if (const ArrayType *ATy = dyn_cast<ArrayType>(AggTy)) { if (Idx >= ATy->getNumElements()) return 0; // Out of range. - } else if (const PackedType *PackedTy = dyn_cast<PackedType>(AggTy)) { + } else if (const VectorType *PackedTy = dyn_cast<VectorType>(AggTy)) { // Getting an element of the packed vector. if (Idx >= PackedTy->getNumElements()) return 0; // Out of range. @@ -630,7 +630,7 @@ void SROA::ConvertToScalar(AllocationInst *AI, const Type *ActualTy) { /// Offset is an offset from the original alloca, in bits that need to be /// shifted to the right. By the end of this, there should be no uses of Ptr. void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { - bool isVectorInsert = isa<PackedType>(NewAI->getType()->getElementType()); + bool isVectorInsert = isa<VectorType>(NewAI->getType()->getElementType()); const TargetData &TD = getAnalysis<TargetData>(); while (!Ptr->use_empty()) { Instruction *User = cast<Instruction>(Ptr->use_back()); @@ -639,10 +639,10 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { // The load is a bit extract from NewAI shifted right by Offset bits. Value *NV = new LoadInst(NewAI, LI->getName(), LI); if (NV->getType() != LI->getType()) { - if (const PackedType *PTy = dyn_cast<PackedType>(NV->getType())) { + if (const VectorType *PTy = dyn_cast<VectorType>(NV->getType())) { // If the result alloca is a packed type, this is either an element // access or a bitcast to another packed type. - if (isa<PackedType>(LI->getType())) { + if (isa<VectorType>(LI->getType())) { NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); } else { // Must be an element access. @@ -702,10 +702,10 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { if (SV->getType() != AllocaType) { Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI); - if (const PackedType *PTy = dyn_cast<PackedType>(AllocaType)) { + if (const VectorType *PTy = dyn_cast<VectorType>(AllocaType)) { // If the result alloca is a packed type, this is either an element // access or a bitcast to another packed type. - if (isa<PackedType>(SV->getType())) { + if (isa<VectorType>(SV->getType())) { SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); } else { // Must be an element insertion. diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index f90716ca260..fd68240f41a 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -78,7 +78,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) { for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) Ops.push_back(cast<Constant>(MapValue(CE->getOperand(i), VM))); return VM[V] = CE->getWithOperands(Ops); - } else if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C)) { + } else if (ConstantVector *CP = dyn_cast<ConstantVector>(C)) { for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) { Value *MV = MapValue(CP->getOperand(i), VM); if (MV != CP->getOperand(i)) { @@ -92,7 +92,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) { Values.push_back(cast<Constant>(MV)); for (++i; i != e; ++i) Values.push_back(cast<Constant>(MapValue(CP->getOperand(i), VM))); - return VM[V] = ConstantPacked::get(Values); + return VM[V] = ConstantVector::get(Values); } } return VMSlot = C; |