[PATCH] LLVM changes for indirect call target profiling support

Betul Buyukkurt betulb at codeaurora.org
Tue May 19 11:10:42 PDT 2015


================
Comment at: lib/Transforms/Instrumentation/InstrProfiling.cpp:58
@@ +57,3 @@
+    PerFunctionProfileData() : RegionCounters(nullptr), DataVar(nullptr) {
+      NumValueSites[instr_value_prof_kind::last-1] = {0};
+    }
----------------
davidxl wrote:
> use memset.
Done.

================
Comment at: lib/Transforms/Instrumentation/InstrProfiling.cpp:138
@@ -122,1 +137,3 @@
 
+  // We did not know how many value sites there would be inside
+  // the instrumented function. This is counting the number of instrumented
----------------
davidxl wrote:
> Can this loop merged with the LowerInstrumentTargetInst loop below? The later does not seem to depend on NumvalueSites value which is used at runtime.
Unfortunately not. NumValueSites is incremented per value profiling intrinsic detected in IR. The final value of NumValueSites is used in the subsequent loop to create the ProfileData (i.e. DataVar member of ProfileDataMap struct) members.

In the final loop, InstrProfInstrumentTargetInst is lowered to a runtime call that takes a pointer to the ProfileData as an argument.

================
Comment at: lib/Transforms/Instrumentation/InstrProfiling.cpp:320
@@ +319,3 @@
+      ConstantExpr::getBitCast(Inc->getParent()->getParent(), Int8PtrTy),
+      ConstantInt::get(Int32Ty,
+        PD.NumValueSites[instr_value_prof_kind::indirect_call_target]),
----------------
davidxl wrote:
> Reserve space for future kinds.
Done.

http://reviews.llvm.org/D8908

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list