[PATCH] D62313: Add a test for "nofree" function attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 24 07:14:11 PDT 2019


jdoerfert added a comment.

I like the tests. One comment and one change request was inlined.



================
Comment at: llvm/test/Transforms/FunctionAttrs/nofree.ll:98
+; TEST 6 (negative case)
+; Call realloc
+; CHECK: define noalias i8* @call_realloc(i8* nocapture, i64) local_unnamed_addr [[NoInlineNoUnwindUwtable]]
----------------
I guess one could argue realloc/free/... are just like regular, unknown functions wrt. no-free. I'd keep the tests though. And it opens the question if we should derive "is-freed" at some point ;)


================
Comment at: llvm/test/Transforms/FunctionAttrs/nofree.ll:145
+; FIXME : "nofree" missing
+; CHECK-DAG: attributes [[NoInlineNoRecurseNoUnwindReadNoneUwtableNoFree]] = { noinline norecurse nounwind readnone uwtable }
+; CHECK-DAG: attributes [[NoInlineNoUnwindUwtable]] = { noinline nounwind uwtable }
----------------
So Chandler raised concerns over this kind of checking in D59903. While I have to admit I haven't fixed all test cases yet, I can see his point. Could you check for the attributes in the printed IR version just before the definition?

It would look similar to this one:
```
; CHECK:       Function Attrs: noinline norecurse nounwind readnone uwtable
; CHECK-NEXT:     define double* @ret_undef_arg_undef(i32* readnone %b)
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62313





More information about the llvm-commits mailing list