[cfe-dev] Question about Clang codegen tests

Jessica Clarke via cfe-dev cfe-dev at lists.llvm.org
Sun Nov 28 08:33:27 PST 2021


On 28 Nov 2021, at 12:11, Florian Hahn via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> Hi,
> 
>> On Nov 27, 2021, at 12:12, Jun <jun at junz.org> wrote:
>> 
>> 
>> Hi,
>> Thanks to all folks that help me, but I'm still a little confused when running `llvm-project/llvm/utils/update_cc_test_checks.py` script. I didn't open a new thread but replied to you directly, hope you won't mind :-)
> 
> Those tests intentionally do not use update_cc_test_checks.py, because Clang without optimizations creates quite a lot redundant IR. The check lines in the test only check the relevant bits for lowering the builtins (where the arguments are coming from and which intrinsic is called). It is probably easiest to just follow the current scheme.

clang -disable-O0-optnone | opt -S -mem2reg is a common pattern for avoiding that issue, if you’re just talking about the naive alloca/load/store CodeGen. There are also Clang tests that use -O1 for similar reasons.

In fact, that pattern produces cleaner IR than is being CHECK’ed today: https://godbolt.org/z/bqoGa6zao

Jess



More information about the cfe-dev mailing list