mirror of
https://github.com/intel/llvm.git
synced 2026-02-07 16:11:27 +08:00
[LLD] Do not combine cg_profile from obj and ordering file (#121325)
cg_profile in object is from CGProfilePass and it is often inaccurate. While call-graph-ordering-file is provided by user. It is weird to aggregate them together especially when call-graph-ordering-file is accurate enough.
This commit is contained in:
@@ -2878,10 +2878,10 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
|
||||
// Handle /call-graph-ordering-file and /call-graph-profile-sort (default on).
|
||||
if (config->callGraphProfileSort) {
|
||||
llvm::TimeTraceScope timeScope("Call graph");
|
||||
if (auto *arg = args.getLastArg(OPT_call_graph_ordering_file)) {
|
||||
if (auto *arg = args.getLastArg(OPT_call_graph_ordering_file))
|
||||
parseCallGraphFile(arg->getValue());
|
||||
}
|
||||
readCallGraphsFromObjectFiles(ctx);
|
||||
else
|
||||
readCallGraphsFromObjectFiles(ctx);
|
||||
}
|
||||
|
||||
// Handle /print-symbol-order.
|
||||
|
||||
@@ -3215,11 +3215,12 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
|
||||
|
||||
// Read the callgraph now that we know what was gced or icfed
|
||||
if (ctx.arg.callGraphProfileSort != CGProfileSortKind::None) {
|
||||
if (auto *arg = args.getLastArg(OPT_call_graph_ordering_file))
|
||||
if (auto *arg = args.getLastArg(OPT_call_graph_ordering_file)) {
|
||||
if (std::optional<MemoryBufferRef> buffer =
|
||||
readFile(ctx, arg->getValue()))
|
||||
readCallGraph(ctx, *buffer);
|
||||
readCallGraphsFromObjectFiles<ELFT>(ctx);
|
||||
} else
|
||||
readCallGraphsFromObjectFiles<ELFT>(ctx);
|
||||
}
|
||||
|
||||
// Write the result to the file.
|
||||
|
||||
@@ -46,7 +46,7 @@ Aa:
|
||||
# NO-CG: 140001002 T B
|
||||
# NO-CG: 140001003 T A
|
||||
|
||||
# CG-OBJ-OF: 140001000 T C
|
||||
# CG-OBJ-OF: 140001001 t D
|
||||
# CG-OBJ-OF: 140001002 T A
|
||||
# CG-OBJ-OF: 140001003 T B
|
||||
# CG-OBJ-OF: 140001000 t D
|
||||
# CG-OBJ-OF: 140001001 T A
|
||||
# CG-OBJ-OF: 140001004 T C
|
||||
# CG-OBJ-OF: 140001005 T B
|
||||
@@ -49,7 +49,7 @@ Aa:
|
||||
# NO-CG: 0000000000201122 T B
|
||||
# NO-CG: 0000000000201123 T A
|
||||
|
||||
# CG-OBJ-OF: 0000000000201121 t D
|
||||
# CG-OBJ-OF: 0000000000201120 T C
|
||||
# CG-OBJ-OF: 0000000000201123 T B
|
||||
# CG-OBJ-OF: 0000000000201122 T A
|
||||
# CG-OBJ-OF: 0000000000201120 t D
|
||||
# CG-OBJ-OF: 0000000000201124 T C
|
||||
# CG-OBJ-OF: 0000000000201125 T B
|
||||
# CG-OBJ-OF: 0000000000201121 T A
|
||||
|
||||
Reference in New Issue
Block a user