[llvm] [DeveloperPolicy] Add guidelines for adding/enabling passes (PR #158591)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 15 05:55:35 PDT 2025


================
@@ -1185,6 +1185,50 @@ Suggested disclaimer for the project README and the main project web page:
    necessarily a reflection of the completeness or stability of the code, it
    does indicate that the project is not yet endorsed as a component of LLVM.
 
+Adding or enabling a new LLVM pass
+----------------------------------
+
+The guidelines here are primarily targeted at the enablement of new major
+passes in the target-independent optimization pipeline. Small additions, or
+backend-specific passes, require a lesser degree of care.
+
+When adding a new pass, the goal should be to enable it as part of the default
+optimization pipeline as early as possible and then continue development
+incrementally. The recommended workflow is:
+
+1. Implement a basic version of the pass and add it to the pass pipeline behind
+   a flag that is disabled by default.
+2. Enable the pass by default. Separating this step allows easily disabling the
+   pass if issues are encountered, without having to revert the entire
+   implementation.
----------------
joker-eph wrote:

This seems implicit, but may be worth making it explicit a bit more: this strategy seems to rely on the first implementation to be "conservative": that is the "basic version" of the pass is about "doing less" but "not miscompiling anything" right?

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


More information about the llvm-commits mailing list