[PATCH] D16015: [PGO] Create the profile data variable before the lowering
Rong Xu via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 19 10:35:48 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL258156: [PGO] Create the profile data variable before the lowering (authored by xur).
Changed prior to commit:
http://reviews.llvm.org/D16015?vs=45033&id=45283#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16015
Files:
llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
Index: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -137,11 +137,20 @@
// We did not know how many value sites there would be inside
// the instrumented function. This is counting the number of instrumented
// target value sites to enter it as field in the profile data variable.
- for (Function &F : M)
+ for (Function &F : M) {
+ InstrProfIncrementInst *FirstProfIncInst = nullptr;
for (BasicBlock &BB : F)
- for (auto I = BB.begin(), E = BB.end(); I != E;)
- if (auto *Ind = dyn_cast<InstrProfValueProfileInst>(I++))
+ for (auto I = BB.begin(), E = BB.end(); I != E; I++)
+ if (auto *Ind = dyn_cast<InstrProfValueProfileInst>(I))
computeNumValueSiteCounts(Ind);
+ else if (FirstProfIncInst == nullptr)
+ FirstProfIncInst = dyn_cast<InstrProfIncrementInst>(I);
+
+ // Value profiling intrinsic lowering requires per-function profile data
+ // variable to be created first.
+ if (FirstProfIncInst != nullptr)
+ static_cast<void>(getOrCreateRegionCounters(FirstProfIncInst));
+ }
for (Function &F : M)
for (BasicBlock &BB : F)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16015.45283.patch
Type: text/x-patch
Size: 1339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160119/ca3aa021/attachment.bin>
More information about the llvm-commits
mailing list