IR: Make temporary nodes distinct

Change the return of `MDNode::isDistinct()` for `MDNode::getTemporary()`
to `true`.  They aren't uniqued.

llvm-svn: 225646
This commit is contained in:
Duncan P. N. Exon Smith 2015-01-12 18:41:26 +00:00
parent 1e51e238ed
commit d1474eea71
2 changed files with 9 additions and 1 deletions

View File

@ -651,7 +651,9 @@ public:
///
/// 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.

View File

@ -269,6 +269,12 @@ TEST_F(MDNodeTest, getDistinct) {
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);