llvm.org GIT mirror llvm / 72c4075
Clean up test case git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265887 91177308-0d34-0410-b5e6-96231b3b80d8 Xinliang David Li 4 years ago
1 changed file(s) with 36 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
201201 delete IPS;
202202 }
203203
204 static const char callee1[] = "callee1";
205 static const char callee2[] = "callee2";
206 static const char callee3[] = "callee3";
207 static const char callee4[] = "callee4";
208 static const char callee5[] = "callee5";
209 static const char callee6[] = "callee6";
210
204211 TEST_P(MaybeSparseInstrProfTest, get_icall_data_read_write) {
205212 InstrProfRecord Record1("caller", 0x1234, {1, 2});
206213 InstrProfRecord Record2("callee1", 0x1235, {3, 4});
209216
210217 // 4 value sites.
211218 Record1.reserveSites(IPVK_IndirectCallTarget, 4);
212 InstrProfValueData VD0[] = {{(uint64_t) "callee1", 1},
213 {(uint64_t) "callee2", 2},
214 {(uint64_t) "callee3", 3}};
219 InstrProfValueData VD0[] = {
220 {(uint64_t)callee1, 1}, {(uint64_t)callee2, 2}, {(uint64_t)callee3, 3}};
215221 Record1.addValueData(IPVK_IndirectCallTarget, 0, VD0, 3, nullptr);
216222 // No value profile data at the second site.
217223 Record1.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
218 InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
219 {(uint64_t) "callee2", 2}};
224 InstrProfValueData VD2[] = {{(uint64_t)callee1, 1}, {(uint64_t)callee2, 2}};
220225 Record1.addValueData(IPVK_IndirectCallTarget, 2, VD2, 2, nullptr);
221 InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
226 InstrProfValueData VD3[] = {{(uint64_t)callee1, 1}};
222227 Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
223228
224229 Writer.addRecord(std::move(Record1));
354359
355360 // 4 value sites.
356361 Record1.reserveSites(IPVK_IndirectCallTarget, 4);
357 InstrProfValueData VD0[] = {{(uint64_t) "callee1", 1},
358 {(uint64_t) "callee2", 2},
359 {(uint64_t) "callee3", 3}};
362 InstrProfValueData VD0[] = {
363 {(uint64_t)callee1, 1}, {(uint64_t)callee2, 2}, {(uint64_t)callee3, 3}};
360364 Record1.addValueData(IPVK_IndirectCallTarget, 0, VD0, 3, nullptr);
361365 // No value profile data at the second site.
362366 Record1.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
363 InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
364 {(uint64_t) "callee2", 2}};
367 InstrProfValueData VD2[] = {{(uint64_t)callee1, 1}, {(uint64_t)callee2, 2}};
365368 Record1.addValueData(IPVK_IndirectCallTarget, 2, VD2, 2, nullptr);
366 InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
369 InstrProfValueData VD3[] = {{(uint64_t)callee1, 1}};
367370 Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
368371
369372 Writer.addRecord(std::move(Record1), 10);
402405
403406 // 4 value sites.
404407 Record1.reserveSites(IPVK_IndirectCallTarget, 4);
405 InstrProfValueData VD0[] = {{(uint64_t) "callee1", 1},
406 {(uint64_t) "callee2", 2},
407 {(uint64_t) "callee3", 3}};
408 InstrProfValueData VD0[] = {
409 {(uint64_t)callee1, 1}, {(uint64_t)callee2, 2}, {(uint64_t)callee3, 3}};
408410 Record1.addValueData(IPVK_IndirectCallTarget, 0, VD0, 3, nullptr);
409411 // No value profile data at the second site.
410412 Record1.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
411 InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
412 {(uint64_t) "callee2", 2}};
413 InstrProfValueData VD2[] = {{(uint64_t)callee1, 1}, {(uint64_t)callee2, 2}};
413414 Record1.addValueData(IPVK_IndirectCallTarget, 2, VD2, 2, nullptr);
414 InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
415 InstrProfValueData VD3[] = {{(uint64_t)callee1, 1}};
415416 Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
416417
417418 Writer.addRecord(std::move(Record1));
448449
449450 TEST_P(MaybeSparseInstrProfTest, get_icall_data_merge1) {
450451 static const char caller[] = "caller";
451 static const char callee1[] = "callee1";
452 static const char callee2[] = "callee2";
453 static const char callee3[] = "callee3";
454 static const char callee4[] = "callee4";
455
456452 InstrProfRecord Record11(caller, 0x1234, {1, 2});
457453 InstrProfRecord Record12(caller, 0x1234, {1, 2});
458454 InstrProfRecord Record2(callee1, 0x1235, {3, 4});
662658 }
663659
664660 // Synthesize runtime value profile data.
665 ValueProfNode Site1Values[5] = {{{uint64_t("callee1"), 400}, &Site1Values[1]},
666 {{uint64_t("callee2"), 1000}, &Site1Values[2]},
667 {{uint64_t("callee3"), 500}, &Site1Values[3]},
668 {{uint64_t("callee4"), 300}, &Site1Values[4]},
669 {{uint64_t("callee5"), 100}, nullptr}};
670
671 ValueProfNode Site2Values[4] = {{{uint64_t("callee5"), 800}, &Site2Values[1]},
672 {{uint64_t("callee3"), 1000}, &Site2Values[2]},
673 {{uint64_t("callee2"), 2500}, &Site2Values[3]},
674 {{uint64_t("callee1"), 1300}, nullptr}};
675
676 ValueProfNode Site3Values[3] = {{{uint64_t("callee6"), 800}, &Site3Values[1]},
677 {{uint64_t("callee3"), 1000}, &Site3Values[2]},
678 {{uint64_t("callee4"), 5500}, nullptr}};
679
680 ValueProfNode Site4Values[2] = {{{uint64_t("callee2"), 1800}, &Site4Values[1]},
681 {{uint64_t("callee3"), 2000}, nullptr}};
661 ValueProfNode Site1Values[5] = {{{uint64_t(callee1), 400}, &Site1Values[1]},
662 {{uint64_t(callee2), 1000}, &Site1Values[2]},
663 {{uint64_t(callee3), 500}, &Site1Values[3]},
664 {{uint64_t(callee4), 300}, &Site1Values[4]},
665 {{uint64_t(callee5), 100}, nullptr}};
666
667 ValueProfNode Site2Values[4] = {{{uint64_t(callee5), 800}, &Site2Values[1]},
668 {{uint64_t(callee3), 1000}, &Site2Values[2]},
669 {{uint64_t(callee2), 2500}, &Site2Values[3]},
670 {{uint64_t(callee1), 1300}, nullptr}};
671
672 ValueProfNode Site3Values[3] = {{{uint64_t(callee6), 800}, &Site3Values[1]},
673 {{uint64_t(callee3), 1000}, &Site3Values[2]},
674 {{uint64_t(callee4), 5500}, nullptr}};
675
676 ValueProfNode Site4Values[2] = {{{uint64_t(callee2), 1800}, &Site4Values[1]},
677 {{uint64_t(callee3), 2000}, nullptr}};
682678
683679 static ValueProfNode *ValueProfNodes[5] = {&Site1Values[0], &Site2Values[0],
684680 &Site3Values[0], &Site4Values[0],