[PATCH] D18568: [PGO] Use ArrayRef in annotateValueSite()

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 12:57:08 PDT 2016


silvas added a comment.

Thank! LGTM. A couple minor suggestions inline.


================
Comment at: lib/ProfileData/InstrProf.cpp:631
@@ -629,3 +630,3 @@
   uint32_t MDCount = MaxMDCount;
-  for (uint32_t I = 0; I < NV; ++I) {
+  for (auto &I : VDArrayRef) {
     Vals.push_back(MDHelper.createConstant(
----------------
Would `VD` be a better name instead of `I`?

================
Comment at: unittests/ProfileData/InstrProfTest.cpp:334
@@ +333,3 @@
+  ArrayRef<InstrProfValueData> VDArrayRef(VD0Sorted, 6);
+  annotateValueSite(*M, *Inst, VDArrayRef.slice(2), 10, IPVK_IndirectCallTarget,
+                    5);
----------------
I believe this can be just `makeArrayRef(VD0Sorted).slice(2)` without introducing the temporary or having to explicitly give a size.


http://reviews.llvm.org/D18568





More information about the llvm-commits mailing list