[clang] [clang][modules] HeaderSearch::MarkFileModuleHeader creates extra HeaderFileInfo, breaks PCM reuse (PR #89005)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 14:24:36 PDT 2024


sam-mccall wrote:

Thanks for the pointer to 87848 - reverting that one locally doesn't help though, even in combination with applying #89005 and #89428. So this change isn't on the critical path to fixing our builds, but still much appreciated and will take a look now.

---

Unsurprisingly, the builds that hit this limit are big and slow :-)

Here's a reproducer that seems to capture our case well: [modulegen.zip](https://github.com/llvm/llvm-project/files/15045686/modulegen.zip)
`gen.sh` in there creates a bunch of modules under `modules_repro`, `modules_repro/build.sh` builds them with `$CLANG`, and `print.sh` shows the sloc usage.

<details><summary>Good</summary>

```
<stdin>:2:23: remark: source manager location address space usage: [-Rsloc-usage]
    2 | #pragma clang __debug sloc_usage
      |                       ^
note: 14498B in local locations, 1447248B in locations loaded from AST files, for a total of 1461746B (0% of available space)
<built-in>:1:1: note: file entered 202 times using 1451554B of space
    1 | # 1 "<built-in>" 3
      | ^
<stdin>:1:1: note: file entered 1 time using 112B of space
    1 | #include "/usr/local/google/home/sammccall/modulegen/modules_repro/m1/header"
      | ^
```

</details>

<details><summary>Bad</summary>

```
<stdin>:2:23: remark: source manager location address space usage: [-Rsloc-usage]
    2 | #pragma clang __debug sloc_usage
      |                       ^
note: 14537B in local locations, 3956449B in locations loaded from AST files, for a total of 3970986B (0% of available space)
/usr/local/google/home/sammccall/modulegen/modules_repro/constant.modulemap:1:1: note: file entered 100 times using 2505300B of space
    1 | module "constant" {
      | ^
<built-in>:1:1: note: file entered 202 times using 1455493B of space
    1 | # 1 "<built-in>" 3
      | ^
<stdin>:1:1: note: file entered 1 time using 112B of space
    1 | #include "/usr/local/google/home/sammccall/modulegen/modules_repro/m1/header"
```

</details>


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


More information about the cfe-commits mailing list