Skip to content

Commit 0b352ed

Browse files
committed
[DeveloperPolicy] Add guidelins for adding/enabling passes
1 parent fd4ef8e commit 0b352ed

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

llvm/docs/DeveloperPolicy.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,50 @@ Suggested disclaimer for the project README and the main project web page:
11851185
necessarily a reflection of the completeness or stability of the code, it
11861186
does indicate that the project is not yet endorsed as a component of LLVM.
11871187

1188+
Adding or enabling a new LLVM pass
1189+
----------------------------------
1190+
1191+
The guidelines here are primarily targeted at the enablement of new major
1192+
passes in the target-independent optimization pipeline. Small additions, or
1193+
backend-specific passes, require a lesser degree of care.
1194+
1195+
When adding a new pass, the goal should be to enable it as part of the default
1196+
optimization pipeline as early as possible and then continue development
1197+
incrementally. The recommended workflow is:
1198+
1199+
1. Implement a basic version of the pass and add it to the pass pipeline behind
1200+
a flag that is disabled by default.
1201+
2. Enable the pass by default. Separating this step allows easily disabling the
1202+
pass if issues are encountered, without having to revert the entire
1203+
implementation.
1204+
3. Incrementally extend the pass with new functionality. As the pass is already
1205+
enabled, it becomes easier to identify the specific change that has caused a
1206+
regression in correctness, optimization quality or compile-time.
1207+
1208+
When enabling a pass, regardless of whether it is old or new, certain
1209+
requirements must be met (in no particular order):
1210+
1211+
* **Maintenance:** The pass (and any analyses it depends on) must have at
1212+
least one maintainer.
1213+
* **Usefulness:** There should be evidence that the pass improves performance
1214+
(or whatever metric it optimizes for) on real-world workloads. Improvements
1215+
seen only on synthetic benchmarks may be insufficient.
1216+
* **Compile-Time:** The pass should not have a large impact on compile-time,
1217+
where the evaluation of what "large" means is up to reviewer discretion, and
1218+
may differ based on the value the pass provides. In any case, it is expected
1219+
that a concerted effort has been made to mitigate the compile-time impact,
1220+
both for the average case, and for pathological cases.
1221+
* **Correctness:** The pass should have no known correctness issues (except
1222+
global correctness issues that affect all of LLVM). If an old pass is being
1223+
enabled (rather than implementing a new one incrementally), additional due
1224+
diligence is required. The pass should be fully reviewed to ensure that it
1225+
still complies with current quality standards. Fuzzing with disabled
1226+
profitability checks may help gain additional confidence in the
1227+
implementation.
1228+
1229+
If non-trivial issues are found in a newly enabled pass, it may be temporarily
1230+
disabled again, until the issues have been resolved.
1231+
11881232
.. _copyright-license-patents:
11891233

11901234
Copyright, License, and Patents

0 commit comments

Comments
 (0)