diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 6800bdf68f5..f679f235081 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -439,9 +439,9 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To, assert(isa(To) && "Cannot make Constant refer to non-constant!"); std::vector Values; - Values.reserve(getValues().size()); // Build replacement array... - for (unsigned i = 0, e = getValues().size(); i != e; ++i) { - Constant *Val = cast(getValues()[i]); + Values.reserve(getNumOperands()); // Build replacement array... + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { + Constant *Val = getOperand(i); if (Val == From) Val = cast(To); Values.push_back(Val); } @@ -464,9 +464,9 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To, assert(isa(To) && "Cannot make Constant refer to non-constant!"); std::vector Values; - Values.reserve(getValues().size()); - for (unsigned i = 0, e = getValues().size(); i != e; ++i) { - Constant *Val = cast(getValues()[i]); + Values.reserve(getNumOperands()); // Build replacement array... + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { + Constant *Val = getOperand(i); if (Val == From) Val = cast(To); Values.push_back(Val); }