My involvement with LLVM 17

LLVM 17 will soon be relased. This post provides a summary of my contributions in this release cycle to record my learning progress.

MC

  • Removed many obsoleted workarounds from the integrated assembler
  • Fixed placement of function entry comments
  • Re-architectured a substantial part of the integrated assembler that is used by RISC-V linker relaxation, fixing some longstanding bugs. See The dark side of RISC-V linker relaxation for detail.

Clang

Driver

  • Made output files more meaningful when combining compilation and linking phases for certain options: -gsplit-dwarf, -ftime-trace, --coverage. See Compiler output files for detail
  • made target-specific option report an error when used with a different target. Previously Clang merely issued warnings like warning: argument unused during compilation: '-msse' [-Wunused-command-line-argument]
  • -fdebug-prefix-map=: made the last win when multiple prefixes match
  • added -mllvm= as an alias for -mllvm
  • Downgraded riscv*- triples to -fdebug-default-version=4 due to linker-relaxation complexity

Others:

Learning plan

I shall learn more about instrumentation related technologies and code generation.

Code review

At the present, LLVM uses a self-hosted Phabricator for code review. I have accepted or rejected 381 Phabricator Differentials revisions (patches) during the 181 days. (I will mention how I get this number later.) I hope that the number is fabulous, considering so many other tasks I have to do at work for bread and butter. Here is an incomplete list:

Future of LLVM code review process

In June 2023, a full disk issue occurred with the server, which led to the rejection of new patch uploads. To address this problem, I expanded the database disk size from 500GB to 600GB, helping to mitigate the issue.

Phabricator is winding down. Maintaining a website with over 600K lines of PHP code is not sustainable. As a result, our community is in need of a suitable replacement and GitHub's pull request system have been selected as the replacement. I belong to the group that shares concerns regarding the quality of GitHub's pull request system, as it utilizes a model that some consider flawed.

GitHub's pull request system tightly couples a pull request with a branch and has a poor commit tracking ability. In short, the system shoehorns into less flexible and less desired workflows.

If commits are reordered or added or removed in the middle of an existing series, the tool can get confused quite easily.

[...]

I have to think will my rewriting history here make re-review harder? [...] This is a textbook example of tooling deficiencies dictating a sub-optimal workflow and outcome: because pull requests don't track commits explicitly, I'm forced to adopt a non-ideal workflow or sacrifice something like commit quality in order to minimize risks that the review tool won't get confused.

That said, ultimately, the individuals investing their efforts will have a significant say in determining the replacement. We that are concerned of GitHub pull will aceept the result, but I hope that the level of harm caused by the less-capable system is deemed acceptable. My primary worries include:

  • Efficient subscription: how do contributors effectively subscribe to patches they are interested in?
  • Review time: will we witness an increase in less prepared patches? Will they consume more time from established reviewers? Or will they be rubber stamped more frequently?
  • Will we have dirty commit messages such as "Fix typo", "Add test", "Resolve XXX's comments"? We can force "Squash and merge" (forbid "Create a merge commit" and "Rebase and merge"), but it is difficult to ensure clean commit messages, if contributors have to think of implications of rewriting history.

Appendix

I did a SQL query to find the numbers of accepted/rejected patches by Phabricator username between the two tags llvmorg-17-init and llvmorg-18-init (181 days), which roughly corresponds to the LLVM 17.x release cycle.

