diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2022-05-24 16:56:22 -0700 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2022-05-26 11:05:15 -0700 |
commit | ce54b22657f01d1c40de4941ceb6e7119848aecf (patch) | |
tree | d3b95e3df50eb0fcac295b96a600cde0a115761b /llvm/lib/CodeGen/MachineCopyPropagation.cpp | |
parent | f15c60218d5c88c9f32942bce119e7ac25cb6d73 (diff) | |
download | llvm-ce54b22657f01d1c40de4941ceb6e7119848aecf.zip llvm-ce54b22657f01d1c40de4941ceb6e7119848aecf.tar.gz llvm-ce54b22657f01d1c40de4941ceb6e7119848aecf.tar.bz2 |
[Clang][CoverageMapping] Fix switch counter codegen compile time explosion
C++ generated code with huge amount of switch cases chokes badly while emitting
coverage mapping, in our specific testcase (~72k cases), it won't stop after hours.
After this change, the frontend job now finishes in 4.5s and shrinks down `@__covrec_`
by 288k when compared to disabling simplification altogether.
There's probably no good way to create a testcase for this, but it's easy to
reproduce, just add thousands of cases in the below switch, and build with
`-fprofile-instr-generate -fcoverage-mapping`.
```
enum type : int {
FEATURE_INVALID = 0,
FEATURE_A = 1,
...
};
const char *to_string(type e) {
switch (e) {
case type::FEATURE_INVALID: return "FEATURE_INVALID";
case type::FEATURE_A: return "FEATURE_A";}
...
}
```
Differential Revision: https://reviews.llvm.org/D126345
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
0 files changed, 0 insertions, 0 deletions