[cfe-dev] Clang codegen tests and LLVM passes
Reid Kleckner via cfe-dev
cfe-dev at lists.llvm.org
Mon Sep 16 11:19:07 PDT 2019
On Mon, Sep 16, 2019 at 11:03 AM Roman Lebedev via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> This was brought up several times now, but looks like it needs to be
> mentioned more globally. Clang has many (~1516) front-end codegen tests.
> Out of those tests, 364 tests are likely "broken":
> $ clang/test$ grep -rl " -O[1-3]" | wc -l
It's an issue, but it's not as bad as that. Many tests use `-O1
-disable-llvm-passes` to get "optimized" IR output from clang which is
slightly different. This matters for lifetime markers, for example.
I tried this query and got these results:
$ git grep -l " -O[1-3]" ../clang/test | xargs grep -L -l ' -disable' | wc
So, 99/~1516 -> ~6.5% tests use the bad pattern. Some of the tests are
truly integration tests, checking that clang emits an IR pattern that LLVM
can optimize, but I think most are not.
I think the real issue here is that writing CHECK lines for clang's IR
output is a pain, so people lean on the optimizer to clean up the IR first
so they can match something that's more logical. If we did something to
improve that, the situation wouldn't be as bad.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev