llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Fangrui Song (MaskRay)

<details>
<summary>Changes</summary>

clangCIR reuses clangAST's precompiled header, so each of its 54 files
reparses the MLIR and CIR dialect headers. Add a private PCH like
clangCodeGen's (#<!-- -->206018).

Rebuilding clangCIR (Release+Asserts, 28 threads):

```
              summed per-file   user CPU   wall
before        312 s             282 s      20.0 s
after         79 s + 6 s PCH    78 s       18.1 s
```

LLM-aided

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


2 Files Affected:

- (modified) clang/lib/CIR/CodeGen/CMakeLists.txt (+4) 
- (added) clang/lib/CIR/CodeGen/pch.h (+23) 


``````````diff
diff --git a/clang/lib/CIR/CodeGen/CMakeLists.txt 
b/clang/lib/CIR/CodeGen/CMakeLists.txt
index 1b5c0b91b394e..6d84faf70d11d 100644
--- a/clang/lib/CIR/CodeGen/CMakeLists.txt
+++ b/clang/lib/CIR/CodeGen/CMakeLists.txt
@@ -61,6 +61,10 @@ add_clang_library(clangCIR
   Targets/NVPTX.cpp
   Targets/SPIRV.cpp
 
+  DISABLE_PCH_REUSE # PCH contains private headers
+  PRECOMPILE_HEADERS
+  [["pch.h"]]
+
   DEPENDS
   MLIRCIR
   MLIRCIROpInterfacesIncGen
diff --git a/clang/lib/CIR/CodeGen/pch.h b/clang/lib/CIR/CodeGen/pch.h
new file mode 100644
index 0000000000000..ab52fad5468ff
--- /dev/null
+++ b/clang/lib/CIR/CodeGen/pch.h
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// Precompiled header for clangCIR. Uses private headers.
+///
+//===----------------------------------------------------------------------===//
+
+#include "CIRGenBuilder.h"
+#include "CIRGenCXXABI.h"
+#include "CIRGenFunction.h"
+#include "CIRGenModule.h"
+#include "CIRGenValue.h"
+#include "clang/AST/pch.h"
+#include "clang/CIR/Dialect/IR/CIRDialect.h"
+#include "clang/CIR/MissingFeatures.h"
+#include "mlir/IR/pch.h"
+#include "llvm/IR/pch.h"
+#include "llvm/Support/pch.h"

``````````

</details>


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

Reply via email to