<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 8, 2016 at 9:02 AM, Adrian Prantl via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br>
Date: Mon Feb 8 11:02:34 2016<br>
New Revision: 260111<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=260111&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=260111&view=rev</a><br>
Log:<br>
Add a unit test for r259973.<br>
<br>
Modified:<br>
llvm/trunk/unittests/IR/MetadataTest.cpp<br>
<br>
Modified: llvm/trunk/unittests/IR/MetadataTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/MetadataTest.cpp?rev=260111&r1=260110&r2=260111&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/MetadataTest.cpp?rev=260111&r1=260110&r2=260111&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/IR/MetadataTest.cpp (original)<br>
+++ llvm/trunk/unittests/IR/MetadataTest.cpp Mon Feb 8 11:02:34 2016<br>
@@ -2073,6 +2073,26 @@ TEST_F(ValueAsMetadataTest, UpdatesOnRAU<br>
EXPECT_TRUE(MD->getValue() == GV1.get());<br>
}<br>
<br>
+TEST_F(ValueAsMetadataTest, TempTempReplacement) {<br>
+ // Create a constant.<br>
+ ConstantAsMetadata *CI = ConstantAsMetadata::get(<br>
+ ConstantInt::get(getGlobalContext(), APInt(8, 0)));<br>
+<br>
+ Metadata *Ops1[] = {CI};<br></blockquote><div><br></div><div>Doesn't seem to be any need to create these named arrays - you could just replace Ops1 with {CI} below, I think?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ auto Temp1 = MDTuple::getTemporary(Context, None);<br>
+ auto Temp2 = MDTuple::getTemporary(Context, Ops1);<br>
+<br>
+ Metadata *Ops2[] = {Temp1.get()};<br>
+ auto *N = MDTuple::get(Context, Ops2);<br>
+<br>
+ // Test replacing a temporary node with another temporary node.<br>
+ Temp1->replaceAllUsesWith(Temp2.get());<br>
+ EXPECT_EQ(N->getOperand(0), Temp2.get());<br>
+<br>
+ // Clean up Temp2 for teardown.<br>
+ Temp2->replaceAllUsesWith(nullptr);<br>
+}<br>
+<br>
TEST_F(ValueAsMetadataTest, CollidingDoubleUpdates) {<br>
// Create a constant.<br>
ConstantAsMetadata *CI = ConstantAsMetadata::get(<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>