Stream: t-compiler

Topic: checking attr labels


gnzlbg (Feb 10 2019 at 10:06, on Zulip):

@nagisa CHECK-LABEL does not allow binding variables

gnzlbg (Feb 10 2019 at 10:06, on Zulip):

so I need a CHECK AFAICT

nagisa (Feb 10 2019 at 10:07, on Zulip):
// CHECK-LABEL @foo
// CHECK-SAME [[FOO_ATTRIBUTE:#[0-9]+]]

then

gnzlbg (Feb 10 2019 at 10:07, on Zulip):

but then because I have two functions I get two attributes at the end of the module, and FileCheck always tries to match the #0 instead of expanding the label

gnzlbg (Feb 10 2019 at 10:07, on Zulip):

I tried that too, and that does capture the attribute number

gnzlbg (Feb 10 2019 at 10:08, on Zulip):

but then somewhere I need a CHECK #[[FOO_ATTRIBUTE]] = ...

gnzlbg (Feb 10 2019 at 10:08, on Zulip):

and the attributes at the end of the module can be in any order

nagisa (Feb 10 2019 at 10:10, on Zulip):

sure, that can go at the end of the file for all attributes you care about. you can use CHECK-DAG to verify attributes come in whatever order.

nagisa (Feb 10 2019 at 10:10, on Zulip):

alternative is to check for Function Attrs comment on top of your labels.

nagisa (Feb 10 2019 at 10:10, on Zulip):

(which is, admittedly easier and most likely cleaner)

nagisa (Feb 10 2019 at 10:11, on Zulip):

I remember dealing with this problem before for optimize attribute myself, and ended up just checking the comment.

gnzlbg (Feb 10 2019 at 10:12, on Zulip):

when i put it at the end of the file, it does not match the correct line

gnzlbg (Feb 10 2019 at 10:13, on Zulip):

it should match .. #1 = ... , but it first tries to match ... #0 = ... and that fails, erroring there (it suggests if I wanted to match the second attribute)

gnzlbg (Feb 10 2019 at 10:14, on Zulip):

ill check the tests for the optimize attribute

nagisa (Feb 10 2019 at 10:19, on Zulip):

The test is https://github.com/rust-lang/rust/blob/master/src/test/codegen/optimize-attr-1.rs and turns out it is actually checking the attributes :slight_smile:

gnzlbg (Feb 10 2019 at 11:04, on Zulip):

@nagisa should be fixed, I had to use CHECK-DAG :)

gnzlbg (Feb 10 2019 at 11:05, on Zulip):

FileCheck is quite nice

nagisa (Feb 10 2019 at 12:18, on Zulip):

okay, I cannot really r+ this because that is more of a language decision, but the implementation looks fine

nagisa (Feb 10 2019 at 12:18, on Zulip):

I’ll write a comment to that effect.

Last update: Nov 22 2019 at 04:30UTC