[PATCH] D99589: [test, InferFunctionAttrs] Fix use of var defined in CHECK-NOT

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 30 11:41:25 PDT 2021


tra added a comment.

LGTM for NVPTX.



================
Comment at: llvm/test/Transforms/InferFunctionAttrs/annotate.ll:370
+; CHECK-KNOWN: declare i32 @ffsl(i64) [[NOFREE_NOUNWIND_WILLRETURN]]
+; CHECK-UNKNOWN: declare i32 @ffsl(i64)
 declare i32 @ffsl(i64)
----------------
Is the goal to make sure that there are no attributes assigned? Or that we don't care if there are any attributes?
If that's the former, then the check does not work -- it will happily match even if the declaration is followed by an attribute.
If that's the latter, the check is a bit confusing as the 'don't care' part is not obvious.

Perhaps it would be better to restructure the checks this way:
```
; CHECK-LABEL:  declare i32 @ffsl(i64) 
; CHECK-KNOWN-SAME:  [[NOFREE_NOUNWIND_WILLRETURN]]
; if we want to make sure there are no attributes
; CHECK-UNKNOWN-NOT: #{{.*}}
;
; if we don't care about the attributes, then we could do 
; CHECK-UNKNOWN-SAME: {{.*}}
; or CHECK-UNKNOWN could be skipped altogether.
```
This way it's somewhat easier to tell the intent of the test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99589



More information about the llvm-commits mailing list