1
select u.username, count(distinct r.lastActionDIffPHID) from differential_reviewer r join phabricator_user.user u where r.reviewerStatus in ('accepted','rejected') and 1674629847<=r.dateCreated and r.dateCreated<1674634847 and r.reviewerPHID=u.phid group by r.reviewerPHID;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
+-----------------------------+--------------------------------------+
| username | count(distinct r.lastActionDIffPHID) |
+-----------------------------+--------------------------------------+
| nikic | 490 |
| MaskRay | 381 |
| arsenm | 367 |
| ldionne | 361 |
| craig.topper | 357 |
| aaron.ballman | 283 |
| jeanPerier | 206 |
| nicolasvasilache | 201 |
| RKSimon | 188 |
| Mordante | 188 |
| JDevlieghere | 186 |
| philnik | 176 |
| vitalybuka | 172 |
| sivachandra | 172 |
| foad | 171 |
| aartbik | 163 |
| ftynse | 162 |
| PeteSteinfeld | 161 |
| rriddle | 157 |
| aprantl | 140 |
| clementval | 139 |
| mehdi_amini | 136 |
| asb | 134 |
| erichkeane | 131 |
| vzakhari | 128 |
| phosek | 121 |
| gysit | 115 |
| reames | 110 |
| efriedma | 108 |
| razvanlupusoru | 107 |
| fhahn | 99 |
| pengfei | 98 |
| kiranchandramohan | 98 |
| lntue | 97 |
| jpienaar | 94 |
| jdoerfert | 94 |
| springerm | 93 |
| bulbazord | 92 |
| jhuber6 | 91 |
| dmgreen | 91 |
| dcaballe | 88 |
| xazax.hun | 88 |
| kadircet | 84 |
| PiotrZSL | 82 |
| mib | 79 |
| MyDeveloperDay | 75 |
| HazardyKnusperkeks | 73 |
| tblah | 71 |
| rafauler | 69 |
| jhenderson | 69 |
| aeubanks | 67 |
| vdonaldson | 67 |
| dblaikie | 64 |
| tra | 62 |
| mkazantsev | 62 |
| ABataev | 62 |
| ChuanqiXu | 62 |
| cferris | 61 |
| cor3ntin | 60 |
| gribozavr2 | 60 |
| michaelrj | 59 |
| shafik | 58 |
| awarzynski | 58 |
| ThomasRaoux | 56 |
| antiagainst | 56 |
| Peiming | 55 |
| JonChesterfield | 55 |
| SixWeining | 54 |
| kuhar | 53 |
| klausler | 53 |
| kito-cheng | 53 |
| hokein | 52 |
| sammccall | 51 |
| paulwalker-arm | 51 |
| rampitec | 50 |
| mstorsjo | 50 |
| Dinistro | 50 |
| carlosgalvezp | 48 |
| ymandel | 48 |
| tianshilei1992 | 48 |
| Mogball | 47 |
| skan | 46 |
| owenpan | 46 |
| xen0n | 45 |
| hans | 44 |
| maksfb | 43 |
| Amir | 43 |
| goldstein.w.n | 43 |
| qcolombet | 42 |
| Ayal | 42 |
| gkistanova | 42 |
| sdesmalen | 40 |
| jmorse | 39 |
| lhames | 39 |
| wenlei | 38 |
| courbet | 38 |
| DavidSpickett | 38 |
| jasonmolenda | 37 |
| tejohnson | 36 |
| benlangmuir | 36 |
| yaxunl | 35 |
| hanchung | 35 |
| tahonermann | 34 |
| peter.smith | 34 |
| dschuff | 33 |
| NoQ | 33 |
| steakhal | 33 |
| EricWF | 32 |
| dvyukov | 31 |
| snehasish | 30 |
| david-arm | 30 |
| Chia-hungDuan | 30 |
| rsuderman | 29 |
| fdeazeve | 29 |
| luke | 29 |
| eric-k256 | 28 |
| aemerson | 28 |
| nickdesaulniers | 28 |
| LuoYuanke | 27 |
| jlebar | 26 |
| mcgrathr | 26 |
| nemanjai | 26 |
| spatel | 25 |
| barannikov88 | 25 |
| clayborg | 24 |
| rnk | 24 |
| tstellar | 23 |
| samtebbs | 23 |
| zero9178 | 22 |
| thieta | 22 |
| jrtc27 | 21 |
| skatkov | 21 |
| lattner | 21 |
| wangpc | 21 |
| jingham | 21 |
| thurston | 21 |
| c-rhodes | 21 |
| myhsu | 21 |
| michaelmaitland | 21 |
| mravishankar | 21 |
| zixuan-wu | 21 |
| K-Wu | 21 |
| nlopes | 20 |
| StephenTozer | 20 |
| rsmith | 20 |
| Joe_Nash | 20 |
...

We have reviewers who are diligent in accepting/rejecting patches, and others who prefer to provide comments rather than changing the state to accepted/blocked. In any case, a big thanks to all those who review code as well as the contributors!