This is an archive of the discontinued LLVM Phabricator instance.

[clang][Serialization][RISCV] Increase the number of reserved predefined type IDs
ClosedPublic

Authored by rogfer01 on Jun 16 2023, 12:48 AM.

Details

Summary

In D152070 we added many new intrinsic types required for the RISC-V Vector Extension.

This was crashing when loading the AST as those types are intrinsically added to the AST (they don't come from the disk).

$ touch t.c
$ clang -cc1 -triple riscv64 -w -emit-pch -o test.pch t.c
$ clang -cc1 -triple riscv64 -w -x c -include-pch test.pch -ast-dump-all /dev/null

The total number required now by clang goes far beyond 300 so increasing the value to 500 solves the problem. This value was already increased in D92715 but I assume this has some impact on the on-disk format.

Diff Detail

Event Timeline

rogfer01 created this revision.Jun 16 2023, 12:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2023, 12:48 AM
rogfer01 requested review of this revision.Jun 16 2023, 12:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2023, 12:48 AM
rogfer01 edited the summary of this revision. (Show Details)Jun 16 2023, 12:53 AM

Let me check if I can add a static_assert to get a compile-time failure.

rogfer01 updated this revision to Diff 532061.Jun 16 2023, 2:40 AM

ChangeLog:

  • Add a sentinel and a static_assert
eopXD accepted this revision.Jun 16 2023, 2:54 AM

This change looks good to me. Weird that the error did not pop out on my side.

This revision is now accepted and ready to land.Jun 16 2023, 2:54 AM

I also caught this issue.

Thanks @eopXD. Not sure why you didn't observe the failure. I understand your build has -DLLVM_ENABLE_ASSERTIONS=ON.

I investigated a bit the libcxx errors flagged by the precommit CI. I can get similar (but not exactly the same errors) if the build before this change is -DLLVM_ENABLE_PROJECTS=clang -DLLVM_ENABLE_RUNTIMES=libcxx, then I apply this change and then I run libcxx tests: several precompiled headers become stale after this change and would need to be rebuilt. Starting from a clean build directory avoids this issue.

I want to do a few more checks locally before committing. Sorry for the delay.

rogfer01 updated this revision to Diff 532546.Jun 19 2023, 12:07 AM

ChangeLog:

  • Update clang tests that now, on RISC-V only, observe a larger precompiled module file
This revision was landed with ongoing or failed builds.Jun 19 2023, 7:41 AM
This revision was automatically updated to reflect the committed changes.