summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-12 18:01:45 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-12 18:01:45 +0000
commitdaa335a9c2d627f05bc2f74d32aefa7f7b32b1bb (patch)
tree477aa8f885bf16481b37e6095577e5a10c07bc6d
parent54df9896e3ac1a68703ecab9cce89f572ede45fa (diff)
downloadbcm5719-llvm-daa335a9c2d627f05bc2f74d32aefa7f7b32b1bb.tar.gz
bcm5719-llvm-daa335a9c2d627f05bc2f74d32aefa7f7b32b1bb.zip
IR: Simplify replaceOperandWith(), NFC
This will call `handleChangedOperand()` less frequently, but in that case (i.e., `isStoredDistinctInContext()`) it has identical logic to here. llvm-svn: 225643
-rw-r--r--llvm/lib/IR/Metadata.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 9dd07df1f8d..7ed0b951a3a 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -619,13 +619,12 @@ void MDNode::replaceOperandWith(unsigned I, Metadata *New) {
if (getOperand(I) == New)
return;
- if (auto *N = dyn_cast<GenericMDNode>(this)) {
- N->handleChangedOperand(mutable_begin() + I, New);
+ if (isStoredDistinctInContext() || isa<MDNodeFwdDecl>(this)) {
+ setOperand(I, New);
return;
}
- assert(isa<MDNodeFwdDecl>(this) && "Expected an MDNode");
- setOperand(I, New);
+ cast<GenericMDNode>(this)->handleChangedOperand(mutable_begin() + I, New);
}
void MDNode::setOperand(unsigned I, Metadata *New) {
OpenPOWER on IntegriCloud