llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangir

Author: Bruno Cardoso Lopes (bcardosolopes)

<details>
<summary>Changes</summary>

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%, all top-5 combined); conversion time on SemaExpr 
fell from 3.28s to 2.66s (-19%).

In landing order, this were all the separate bits necessary to get here:
- #<!-- -->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

---
Full diff: https://github.com/llvm/llvm-project/pull/243162.diff


1 Files Affected:

- (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (+9-1) 


``````````diff
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;
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/243162
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to