[llvm] [KeyInstr][DwarfDebug] Add is_stmt emission support (PR #133495)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Fri May 9 08:25:47 PDT 2025
================
@@ -2333,6 +2352,170 @@ DwarfDebug::emitInitialLocDirective(const MachineFunction &MF, unsigned CUID) {
return PrologEndLoc;
}
+void DwarfDebug::findKeyInstructions(const MachineFunction *MF) {
+ // New function - reset KeyInstructions.
+ KeyInstructions.clear();
+
+ // The current candidate is_stmt instructions for each source atom.
+ // Map {(InlinedAt, Group): (Rank, Instructions)}.
+ DenseMap<std::pair<DILocation *, uint32_t>,
+ std::pair<uint16_t, SmallVector<const MachineInstr *>>>
+ GroupCandidates;
----------------
OCHyams wrote:
Oh, good point.
Building `X86ISelLowering.cpp` with -O2 -g gives these numbers for `.size()` (at the end of the function, hence some empties):
```
Mean: 1.0316807795462797
Standard Deviation: 0.5124221522830779
Size, Count
0, 3798
1, 77059
2, 3656
3, 565
4, 116
5, 43
6, 17
7, 14
8, 6
9, 78
10, 14
11, 5
12, 2
13, 3
14, 2
15, 1
18, 1
21, 1
24, 1
```
Looking at capacity to account for growing then clearing:
Small size 1:
```
Mean: 1.1314547392338052
Standard Deviation: 0.7145833142818651
Capacity, Count
1, 80836
3, 4241
7, 163
13, 135
14, 2
15, 1
16, 1
18, 1
22, 1
24, 1
```
Small size 2:
```
Mean: 2.044950399962522
Standard Deviation: 0.5464689255410543
Capacity, Count
2, 84507
5, 730
11, 3
13, 135
14, 2
15, 1
16, 1
18, 1
22, 1
24, 1
```
I'll see if compile-time-tracker can help us pick 1 or 2.
https://github.com/llvm/llvm-project/pull/133495
More information about the llvm-commits
mailing list