[all-commits] [llvm/llvm-project] d2f4b7: Use enum comparison instead of generated switch/ca...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Thu May 13 20:37:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d2f4b7d77828dba831f4b7429a7c970d71eb853b
      https://github.com/llvm/llvm-project/commit/d2f4b7d77828dba831f4b7429a7c970d71eb853b
  Author: Reid Kleckner <rnk at google.com>
  Date:   2021-05-13 (Thu, 13 May 2021)

  Changed paths:
    M clang/lib/Sema/SemaDeclAttr.cpp

  Log Message:
  -----------
  Use enum comparison instead of generated switch/case, NFC

Clang's coverage data for auto-generated switch cases is really, really
large. Before this change, when I enable code coverage, SemaDeclAttr.obj
is 4.0GB. Naturally, this fails to link.

Replacing the RISCV builtin id check with a comparison reduces object
file size from 4.0GB to 330MB. Replacing the AArch64 SVE range check
reduces the size again down to 17MB, which is reasonable.

I think the RISCV switch is larger in coverage data because it uses more
levels of macro expansion, while the SVE intrinsics only use one. In any
case, please try to avoid switches with 1000+ cases, they usually don't
optimize well.




More information about the All-commits mailing list