[llvm] r260111 - Add a unit test for r259973.
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 8 09:02:35 PST 2016
Author: adrian
Date: Mon Feb 8 11:02:34 2016
New Revision: 260111
URL: http://llvm.org/viewvc/llvm-project?rev=260111&view=rev
Log:
Add a unit test for r259973.
Modified:
llvm/trunk/unittests/IR/MetadataTest.cpp
Modified: llvm/trunk/unittests/IR/MetadataTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/MetadataTest.cpp?rev=260111&r1=260110&r2=260111&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/MetadataTest.cpp (original)
+++ llvm/trunk/unittests/IR/MetadataTest.cpp Mon Feb 8 11:02:34 2016
@@ -2073,6 +2073,26 @@ TEST_F(ValueAsMetadataTest, UpdatesOnRAU
EXPECT_TRUE(MD->getValue() == GV1.get());
}
+TEST_F(ValueAsMetadataTest, TempTempReplacement) {
+ // Create a constant.
+ ConstantAsMetadata *CI = ConstantAsMetadata::get(
+ ConstantInt::get(getGlobalContext(), APInt(8, 0)));
+
+ Metadata *Ops1[] = {CI};
+ auto Temp1 = MDTuple::getTemporary(Context, None);
+ auto Temp2 = MDTuple::getTemporary(Context, Ops1);
+
+ Metadata *Ops2[] = {Temp1.get()};
+ auto *N = MDTuple::get(Context, Ops2);
+
+ // Test replacing a temporary node with another temporary node.
+ Temp1->replaceAllUsesWith(Temp2.get());
+ EXPECT_EQ(N->getOperand(0), Temp2.get());
+
+ // Clean up Temp2 for teardown.
+ Temp2->replaceAllUsesWith(nullptr);
+}
+
TEST_F(ValueAsMetadataTest, CollidingDoubleUpdates) {
// Create a constant.
ConstantAsMetadata *CI = ConstantAsMetadata::get(
More information about the llvm-commits
mailing list