<div dir="ltr">LGTM. Thanks for the fix.<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 26, 2015 at 10:18 PM, NAKAMURA Takumi 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: chapuni<br>
Date: Sun Dec 27 00:18:57 2015<br>
New Revision: 256459<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=256459&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=256459&view=rev</a><br>
Log:<br>
InstrProfTest.cpp: Don't assume string literals are always merged.<br>
<br>
MSC18 Debug didn't merge them.<br>
<br>
FIXME: I tweaked just to appease a builder. Almost string literals should be addressed identically there.<br>
<br>
Modified:<br>
llvm/trunk/unittests/ProfileData/InstrProfTest.cpp<br>
<br>
Modified: llvm/trunk/unittests/ProfileData/InstrProfTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ProfileData/InstrProfTest.cpp?rev=256459&r1=256458&r2=256459&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ProfileData/InstrProfTest.cpp?rev=256459&r1=256458&r2=256459&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/ProfileData/InstrProfTest.cpp (original)<br>
+++ llvm/trunk/unittests/ProfileData/InstrProfTest.cpp Sun Dec 27 00:18:57 2015<br>
@@ -226,57 +226,63 @@ TEST_F(InstrProfTest, get_icall_data_rea<br>
}<br>
<br>
TEST_F(InstrProfTest, get_icall_data_merge1) {<br>
- InstrProfRecord Record11("caller", 0x1234, {1, 2});<br>
- InstrProfRecord Record12("caller", 0x1234, {1, 2});<br>
- InstrProfRecord Record2("callee1", 0x1235, {3, 4});<br>
- InstrProfRecord Record3("callee2", 0x1235, {3, 4});<br>
- InstrProfRecord Record4("callee3", 0x1235, {3, 4});<br>
- InstrProfRecord Record5("callee3", 0x1235, {3, 4});<br>
- InstrProfRecord Record6("callee4", 0x1235, {3, 5});<br>
+ static const char caller[] = "caller";<br>
+ static const char callee1[] = "callee1";<br>
+ static const char callee2[] = "callee2";<br>
+ static const char callee3[] = "callee3";<br>
+ static const char callee4[] = "callee4";<br>
+<br>
+ InstrProfRecord Record11(caller, 0x1234, {1, 2});<br>
+ InstrProfRecord Record12(caller, 0x1234, {1, 2});<br>
+ InstrProfRecord Record2(callee1, 0x1235, {3, 4});<br>
+ InstrProfRecord Record3(callee2, 0x1235, {3, 4});<br>
+ InstrProfRecord Record4(callee3, 0x1235, {3, 4});<br>
+ InstrProfRecord Record5(callee3, 0x1235, {3, 4});<br>
+ InstrProfRecord Record6(callee4, 0x1235, {3, 5});<br>
<br>
// 5 value sites.<br>
Record11.reserveSites(IPVK_IndirectCallTarget, 5);<br>
- InstrProfValueData VD0[] = {{(uint64_t) "callee1", 1},<br>
- {(uint64_t) "callee2", 2},<br>
- {(uint64_t) "callee3", 3},<br>
- {(uint64_t) "callee4", 4}};<br>
+ InstrProfValueData VD0[] = {{uint64_t(callee1), 1},<br>
+ {uint64_t(callee2), 2},<br>
+ {uint64_t(callee3), 3},<br>
+ {uint64_t(callee4), 4}};<br>
Record11.addValueData(IPVK_IndirectCallTarget, 0, VD0, 4, nullptr);<br>
<br>
// No valeu profile data at the second site.<br>
Record11.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);<br>
<br>
- InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},<br>
- {(uint64_t) "callee2", 2},<br>
- {(uint64_t) "callee3", 3}};<br>
+ InstrProfValueData VD2[] = {{uint64_t(callee1), 1},<br>
+ {uint64_t(callee2), 2},<br>
+ {uint64_t(callee3), 3}};<br>
Record11.addValueData(IPVK_IndirectCallTarget, 2, VD2, 3, nullptr);<br>
<br>
- InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};<br>
+ InstrProfValueData VD3[] = {{uint64_t(callee1), 1}};<br>
Record11.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);<br>
<br>
- InstrProfValueData VD4[] = {{(uint64_t) "callee1", 1},<br>
- {(uint64_t) "callee2", 2},<br>
- {(uint64_t) "callee3", 3}};<br>
+ InstrProfValueData VD4[] = {{uint64_t(callee1), 1},<br>
+ {uint64_t(callee2), 2},<br>
+ {uint64_t(callee3), 3}};<br>
Record11.addValueData(IPVK_IndirectCallTarget, 4, VD4, 3, nullptr);<br>
<br>
// A differnt record for the same caller.<br>
Record12.reserveSites(IPVK_IndirectCallTarget, 5);<br>
- InstrProfValueData VD02[] = {{(uint64_t) "callee2", 5},<br>
- {(uint64_t) "callee3", 3}};<br>
+ InstrProfValueData VD02[] = {{uint64_t(callee2), 5},<br>
+ {uint64_t(callee3), 3}};<br>
Record12.addValueData(IPVK_IndirectCallTarget, 0, VD02, 2, nullptr);<br>
<br>
// No valeu profile data at the second site.<br>
Record12.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);<br>
<br>
- InstrProfValueData VD22[] = {{(uint64_t) "callee2", 1},<br>
- {(uint64_t) "callee3", 3},<br>
- {(uint64_t) "callee4", 4}};<br>
+ InstrProfValueData VD22[] = {{uint64_t(callee2), 1},<br>
+ {uint64_t(callee3), 3},<br>
+ {uint64_t(callee4), 4}};<br>
Record12.addValueData(IPVK_IndirectCallTarget, 2, VD22, 3, nullptr);<br>
<br>
Record12.addValueData(IPVK_IndirectCallTarget, 3, nullptr, 0, nullptr);<br>
<br>
- InstrProfValueData VD42[] = {{(uint64_t) "callee1", 1},<br>
- {(uint64_t) "callee2", 2},<br>
- {(uint64_t) "callee3", 3}};<br>
+ InstrProfValueData VD42[] = {{uint64_t(callee1), 1},<br>
+ {uint64_t(callee2), 2},<br>
+ {uint64_t(callee3), 3}};<br>
Record12.addValueData(IPVK_IndirectCallTarget, 4, VD42, 3, nullptr);<br>
<br>
Writer.addRecord(std::move(Record11));<br>
@@ -351,6 +357,8 @@ TEST_F(InstrProfTest, get_icall_data_mer<br>
}<br>
<br>
TEST_F(InstrProfTest, get_icall_data_merge1_saturation) {<br>
+ static const char bar[] = "bar";<br>
+<br>
const uint64_t Max = std::numeric_limits<uint64_t>::max();<br>
<br>
InstrProfRecord Record1("foo", 0x1234, {1});<br>
@@ -362,13 +370,13 @@ TEST_F(InstrProfTest, get_icall_data_mer<br>
auto Result2 = Writer.addRecord(std::move(Record2));<br>
ASSERT_EQ(Result2, instrprof_error::counter_overflow);<br>
<br>
- InstrProfRecord Record3("bar", 0x9012, {8});<br>
+ InstrProfRecord Record3(bar, 0x9012, {8});<br>
auto Result3 = Writer.addRecord(std::move(Record3));<br>
ASSERT_EQ(Result3, instrprof_error::success);<br>
<br>
InstrProfRecord Record4("baz", 0x5678, {3, 4});<br>
Record4.reserveSites(IPVK_IndirectCallTarget, 1);<br>
- InstrProfValueData VD4[] = {{(uint64_t) "bar", 1}};<br>
+ InstrProfValueData VD4[] = {{uint64_t(bar), 1}};<br>
Record4.addValueData(IPVK_IndirectCallTarget, 0, VD4, 1, nullptr);<br>
auto Result4 = Writer.addRecord(std::move(Record4));<br>
ASSERT_EQ(Result4, instrprof_error::success);<br>
@@ -376,7 +384,7 @@ TEST_F(InstrProfTest, get_icall_data_mer<br>
// Verify value data counter overflow.<br>
InstrProfRecord Record5("baz", 0x5678, {5, 6});<br>
Record5.reserveSites(IPVK_IndirectCallTarget, 1);<br>
- InstrProfValueData VD5[] = {{(uint64_t) "bar", Max}};<br>
+ InstrProfValueData VD5[] = {{uint64_t(bar), Max}};<br>
Record5.addValueData(IPVK_IndirectCallTarget, 0, VD5, 1, nullptr);<br>
auto Result5 = Writer.addRecord(std::move(Record5));<br>
ASSERT_EQ(Result5, instrprof_error::counter_overflow);<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>