[llvm-dev] CHECK-LABLE or CHECK?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 31 06:40:39 PDT 2017


Hi,

CHECK-LABEL splits up the output into chunks before applying the rest
of the CHECKs. This has a couple of benefits for testing:

1. Used carefully you can make sure FileCheck is looking at the right
part of the output for the rest of your test (e.g. not in a completely
different function).

2. If there are multiple errors FileCheck will tell you about one of
them per block rather than just stopping at the first error in the
file.

On 31 March 2017 at 05:29, 陳韋任 via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>     1. when I use CHECK-LABEL, why the first llvm.memcpy cannot be
> matched unless I add a dummy function?

We'd need to see the real .ll file to be sure. Typically this happens
because the CHECK-LABEL is picking up an earlier reference to its
string than the one you intend.

For example if @test1 called @test2 before doing its memcpy, the first
block would end at that call rather than at the definition of @test2.
You can probably fix this by including more context in the CHECK-LABEL
lines. Maybe something like "CHECK-LABEL: define void @test1".

>     2. why the problem gone if I change to use CHECK?

In that case the whole file is checked at once. The "CHECK: @test2"
line won't be picking up what you think it is, but there's still a
memcpy afterwards so it works.

Cheers.

Tim.


More information about the llvm-dev mailing list