diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-08-04 08:44:43 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-08-04 08:44:43 +0000 |
commit | 15876bb28c9c0983279c30a123c13224648574c1 (patch) | |
tree | 71be0cb152de7836179ef3dfedb7ad9869551e5f /lib/Transforms | |
parent | 868bbf35b079a7f356f6b2fbd9df7e66552bc57e (diff) | |
download | llvm-15876bb28c9c0983279c30a123c13224648574c1.tar.gz llvm-15876bb28c9c0983279c30a123c13224648574c1.tar.bz2 llvm-15876bb28c9c0983279c30a123c13224648574c1.tar.xz |
Stop using getValues().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15487 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 8 | ||||
-rw-r--r-- | lib/Transforms/Utils/ValueMapper.cpp | 26 |
3 files changed, 18 insertions, 20 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 747abc2f5b..eb4f1e31a6 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2947,7 +2947,7 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) { assert(CU->getValue() < STy->getNumElements() && "Struct index out of range!"); if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) { - C = cast<Constant>(CS->getValues()[CU->getValue()]); + C = CS->getOperand(CU->getValue()); } else if (isa<ConstantAggregateZero>(C)) { C = Constant::getNullValue(STy->getElementType(CU->getValue())); } else { @@ -2957,7 +2957,7 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) { const ArrayType *ATy = cast<ArrayType>(*I); if ((uint64_t)CI->getRawValue() >= ATy->getNumElements()) return 0; if (ConstantArray *CA = dyn_cast<ConstantArray>(C)) - C = cast<Constant>(CA->getValues()[CI->getRawValue()]); + C = CA->getOperand(CI->getRawValue()); else if (isa<ConstantAggregateZero>(C)) C = Constant::getNullValue(ATy->getElementType()); else diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 3557cadd40..1c39160d9b 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -753,13 +753,13 @@ static Constant *GetGEPGlobalInitializer(Constant *C, ConstantExpr *CE) { if (ConstantUInt *CU = dyn_cast<ConstantUInt>(CE->getOperand(i))) { ConstantStruct *CS = dyn_cast<ConstantStruct>(C); if (CS == 0) return 0; - if (CU->getValue() >= CS->getValues().size()) return 0; - C = cast<Constant>(CS->getValues()[CU->getValue()]); + if (CU->getValue() >= CS->getNumOperands()) return 0; + C = CS->getOperand(CU->getValue()); } else if (ConstantSInt *CS = dyn_cast<ConstantSInt>(CE->getOperand(i))) { ConstantArray *CA = dyn_cast<ConstantArray>(C); if (CA == 0) return 0; - if ((uint64_t)CS->getValue() >= CA->getValues().size()) return 0; - C = cast<Constant>(CA->getValues()[CS->getValue()]); + if ((uint64_t)CS->getValue() >= CA->getNumOperands()) return 0; + C = CA->getOperand(CS->getValue()); } else return 0; return C; diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 94e56b73a5..72ce4ae81f 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -34,40 +34,38 @@ Value *llvm::MapValue(const Value *V, std::map<const Value*, Value*> &VM) { isa<ConstantPointerNull>(C) || isa<ConstantAggregateZero>(C)) return VMSlot = C; // Primitive constants map directly else if (ConstantArray *CA = dyn_cast<ConstantArray>(C)) { - const std::vector<Use> &Vals = CA->getValues(); - for (unsigned i = 0, e = Vals.size(); i != e; ++i) { - Value *MV = MapValue(Vals[i], VM); - if (MV != Vals[i]) { + for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) { + Value *MV = MapValue(CA->getOperand(i), VM); + if (MV != CA->getOperand(i)) { // This array must contain a reference to a global, make a new array // and return it. // std::vector<Constant*> Values; - Values.reserve(Vals.size()); + Values.reserve(CA->getNumOperands()); for (unsigned j = 0; j != i; ++j) - Values.push_back(cast<Constant>(Vals[j])); + Values.push_back(CA->getOperand(j)); Values.push_back(cast<Constant>(MV)); for (++i; i != e; ++i) - Values.push_back(cast<Constant>(MapValue(Vals[i], VM))); + Values.push_back(cast<Constant>(MapValue(CA->getOperand(i), VM))); return VMSlot = ConstantArray::get(CA->getType(), Values); } } return VMSlot = C; } else if (ConstantStruct *CS = dyn_cast<ConstantStruct>(C)) { - const std::vector<Use> &Vals = CS->getValues(); - for (unsigned i = 0, e = Vals.size(); i != e; ++i) { - Value *MV = MapValue(Vals[i], VM); - if (MV != Vals[i]) { + for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) { + Value *MV = MapValue(CS->getOperand(i), VM); + if (MV != CS->getOperand(i)) { // This struct must contain a reference to a global, make a new struct // and return it. // std::vector<Constant*> Values; - Values.reserve(Vals.size()); + Values.reserve(CS->getNumOperands()); for (unsigned j = 0; j != i; ++j) - Values.push_back(cast<Constant>(Vals[j])); + Values.push_back(CS->getOperand(j)); Values.push_back(cast<Constant>(MV)); for (++i; i != e; ++i) - Values.push_back(cast<Constant>(MapValue(Vals[i], VM))); + Values.push_back(cast<Constant>(MapValue(CS->getOperand(i), VM))); return VMSlot = ConstantStruct::get(CS->getType(), Values); } } |