aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopInfo.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-23 17:55:41 -0400
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-10-26 17:03:25 -0400
commitd4c667c9af0335ac20015decce204c43f03a6cee (patch)
tree5bcb3cf6505227eac1e8bb47abaae4c1b980c25f /llvm/lib/Analysis/LoopInfo.cpp
parent89ec5091cc95e062712f544167abd692c9092f7f (diff)
downloadllvm-d4c667c9af0335ac20015decce204c43f03a6cee.zip
llvm-d4c667c9af0335ac20015decce204c43f03a6cee.tar.gz
llvm-d4c667c9af0335ac20015decce204c43f03a6cee.tar.bz2
Avoid unnecessary uses of `MDNode::getTemporary`, NFC
This is a long-delayed follow-up to 5e5b85098dbeaea2cfa5d01695b5d2982634d7dd. `TempMDNode` includes a bunch of machinery for RAUW, and should only be used when necessary. RAUW wasn't being used in any of these cases... it was just a placeholder for a self-reference. Where the real node was using `MDNode::getDistinct`, just replace the temporary argument with `nullptr`. Where the real node was using `MDNode::get`, the `replaceOperandWith` call was "promoting" the node to a distinct one implicitly due to self-reference detection in `MDNode::handleChangedOperand`. The `TempMDNode` was serving a purpose by delaying uniquing, but it's way simpler to just call `MDNode::getDistinct` in the first place. Note that using a self-reference at all in these places is a hold-over from before `distinct` metadata existed. It was an old trick to create distinct nodes. It would be intrusive to change, including bitcode upgrades, etc., and it's harmless so I'm not sure there's much value in removing it from existing schemas. After this commit it still has a tiny memory cost (in the extra metadata operand) but no more overhead in construction. Differential Revision: https://reviews.llvm.org/D90079
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
-rw-r--r--llvm/lib/Analysis/LoopInfo.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp
index 46d6eb62..5ac9295 100644
--- a/llvm/lib/Analysis/LoopInfo.cpp
+++ b/llvm/lib/Analysis/LoopInfo.cpp
@@ -1017,8 +1017,7 @@ MDNode *llvm::makePostTransformationMetadata(LLVMContext &Context,
SmallVector<Metadata *, 4> MDs;
// Reserve first location for self reference to the LoopID metadata node.
- TempMDTuple TempNode = MDNode::getTemporary(Context, None);
- MDs.push_back(TempNode.get());
+ MDs.push_back(nullptr);
// Remove metadata for the transformation that has been applied or that became
// outdated.