[PATCH] D156842: [Inliner] Add more tests for deducing return attributes of callsites when inlining; NFC
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 1 18:45:22 PDT 2023
goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, fhahn, efriedma.
Herald added a subscriber: 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/D156842
Files:
llvm/test/Transforms/Inline/nonnull.ll
Index: llvm/test/Transforms/Inline/nonnull.ll
===================================================================
--- llvm/test/Transforms/Inline/nonnull.ll
+++ llvm/test/Transforms/Inline/nonnull.ll
@@ -129,3 +129,61 @@
ret void
}
+;; Only need nounwind on the function we are adding attributes to
+declare ptr @buz() nounwind
+define nonnull ptr @callee7() {
+; CHECK-LABEL: define nonnull ptr @callee7() {
+; CHECK-NEXT: [[R:%.*]] = call ptr @buz() #[[ATTR1:[0-9]+]]
+; CHECK-NEXT: ret ptr [[R]]
+;
+ %r = call ptr @buz() willreturn
+ ret ptr %r
+}
+
+define ptr @caller7() {
+; CHECK-LABEL: define ptr @caller7() {
+; CHECK-NEXT: [[R_I:%.*]] = call ptr @buz() #[[ATTR1]]
+; CHECK-NEXT: ret ptr [[R_I]]
+;
+ %r = call ptr @callee7()
+ ret ptr %r
+}
+
+define nonnull ptr @callee8() {
+; CHECK-LABEL: define nonnull ptr @callee8() {
+; CHECK-NEXT: [[R:%.*]] = call ptr @buz()
+; CHECK-NEXT: ret ptr [[R]]
+;
+ %r = call ptr @buz()
+ ret ptr %r
+}
+
+define ptr @caller8() {
+; CHECK-LABEL: define ptr @caller8() {
+; CHECK-NEXT: [[R_I:%.*]] = call ptr @buz()
+; CHECK-NEXT: ret ptr [[R_I]]
+;
+ %r = call nonnull ptr @callee8()
+ ret ptr %r
+}
+
+define ptr @callee9() {
+; CHECK-LABEL: define ptr @callee9() {
+; CHECK-NEXT: [[R:%.*]] = call ptr @buz()
+; CHECK-NEXT: call void @foo() #[[ATTR0:[0-9]+]]
+; CHECK-NEXT: ret ptr [[R]]
+;
+ %r = call ptr @buz()
+ call void @foo() nounwind
+ ret ptr %r
+}
+
+define ptr @caller9() {
+; CHECK-LABEL: define ptr @caller9() {
+; CHECK-NEXT: [[R_I:%.*]] = call ptr @buz()
+; CHECK-NEXT: call void @foo() #[[ATTR0]]
+; CHECK-NEXT: ret ptr [[R_I]]
+;
+ %r = call nonnull ptr @callee9()
+ ret ptr %r
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156842.546288.patch
Type: text/x-patch
Size: 1706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230802/3ed2aaf1/attachment.bin>
More information about the llvm-commits
mailing list