forked from OSchip/llvm-project
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:
parent
1e51e238ed
commit
d1474eea71
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue