+ if (Constant *C = getImpl(Values)) {
+ replaceUsesOfWithOnConstantImpl(C);
+ return;
+ }
+
+ // Update to the new value. Optimize for the case when we have a single
+ // operand that we're changing, but handle bulk updates efficiently.
+ auto &pImpl = getType()->getContext().pImpl;
+ pImpl->VectorConstants.remove(this);
+
+ if (NumUpdated == 1) {
+ unsigned OperandToUpdate = U - OperandList;
+ assert(getOperand(OperandToUpdate) == From && "ReplaceAllUsesWith broken!");
+ setOperand(OperandToUpdate, ToC);
+ } else {
+ for (unsigned I = 0, E = getNumOperands(); I != E; ++I)
+ if (getOperand(I) == From)
+ setOperand(I, ToC);
+ }
+
+ pImpl->VectorConstants.insert(this);