Change the return of `MDNode::isDistinct()` for `MDNode::getTemporary()`
to `true`. They aren't uniqued.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225646
91177308-0d34-0410-b5e6-
96231b3b80d8
///
/// Distinct nodes are not uniqued, and will not be returned by \a
/// MDNode::get().
- bool isDistinct() const { return IsDistinctInContext; }
+ bool isDistinct() const {
+ return isStoredDistinctInContext() || isa<MDNodeFwdDecl>(this);
+ }
protected:
/// \brief Set an operand.
ASSERT_EQ(Empty, MDNode::get(Context, None));
}
+TEST_F(MDNodeTest, TempIsDistinct) {
+ MDNode *T = MDNode::getTemporary(Context, None);
+ EXPECT_TRUE(T->isDistinct());
+ MDNode::deleteTemporary(T);
+}
+
TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
// temporary !{}
MDNodeFwdDecl *Temp = MDNode::getTemporary(Context, None);