Enable call-graph-profile-sort for PGO builds.

This currently will affect the Windows and Linux builds. Mac isn't using
LLD and is unaffected by this despite using PGO.

This results in a ~3% perf gain on Speedometer.

One side effect of this change is that we no longer use the explicit
orderfile on Windows, since we now use the PGO profiles for binary
layout. These orderfiles and the associated logic will be removed in a
follow up CL.

Bug: 1113282
Change-Id: I868cbe8202ec3a58bb5e56a534e51590caa07157
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519756
Commit-Queue: S├ębastien Marchand <sebmarchand@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824529}
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 2168672..6f8c779 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -153,7 +153,7 @@
 
   # Turn off the --call-graph-profile-sort flag for lld by default. Enable
   # selectively for targets where it's beneficial.
-  enable_call_graph_profile_sort = false
+  enable_call_graph_profile_sort = chrome_pgo_phase == 2
 }
 
 declare_args() {
@@ -2503,7 +2503,7 @@
   # Use orderfile for linking Chrome on win, android, and Chrome OS.
   # This config enables using an orderfile for linking in LLD.
   config("chrome_orderfile_config") {
-    if (chrome_orderfile_path != "") {
+    if (chrome_orderfile_path != "" && !enable_call_graph_profile_sort) {
       assert(use_lld)
       _rebased_orderfile = rebase_path(chrome_orderfile_path, root_build_dir)
       if (is_android || (is_chromeos && is_chromeos_device)) {