[clang] [CIR] Intitial upstreaming of LibOpt pass (PR #172487)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 16:54:01 PDT 2026


================
@@ -32,8 +32,9 @@ namespace cir {
 mlir::LogicalResult runCIRToCIRPasses(mlir::ModuleOp theModule,
                                       mlir::MLIRContext &mlirCtx,
                                       clang::ASTContext &astCtx,
-                                      bool enableVerifier,
-                                      bool enableCIRSimplify);
+                                      bool enableVerifier, bool enableLibOpt,
----------------
bcardosolopes wrote:

The parameter order here is `(enableVerifier, enableLibOpt, enableCIRSimplify, libOptOptions)` but the implementation in `CIRPasses.cpp` defines them as `(enableVerifier, enableCIRSimplify, enableLibOpt, libOptOptions)`. The bools are swapped between declaration and definition.

It works by accident because the caller's argument order matches the implementation, but this will silently break if anyone writes a new call site following the header's parameter names. Making them consistent would be best.

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


More information about the cfe-commits mailing list