https://github.com/bcardosolopes updated https://github.com/llvm/llvm-project/pull/243162
>From 077ce30d841a48b9ef35606b1033afb52b504246 Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes <[email protected]> Date: Mon, 16 Nov 2026 06:20:24 -0800 Subject: [PATCH] [CIR] Convert CIR to LLVM in one shot Convert CIR to LLVM with pattern rollback disabled, so rewrites materialize immediately. This is the last of the three conversions to flip; the earlier passes already run without rollback. Measured on the compile-time investigations branch (3-run serial medians, five slow translation units), flipping only this conversion cut the CIR-vs-plain gap from 81.4s to 73.3s (-10%); conversion time on SemaExpr fell from 3.28s to 2.66s (-19%). Prerequisites, in landing order: - #232510: switch.flat successor operands - #235196: NFC preparation for one-shot conversion - #238691: CXXABI and target lowering without rollback - #238698: global types visible across replacements - #241645: fold constant int/bool casts - #242111: AMDGPU printf constant-string annotation Assisted-by: Muse Code (Muse). --- clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp index df5faa62b4e59..80c71c4e39115 100644 --- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp +++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp @@ -5265,7 +5265,15 @@ void ConvertCIRToLLVMPass::runOnOperation() { ops.push_back(module); cir::collectUnreachable(module, ops); - if (failed(applyPartialConversion(ops, target, std::move(patterns)))) { + // One-shot conversion (no pattern rollback): rewrites materialize + // immediately, skipping the IRRewrite/value-mapping bookkeeping. The + // CIR patterns here are compatible: nothing dereferences the root op + // after replacement, and the cached symbol table is maintained + // explicitly at every module-symbol replacement. + mlir::ConversionConfig config; + config.allowPatternRollback = false; + if (failed( + applyPartialConversion(ops, target, std::move(patterns), config))) { signalPassFailure(); return; } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
