[llvm-dev] CHECK-LABLE or CHECK?

陳韋任 via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 31 05:29:49 PDT 2017


Hi All,

  I came across a FileCheck failure I don't understand why. The
example code below:

    void test1() {
      ... code ...

      // CHECK-LABEL: @test1
      // CHECK: void @llvm.memcpy.p0i8.p0i8.i32 - (1)
    }

    void dummy() {  // make (1) match
      ... code ...

      // CHECK-LABEL: @dummy
    }

    void test2() {
      ... code ...

      // CHECK-LABEL: @test2
      // CHECK: void @llvm.memcpy.p0i8.p0i8.i32
    }

Here what I want to match are the two llvm.memcpy instructions in
function test1 and test2.
If I don't place a dummy function between function test1 and test2,
the first llvm.memcpy won't
match even it indeed emitted (FileCheck says it cannot find the first
llvm.memcpy). However,
if I change to use CHECK instead of CHECK-LABEL, I don't need the
dummy function anymore,
and both llvm.memcpy get matched.

  So my questions are:

    1. when I use CHECK-LABEL, why the first llvm.memcpy cannot be
matched unless I add
        a dummy function?

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

    3. after reading the document [1], I am still not sure when
CHECK-LABEL should/must be used.
        could you exactly point it out?

Thanks.

[1] http://llvm.org/docs/CommandGuide/FileCheck.html

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Homepage: http://people.cs.nctu.edu.tw/~chenwj


More information about the llvm-dev mailing list