IR: Simplify replaceOperandWith(), NFC

This will call `handleChangedOperand()` less frequently, but in that
case (i.e., `isStoredDistinctInContext()`) it has identical logic to
here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-01-12 18:01:45 +00:00
parent 21245280cc
commit e5e4a9a4df

View File

@ -619,13 +619,12 @@ void MDNode::replaceOperandWith(unsigned I, Metadata *New) {
if (getOperand(I) == New) if (getOperand(I) == New)
return; return;
if (auto *N = dyn_cast<GenericMDNode>(this)) { if (isStoredDistinctInContext() || isa<MDNodeFwdDecl>(this)) {
N->handleChangedOperand(mutable_begin() + I, New); setOperand(I, New);
return; return;
} }
assert(isa<MDNodeFwdDecl>(this) && "Expected an MDNode"); cast<GenericMDNode>(this)->handleChangedOperand(mutable_begin() + I, New);
setOperand(I, New);
} }
void MDNode::setOperand(unsigned I, Metadata *New) { void MDNode::setOperand(unsigned I, Metadata *New) {