[llvm-branch-commits] Revert "[BOLT] Sort BranchData in DataAggregator" (PR #91289)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 6 19:09:55 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)

<details>
<summary>Changes</summary>

This reverts commit 224e4cc516c747b4096fdbe4f2c8d46005eaaa65.

Sorting invalidated data indices that are used to lookup frequency
information for branch offsets or calls in NamesToBranches map.

Test Plan: updated bolt-address-translation-yaml.test


---
Full diff: https://github.com/llvm/llvm-project/pull/91289.diff


4 Files Affected:

- (modified) bolt/lib/Profile/DataAggregator.cpp (-6) 
- (added) bolt/test/X86/Inputs/blarge_new_bat_order.preagg.txt (+2) 
- (modified) bolt/test/X86/bolt-address-translation-yaml.test (+11) 
- (modified) bolt/test/runtime/X86/fdata-escape-chars.ll (+1-1) 


``````````diff
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index bd96a7865009a9..4f18c402cc3a0e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -641,12 +641,6 @@ void DataAggregator::processProfile(BinaryContext &BC) {
       BF.markProfiled(Flags);
   }
 
-  for (auto &FuncBranches : NamesToBranches)
-    llvm::stable_sort(FuncBranches.second.Data);
-
-  for (auto &MemEvents : NamesToMemEvents)
-    llvm::stable_sort(MemEvents.second.Data);
-
   // Release intermediate storage.
   clear(BranchLBRs);
   clear(FallthroughLBRs);
diff --git a/bolt/test/X86/Inputs/blarge_new_bat_order.preagg.txt b/bolt/test/X86/Inputs/blarge_new_bat_order.preagg.txt
new file mode 100644
index 00000000000000..e4e1f170343c62
--- /dev/null
+++ b/bolt/test/X86/Inputs/blarge_new_bat_order.preagg.txt
@@ -0,0 +1,2 @@
+B 800154 401050 20 0
+F 800159 800193 7
diff --git a/bolt/test/X86/bolt-address-translation-yaml.test b/bolt/test/X86/bolt-address-translation-yaml.test
index f67cc6361c9ef8..c7927f92c9dd95 100644
--- a/bolt/test/X86/bolt-address-translation-yaml.test
+++ b/bolt/test/X86/bolt-address-translation-yaml.test
@@ -15,6 +15,17 @@ BRANCHENTRY-YAML-CHECK:    - name: SolveCubic
 BRANCHENTRY-YAML-CHECK:      bid: 0
 BRANCHENTRY-YAML-CHECK:      hash: 0x700F19D24600000
 BRANCHENTRY-YAML-CHECK-NEXT: succ: [ { bid: 7, cnt: 1 }
+# Check that the order is correct between BAT YAML and FDATA->YAML.
+RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat_order.preagg.txt \
+RUN:   -w %t.yaml -o %t.fdata
+RUN: llvm-bolt %t.exe -data %t.fdata -w %t.yaml-fdata -o %t.null
+RUN: FileCheck --input-file %t.yaml --check-prefix ORDER-YAML-CHECK %s
+RUN: FileCheck --input-file %t.yaml-fdata --check-prefix ORDER-YAML-CHECK %s
+ORDER-YAML-CHECK:    - name: SolveCubic
+ORDER-YAML-CHECK:      bid: 3
+ORDER-YAML-CHECK:      hash: 0xDDA1DC5F69F900AC
+ORDER-YAML-CHECK-NEXT: calls: [ { off: 0x26, fid: [[#]], cnt: 20 } ]
+ORDER-YAML-CHECK-NEXT: succ: [ { bid: 5, cnt: 7 }
 # Large profile test
 RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat.preagg.txt -w %t.yaml -o %t.fdata \
 RUN:   2>&1 | FileCheck --check-prefix READ-BAT-CHECK %s
diff --git a/bolt/test/runtime/X86/fdata-escape-chars.ll b/bolt/test/runtime/X86/fdata-escape-chars.ll
index 4ea781ad184be1..a5be4e4eb13479 100644
--- a/bolt/test/runtime/X86/fdata-escape-chars.ll
+++ b/bolt/test/runtime/X86/fdata-escape-chars.ll
@@ -88,8 +88,8 @@ define internal void @static_symb_backslash_b() #0 {
 ; INSTR_CHECK: {{([[:xdigit:]]+)}}:   callq   "symb whitespace" # Count: 1
 
 ; PREAGR_FDATA_CHECK: 1 main 0 1 static\ symb\ backslash\\/1 0 0 1
-; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ backslash\\ 0 0 2
 ; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ whitespace 0 0 1
+; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ backslash\\ 0 0 2
 ; PREAGR_FDATA_CHECK: 1 static\ symb\ backslash\\/1 0 1 symb\ whitespace 0 0 1
 ; PREAGR_FDATA_CHECK: 1 symb\ backslash\\ 0 1 symb\ whitespace 0 0 2
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/91289


More information about the llvm-branch-commits mailing list