llvm.org GIT mirror llvm / 9dd65de
Revert "[PGO] Value profile for size of memory intrinsic calls" This commit reverts r297897 and r297909. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297951 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Liu 2 years ago
10 changed file(s) with 28 addition(s) and 236 deletion(s). Raw diff Collapse all Expand all
195195
196196 Specify that the input profile is a sample-based profile.
197197
198 .. option:: -memop-sizes
199
200 Show the profiled sizes of the memory intrinsic calls for shown functions.
201
202198 EXIT STATUS
203199 -----------
204200
9393 return INSTR_PROF_VALUE_PROF_FUNC_STR;
9494 }
9595
96 /// Return the name profile runtime entry point to do value range profiling.
97 inline StringRef getInstrProfValueRangeProfFuncName() {
98 return INSTR_PROF_VALUE_RANGE_PROF_FUNC_STR;
99 }
100
10196 /// Return the name of the section containing function coverage mapping
10297 /// data.
10398 inline StringRef getInstrProfCoverageSectionName(bool AddSegment) {
693688
694689 private:
695690 std::vector IndirectCallSites;
696 std::vector MemOPSizes;
697691 const std::vector &
698692
699693 getValueSitesForKind(uint32_t ValueKind) const {
700694 switch (ValueKind) {
701695 case IPVK_IndirectCallTarget:
702696 return IndirectCallSites;
703 case IPVK_MemOPSize:
704 return MemOPSizes;
705697 default:
706698 llvm_unreachable("Unknown value kind!");
707699 }
152152 VALUE_PROF_FUNC_PARAM(uint64_t, TargetValue, Type::getInt64Ty(Ctx)) \
153153 INSTR_PROF_COMMA
154154 VALUE_PROF_FUNC_PARAM(void *, Data, Type::getInt8PtrTy(Ctx)) INSTR_PROF_COMMA
155 #ifndef VALUE_RANGE_PROF
156155 VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx))
157 #else /* VALUE_RANGE_PROF */
158 VALUE_PROF_FUNC_PARAM(uint32_t, CounterIndex, Type::getInt32Ty(Ctx)) \
159 INSTR_PROF_COMMA
160 VALUE_PROF_FUNC_PARAM(uint64_t, PreciseRangeStart, Type::getInt64Ty(Ctx)) \
161 INSTR_PROF_COMMA
162 VALUE_PROF_FUNC_PARAM(uint64_t, PreciseRangeLast, Type::getInt64Ty(Ctx)) \
163 INSTR_PROF_COMMA
164 VALUE_PROF_FUNC_PARAM(uint64_t, LargeValue, Type::getInt64Ty(Ctx))
165 #endif /*VALUE_RANGE_PROF */
166156 #undef VALUE_PROF_FUNC_PARAM
167157 #undef INSTR_PROF_COMMA
168158 /* VALUE_PROF_FUNC_PARAM end */
183173 * name hash and the function address.
184174 */
185175 VALUE_PROF_KIND(IPVK_IndirectCallTarget, 0)
186 /* For memory intrinsic functions size profiling. */
187 VALUE_PROF_KIND(IPVK_MemOPSize, 1)
188176 /* These two kinds must be the last to be
189177 * declared. This is to make sure the string
190178 * array created with the template can be
191179 * indexed with the kind value.
192180 */
193181 VALUE_PROF_KIND(IPVK_First, IPVK_IndirectCallTarget)
194 VALUE_PROF_KIND(IPVK_Last, IPVK_MemOPSize)
182 VALUE_PROF_KIND(IPVK_Last, IPVK_IndirectCallTarget)
195183
196184 #undef VALUE_PROF_KIND
197185 /* VALUE_PROF_KIND end */
660648 #define INSTR_PROF_VALUE_PROF_FUNC __llvm_profile_instrument_target
661649 #define INSTR_PROF_VALUE_PROF_FUNC_STR \
662650 INSTR_PROF_QUOTE(INSTR_PROF_VALUE_PROF_FUNC)
663 #define INSTR_PROF_VALUE_RANGE_PROF_FUNC __llvm_profile_instrument_range
664 #define INSTR_PROF_VALUE_RANGE_PROF_FUNC_STR \
665 INSTR_PROF_QUOTE(INSTR_PROF_VALUE_RANGE_PROF_FUNC)
666651
667652 /* InstrProfile per-function control data alignment. */
668653 #define INSTR_PROF_DATA_ALIGNMENT 8
5858 GlobalVariable *NamesVar;
5959 size_t NamesSize;
6060
61 // The start value of precise value profile range for memory intrinsic sizes.
62 const int64_t DefaultMemOPSizeRangeStart = 0;
63 int64_t MemOPSizeRangeStart;
64 // The end value of precise value profile range for memory intrinsic sizes.
65 const int64_t DefaultMemOPSizeRangeLast = 8;
66 int64_t MemOPSizeRangeLast;
67 int64_t MemOPSizeLargeVal;
68
6961 bool isMachO() const;
7062
7163 /// Get the section name for the counter variables.
116108 /// Create a static initializer for our data, on platforms that need it,
117109 /// and for any profile output file that was specified.
118110 void emitInitialization();
119
120 /// Helper funtion that parsing the MemOPSize value profile options
121 void getMemOPSizeOptions();
122111 };
123112
124113 } // end namespace llvm
7676 // is usually smaller than 2.
7777 cl::init(1.0));
7878
79 cl::opt MemOPSizeRange(
80 "memop-size-range",
81 cl::desc("Set the range of size in memory intrinsic calls to be profiled "
82 "precisely, in a format of :"),
83 cl::init(""));
84 cl::opt MemOPSizeLarge(
85 "memop-size-large",
86 cl::desc("Set large value thresthold in memory intrinsic size profiling. "
87 "Value of 0 disables the large value profiling."),
88 cl::init(8192));
89
9079 class InstrProfilingLegacyPass : public ModulePass {
9180 InstrProfiling InstrProf;
9281
175164 NamesSize = 0;
176165 ProfileDataMap.clear();
177166 UsedVars.clear();
178 getMemOPSizeOptions();
179167
180168 // We did not know how many value sites there would be inside
181169 // the instrumented function. This is counting the number of instrumented
228216 }
229217
230218 static Constant *getOrInsertValueProfilingCall(Module &M,
231 const TargetLibraryInfo &TLI,
232 bool IsRange = false) {
219 const TargetLibraryInfo &TLI) {
233220 LLVMContext &Ctx = M.getContext();
234221 auto *ReturnTy = Type::getVoidTy(M.getContext());
235
236 Constant *Res;
237 if (!IsRange) {
238 Type *ParamTypes[] = {
222 Type *ParamTypes[] = {
239223 #define VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType) ParamLLVMType
240224 #include "llvm/ProfileData/InstrProfData.inc"
241 };
242 auto *ValueProfilingCallTy =
243 FunctionType::get(ReturnTy, makeArrayRef(ParamTypes), false);
244 Res = M.getOrInsertFunction(getInstrProfValueProfFuncName(),
245 ValueProfilingCallTy);
246 } else {
247 Type *RangeParamTypes[] = {
248 #define VALUE_RANGE_PROF 1
249 #define VALUE_PROF_FUNC_PARAM(ParamType, ParamName, ParamLLVMType) ParamLLVMType
250 #include "llvm/ProfileData/InstrProfData.inc"
251 #undef VALUE_RANGE_PROF
252 };
253 auto *ValueRangeProfilingCallTy =
254 FunctionType::get(ReturnTy, makeArrayRef(RangeParamTypes), false);
255 Res = M.getOrInsertFunction(getInstrProfValueRangeProfFuncName(),
256 ValueRangeProfilingCallTy);
257 }
258
225 };
226 auto *ValueProfilingCallTy =
227 FunctionType::get(ReturnTy, makeArrayRef(ParamTypes), false);
228 Constant *Res = M.getOrInsertFunction(getInstrProfValueProfFuncName(),
229 ValueProfilingCallTy);
259230 if (Function *FunRes = dyn_cast(Res)) {
260231 if (auto AK = TLI.getExtAttrForI32Param(false))
261232 FunRes->addAttribute(3, AK);
289260 Index += It->second.NumValueSites[Kind];
290261
291262 IRBuilder<> Builder(Ind);
292 bool IsRange = (Ind->getValueKind()->getZExtValue() ==
293 llvm::InstrProfValueKind::IPVK_MemOPSize);
294 CallInst *Call = nullptr;
295 if (!IsRange) {
296 Value *Args[3] = {Ind->getTargetValue(),
297 Builder.CreateBitCast(DataVar, Builder.getInt8PtrTy()),
298 Builder.getInt32(Index)};
299 Call = Builder.CreateCall(getOrInsertValueProfilingCall(*M, *TLI), Args);
300 } else {
301 Value *Args[6] = {Ind->getTargetValue(),
302 Builder.CreateBitCast(DataVar, Builder.getInt8PtrTy()),
303 Builder.getInt32(Index),
304 Builder.getInt64(MemOPSizeRangeStart),
305 Builder.getInt64(MemOPSizeRangeLast),
306 Builder.getInt64(MemOPSizeLargeVal)};
307 Call =
308 Builder.CreateCall(getOrInsertValueProfilingCall(*M, *TLI, true), Args);
309 }
263 Value *Args[3] = {Ind->getTargetValue(),
264 Builder.CreateBitCast(DataVar, Builder.getInt8PtrTy()),
265 Builder.getInt32(Index)};
266 CallInst *Call = Builder.CreateCall(getOrInsertValueProfilingCall(*M, *TLI),
267 Args);
310268 if (auto AK = TLI->getExtAttrForI32Param(false))
311269 Call->addAttribute(3, AK);
312270 Ind->replaceAllUsesWith(Call);
699657
700658 appendToGlobalCtors(*M, F, 0);
701659 }
702
703 void InstrProfiling::getMemOPSizeOptions() {
704 // Parse the value profile options.
705 MemOPSizeRangeStart = DefaultMemOPSizeRangeStart;
706 MemOPSizeRangeLast = DefaultMemOPSizeRangeLast;
707 if (!MemOPSizeRange.empty()) {
708 auto Pos = MemOPSizeRange.find(":");
709 if (Pos != std::string::npos) {
710 if (Pos > 0)
711 MemOPSizeRangeStart = atoi(MemOPSizeRange.substr(0, Pos).c_str());
712 if (Pos < MemOPSizeRange.size() - 1)
713 MemOPSizeRangeLast = atoi(MemOPSizeRange.substr(Pos + 1).c_str());
714 } else
715 MemOPSizeRangeLast = atoi(MemOPSizeRange.c_str());
716 }
717 assert(MemOPSizeRangeLast >= MemOPSizeRangeStart);
718
719 MemOPSizeLargeVal = MemOPSizeLarge;
720 if (MemOPSizeLargeVal == 0)
721 MemOPSizeLargeVal = INT64_MIN;
722 }
9090
9191 STATISTIC(NumOfPGOInstrument, "Number of edges instrumented.");
9292 STATISTIC(NumOfPGOSelectInsts, "Number of select instruction instrumented.");
93 STATISTIC(NumOfPGOMemIntrinsics, "Number of mem intrinsics instrumented.");
9493 STATISTIC(NumOfPGOEdge, "Number of edges.");
9594 STATISTIC(NumOfPGOBB, "Number of basic-blocks.");
9695 STATISTIC(NumOfPGOSplit, "Number of critical edge splits.");
167166 "-pgo-view-counts. To limit graph "
168167 "display to only one function, use "
169168 "filtering option -view-bfi-func-name."));
170
171 // Command line option to enable/disable memop intrinsic calls..
172 static cl::opt PGOInstrMemOP("pgo-instr-memop", cl::init(true),
173 cl::Hidden);
174169
175170 // Command line option to turn on CFG dot dump after profile annotation.
176171 // Defined in Analysis/BlockFrequencyInfo.cpp: -pgo-view-counts
237232 // Return the number of select instructions. This needs be called after
238233 // countSelects().
239234 unsigned getNumOfSelectInsts() const { return NSIs; }
240 };
241
242 /// Instruction Visitor class to visit memory intrinsic calls.
243 struct MemIntrinsicVisitor : public InstVisitor {
244 Function &F;
245 unsigned NMemIs = 0; // Number of memIntrinsics instrumented.
246 VisitMode Mode = VM_counting; // Visiting mode.
247 unsigned CurCtrId = 0; // Current counter index.
248 unsigned TotalNumCtrs = 0; // Total number of counters
249 GlobalVariable *FuncNameVar = nullptr;
250 uint64_t FuncHash = 0;
251 PGOUseFunc *UseFunc = nullptr;
252
253 MemIntrinsicVisitor(Function &Func) : F(Func) {}
254
255 void countMemIntrinsics(Function &Func) {
256 NMemIs = 0;
257 Mode = VM_counting;
258 visit(Func);
259 }
260 void instrumentMemIntrinsics(Function &Func, unsigned TotalNC,
261 GlobalVariable *FNV, uint64_t FHash) {
262 Mode = VM_instrument;
263 TotalNumCtrs = TotalNC;
264 FuncHash = FHash;
265 FuncNameVar = FNV;
266 visit(Func);
267 }
268
269 // Visit the IR stream and annotate all mem intrinsic call instructions.
270 void instrumentOneMemIntrinsic(MemIntrinsic &MI);
271 // Visit \p MI instruction and perform tasks according to visit mode.
272 void visitMemIntrinsic(MemIntrinsic &SI);
273 unsigned getNumOfMemIntrinsics() const { return NMemIs; }
274235 };
275236
276237 class PGOInstrumentationGenLegacyPass : public ModulePass {
392353 public:
393354 std::vector> ValueSites;
394355 SelectInstVisitor SIVisitor;
395 MemIntrinsicVisitor MIVisitor;
396356 std::string FuncName;
397357 GlobalVariable *FuncNameVar;
398358 // CFG hash value for this function.
423383 bool CreateGlobalVar = false, BranchProbabilityInfo *BPI = nullptr,
424384 BlockFrequencyInfo *BFI = nullptr)
425385 : F(Func), ComdatMembers(ComdatMembers), ValueSites(IPVK_Last + 1),
426 SIVisitor(Func), MIVisitor(Func), FunctionHash(0), MST(F, BPI, BFI) {
386 SIVisitor(Func), FunctionHash(0), MST(F, BPI, BFI) {
427387
428388 // This should be done before CFG hash computation.
429389 SIVisitor.countSelects(Func);
430 MIVisitor.countMemIntrinsics(Func);
431390 NumOfPGOSelectInsts += SIVisitor.getNumOfSelectInsts();
432 NumOfPGOMemIntrinsics += MIVisitor.getNumOfMemIntrinsics();
433391 ValueSites[IPVK_IndirectCallTarget] = findIndirectCallSites(Func);
434392
435393 FuncName = getPGOFuncName(F);
646604 Builder.getInt32(NumIndirectCallSites++)});
647605 }
648606 NumOfPGOICall += NumIndirectCallSites;
649
650 // Now instrument memop intrinsic calls.
651 FuncInfo.MIVisitor.instrumentMemIntrinsics(
652 F, NumCounters, FuncInfo.FuncNameVar, FuncInfo.FunctionHash);
653607 }
654608
655609 // This class represents a CFG edge in profile use compilation.
11211075 llvm_unreachable("Unknown visiting mode");
11221076 }
11231077
1124 void MemIntrinsicVisitor::instrumentOneMemIntrinsic(MemIntrinsic &MI) {
1125 Module *M = F.getParent();
1126 IRBuilder<> Builder(&MI);
1127 Type *Int64Ty = Builder.getInt64Ty();
1128 Type *I8PtrTy = Builder.getInt8PtrTy();
1129 Value *Length = MI.getLength();
1130 assert(!dyn_cast(Length));
1131 Builder.CreateCall(
1132 Intrinsic::getDeclaration(M, Intrinsic::instrprof_value_profile),
1133 {llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy),
1134 Builder.getInt64(FuncHash), Builder.CreatePtrToInt(Length, Int64Ty),
1135 Builder.getInt32(IPVK_MemOPSize), Builder.getInt32(CurCtrId)});
1136 ++CurCtrId;
1137 }
1138
1139 void MemIntrinsicVisitor::visitMemIntrinsic(MemIntrinsic &MI) {
1140 if (!PGOInstrMemOP)
1141 return;
1142 Value *Length = MI.getLength();
1143 // Not instrument constant length calls.
1144 if (dyn_cast(Length))
1145 return;
1146
1147 NMemIs++;
1148 switch (Mode) {
1149 case VM_counting:
1150 return;
1151 case VM_instrument:
1152 instrumentOneMemIntrinsic(MI);
1153 return;
1154 case VM_annotate:
1155 break;
1156 }
1157 llvm_unreachable("Unknown visiting mode");
1158 }
1159
11601078 // Traverse all valuesites and annotate the instructions for all value kind.
11611079 void PGOUseFunc::annotateValueSites() {
11621080 if (DisableValueProfiling)
1414
1515 ; CHECK-NOT: __profn__Z3barIvEvv
1616 ; CHECK: @__profc__Z3barIvEvv = linkonce_odr hidden global [1 x i64] zeroinitializer, section "{{.*}}__llvm_prf_cnts", comdat($__profv__Z3barIvEvv), align 8
17 ; CHECK: @__profd__Z3barIvEvv = linkonce_odr hidden global { i64, i64, i64*, i8*, i8*, i32, [2 x i16] } { i64 4947693190065689389, i64 0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__Z3barIvEvv, i32 0, i32 0), i8*{{.*}}, i8* null, i32 1, [2 x i16] zeroinitializer }, section "{{.*}}__llvm_prf_data{{.*}}", comdat($__profv__Z3barIvEvv), align 8
17 ; CHECK: @__profd__Z3barIvEvv = linkonce_odr hidden global { i64, i64, i64*, i8*, i8*, i32, [1 x i16] } { i64 4947693190065689389, i64 0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__Z3barIvEvv, i32 0, i32 0), i8*{{.*}}, i8* null, i32 1, [1 x i16] zeroinitializer }, section "{{.*}}__llvm_prf_data{{.*}}", comdat($__profv__Z3barIvEvv), align 8
1818 ; CHECK: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}__llvm_prf_names"
1919
2020
2121 ; COFF-NOT: __profn__Z3barIvEvv
2222 ; COFF: @__profc__Z3barIvEvv = linkonce_odr hidden global [1 x i64] zeroinitializer, section "{{.*}}__llvm_prf_cnts", comdat, align 8
23 ; COFF: @__profd__Z3barIvEvv = linkonce_odr hidden global { i64, i64, i64*, i8*, i8*, i32, [2 x i16] } { i64 4947693190065689389, i64 0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__Z3barIvEvv, i32 0, i32 0), i8*{{.*}}, i8* null, i32 1, [2 x i16] zeroinitializer }, section "{{.*}}__llvm_prf_data{{.*}}", comdat($__profc__Z3barIvEvv), align 8
23 ; COFF: @__profd__Z3barIvEvv = linkonce_odr hidden global { i64, i64, i64*, i8*, i8*, i32, [1 x i16] } { i64 4947693190065689389, i64 0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__Z3barIvEvv, i32 0, i32 0), i8*{{.*}}, i8* null, i32 1, [1 x i16] zeroinitializer }, section "{{.*}}__llvm_prf_data{{.*}}", comdat($__profc__Z3barIvEvv), align 8
2424
2525
2626 declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #1
3636 ; DYN-NOT: @__profvp_foo
3737 ; DYN-NOT: @__llvm_prf_vnodes
3838
39 ; STATIC: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 0)
40 ; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 zeroext 0)
41 ; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 signext 0)
39 ; STATIC: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [1 x i16] }* @__profd_foo to i8*), i32 0)
40 ; STATIC-EXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [1 x i16] }* @__profd_foo to i8*), i32 zeroext 0)
41 ; STATIC-SEXT: call void @__llvm_profile_instrument_target(i64 %3, i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [1 x i16] }* @__profd_foo to i8*), i32 signext 0)
4242
4343 ; STATIC: declare void @__llvm_profile_instrument_target(i64, i8*, i32)
4444 ; STATIC-EXT: declare void @__llvm_profile_instrument_target(i64, i8*, i32 zeroext)
1313 ; CHECK: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
1414 ; CHECK-NOT: __profn__stdin__foo
1515 ; CHECK: @__profc__stdin__foo.[[FOO_HASH]] = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", comdat($__profv__stdin__foo.[[FOO_HASH]]), align 8
16 ; CHECK: @__profd__stdin__foo.[[FOO_HASH]] = private global { i64, i64, i64*, i8*, i8*, i32, [2 x i16] } { i64 -5640069336071256030, i64 [[FOO_HASH]], i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__stdin__foo.[[FOO_HASH]], i32 0, i32 0), i8* null
16 ; CHECK: @__profd__stdin__foo.[[FOO_HASH]] = private global { i64, i64, i64*, i8*, i8*, i32, [1 x i16] } { i64 -5640069336071256030, i64 [[FOO_HASH]], i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__stdin__foo.[[FOO_HASH]], i32 0, i32 0), i8* null
1717 ; CHECK-NOT: bitcast (i32 ()* @foo to i8*)
18 ; CHECK-SAME: , i8* null, i32 1, [2 x i16] zeroinitializer }, section "__llvm_prf_data", comdat($__profv__stdin__foo.[[FOO_HASH]]), align 8
18 ; CHECK-SAME: , i8* null, i32 1, [1 x i16] zeroinitializer }, section "__llvm_prf_data", comdat($__profv__stdin__foo.[[FOO_HASH]]), align 8
1919 ; CHECK: @__llvm_prf_nm
2020 ; CHECK: @llvm.used
2121
457457
458458 static void traverseAllValueSites(const InstrProfRecord &Func, uint32_t VK,
459459 ValueSitesStats &Stats, raw_fd_ostream &OS,
460 InstrProfSymtab *Symtab) {
460 InstrProfSymtab &Symtab) {
461461 uint32_t NS = Func.getNumValueSites(VK);
462462 Stats.TotalNumValueSites += NS;
463463 for (size_t I = 0; I < NS; ++I) {
472472 }
473473 for (uint32_t V = 0; V < NV; V++) {
474474 OS << "\t[ " << I << ", ";
475 if (Symtab == nullptr)
476 OS << VD[V].Value;
477 else
478 OS << Symtab->getFuncName(VD[V].Value);
479 OS << ", " << VD[V].Count << " ]\n";
475 OS << Symtab.getFuncName(VD[V].Value) << ", " << VD[V].Count;
476 OS << " ]\n";
480477 }
481478 }
482479 }
496493 }
497494
498495 static int showInstrProfile(const std::string &Filename, bool ShowCounts,
499 bool ShowIndirectCallTargets, bool ShowMemOPSizes,
496 bool ShowIndirectCallTargets,
500497 bool ShowDetailedSummary,
501498 std::vector DetailedSummaryCutoffs,
502499 bool ShowAllFunctions,
549546 OS << " Indirect Call Site Count: "
550547 << Func.getNumValueSites(IPVK_IndirectCallTarget) << "\n";
551548
552 uint32_t NumMemOPCalls = Func.getNumValueSites(IPVK_MemOPSize);
553 if (ShowMemOPSizes && NumMemOPCalls > 0)
554 OS << " Number of Memory Intrinsics Calls: " << NumMemOPCalls
555 << "\n";
556
557549 if (ShowCounts) {
558550 OS << " Block counts: [";
559551 size_t Start = (IsIRInstr ? 0 : 1);
567559 OS << " Indirect Target Results:\n";
568560 traverseAllValueSites(Func, IPVK_IndirectCallTarget,
569561 VPStats[IPVK_IndirectCallTarget], OS,
570 &(Reader->getSymtab()));
571 }
572
573 if (ShowMemOPSizes && NumMemOPCalls > 0) {
574 OS << " Memory Instrinsic Size Results:\n";
575 traverseAllValueSites(Func, IPVK_MemOPSize, VPStats[IPVK_MemOPSize], OS,
576 nullptr);
562 Reader->getSymtab());
577563 }
578564 }
579565 }
588574 OS << "Total functions: " << PS->getNumFunctions() << "\n";
589575 OS << "Maximum function count: " << PS->getMaxFunctionCount() << "\n";
590576 OS << "Maximum internal block count: " << PS->getMaxInternalCount() << "\n";
591
592577 if (ShownFunctions && ShowIndirectCallTargets) {
593578 OS << "Statistics for indirect call sites profile:\n";
594579 showValueSitesStats(OS, IPVK_IndirectCallTarget,
595580 VPStats[IPVK_IndirectCallTarget]);
596 }
597
598 if (ShownFunctions && ShowMemOPSizes) {
599 OS << "Statistics for memory intrinsic calls sizes profile:\n";
600 showValueSitesStats(OS, IPVK_MemOPSize, VPStats[IPVK_MemOPSize]);
601581 }
602582
603583 if (ShowDetailedSummary) {
648628 cl::opt ShowIndirectCallTargets(
649629 "ic-targets", cl::init(false),
650630 cl::desc("Show indirect call site target values for shown functions"));
651 cl::opt ShowMemOPSizes(
652 "memop-sizes", cl::init(false),
653 cl::desc("Show the profiled sizes of the memory intrinsic calls "
654 "for shown functions"));
655631 cl::opt ShowDetailedSummary("detailed-summary", cl::init(false),
656632 cl::desc("Show detailed profile summary"));
657633 cl::list DetailedSummaryCutoffs(
690666 DetailedSummaryCutoffs.end());
691667 if (ProfileKind == instr)
692668 return showInstrProfile(Filename, ShowCounts, ShowIndirectCallTargets,
693 ShowMemOPSizes, ShowDetailedSummary,
694 DetailedSummaryCutoffs, ShowAllFunctions,
695 ShowFunction, TextFormat, OS);
669 ShowDetailedSummary, DetailedSummaryCutoffs,
670 ShowAllFunctions, ShowFunction, TextFormat, OS);
696671 else
697672 return showSampleProfile(Filename, ShowCounts, ShowAllFunctions,
698673 ShowFunction, OS);