[PATCH] D95924: [Example][NFC} Add testcase for BrainF HelloWorld

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 02:25:08 PST 2021


t.p.northover added a comment.

The two programs are identical, right? If so, you can put more than one `RUN` line in a single file to test it. Then use `FileCheck --check-prefix=EXEC %s`, `EXEC: Hello World!`.



================
Comment at: llvm/test/Examples/BrainF/HelloWorld.ll:10
+# CHECK-NEXT:        %tape = load i8, i8* %head, align 1
+
+# CHECK:             store i8 %tape2, i8* %head, align 1
----------------
xgupta wrote:
>  %tape2 = add i8 %tape, 8
> This line I also want to check here but don't how to write regex expression in FileCheck syntax. So after adding this check starts failing.
Why does it need to be a regex when none of the other lines are?

Either way, a single-use regex in FileCheck is surrounded by double curly-braces: `{{.*}}`.

If you want to capture it to check against later code, you use double brackets. You often see something like:

    [[TAPE:%.*]] = load i8
    [[TAPE2:%.*]] = add i8 [[TAPE]], 8

which would remember what the load got called and make sure the next line used the same SSA variable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95924/new/

https://reviews.llvm.org/D95924



More information about the llvm-commits mailing list