[PATCH] D156840: [CaptureTracking] Add tests for allowing non-void `noalias` return funcs to be non-capturing; NFC

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 18:44:25 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, fhahn, efriedma, nlopes.
Herald added subscribers: jeroen.dobbelaere, StephenFan.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156840

Files:
  llvm/test/Transforms/FunctionAttrs/nocapture.ll


Index: llvm/test/Transforms/FunctionAttrs/nocapture.ll
===================================================================
--- llvm/test/Transforms/FunctionAttrs/nocapture.ll
+++ llvm/test/Transforms/FunctionAttrs/nocapture.ll
@@ -556,16 +556,27 @@
   ret void
 }
 
-define void @readnone_indirec(ptr %f, ptr %p) {
-; CHECK-LABEL: define void @readnone_indirec
-; CHECK-SAME: (ptr nocapture readonly [[F:%.*]], ptr readnone [[P:%.*]]) #[[ATTR18:[0-9]+]] {
-; CHECK-NEXT:    call void [[F]](ptr [[P]]) #[[ATTR21:[0-9]+]]
-; CHECK-NEXT:    ret void
+define ptr @noalias_ret(ptr %f, ptr %p) {
+; CHECK-LABEL: define ptr @noalias_ret
+; CHECK-SAME: (ptr nocapture readonly [[F:%.*]], ptr readonly [[P:%.*]]) #[[ATTR5]] {
+; CHECK-NEXT:    [[R:%.*]] = call noalias ptr [[F]](ptr [[P]]) #[[ATTR8]]
+; CHECK-NEXT:    ret ptr [[R]]
 ;
-  call void %f(ptr %p) readnone
-  ret void
+  %r = call noalias ptr %f(ptr %p) readonly nounwind
+  ret ptr %r
+}
+
+define ptr @noalias_ret_fail(ptr %f, ptr %p) {
+; CHECK-LABEL: define ptr @noalias_ret_fail
+; CHECK-SAME: (ptr nocapture readonly [[F:%.*]], ptr readonly [[P:%.*]]) #[[ATTR18:[0-9]+]] {
+; CHECK-NEXT:    [[R:%.*]] = call noalias ptr [[F]](ptr [[P]]) #[[ATTR21:[0-9]+]]
+; CHECK-NEXT:    ret ptr [[R]]
+;
+  %r = call noalias ptr %f(ptr %p) readonly willreturn
+  ret ptr %r
 }
 
 
+
 declare ptr @llvm.launder.invariant.group.p0(ptr)
 declare ptr @llvm.strip.invariant.group.p0(ptr)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156840.546286.patch
Type: text/x-patch
Size: 1430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230802/a0a234e0/attachment.bin>


More information about the llvm-commits mailing list