[llvm] Attributor: Add denormal-fp-math to attributor-light (PR #79576)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 01:45:43 PST 2024
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/79576
>From 6d463abb97e73796eb5a353d4e997248fad3c40c Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Wed, 30 Aug 2023 08:38:34 -0400
Subject: [PATCH] Attributor: Add denormal-fp-math to attributor-light
I had to add AAIsDead for AADenormalFPMath to be reached for some
reason.
---
llvm/lib/Transforms/IPO/Attributor.cpp | 3 +-
.../Transforms/Attributor/denormal-fp-math.ll | 1 +
.../Transforms/FunctionAttrs/argmemonly.ll | 4 -
.../Transforms/FunctionAttrs/nocapture.ll | 18 +-
llvm/test/Transforms/FunctionAttrs/nonnull.ll | 139 ++++-----
.../Transforms/FunctionAttrs/norecurse.ll | 36 ++-
llvm/test/Transforms/FunctionAttrs/nosync.ll | 3 -
.../test/Transforms/FunctionAttrs/nounwind.ll | 286 ++++++++++++------
.../FunctionAttrs/read-write-scc.ll | 4 +-
.../Transforms/FunctionAttrs/readattrs.ll | 8 +-
.../test/Transforms/FunctionAttrs/readnone.ll | 2 -
.../Transforms/FunctionAttrs/willreturn.ll | 15 +-
12 files changed, 305 insertions(+), 214 deletions(-)
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 5d1a783b2996d7..01117a74b7b22c 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -3939,7 +3939,8 @@ static bool runAttributorLightOnFunctions(InformationCache &InfoCache,
&AANoFree::ID, &AANoReturn::ID, &AAMemoryLocation::ID,
&AAMemoryBehavior::ID, &AAUnderlyingObjects::ID, &AANoCapture::ID,
&AAInterFnReachability::ID, &AAIntraFnReachability::ID, &AACallEdges::ID,
- &AANoFPClass::ID, &AAMustProgress::ID, &AANonNull::ID});
+ &AANoFPClass::ID, &AAMustProgress::ID, &AANonNull::ID,
+ &AADenormalFPMath::ID, &AAIsDead::ID});
AC.Allowed = &Allowed;
AC.UseLiveness = false;
diff --git a/llvm/test/Transforms/Attributor/denormal-fp-math.ll b/llvm/test/Transforms/Attributor/denormal-fp-math.ll
index 558d2bb074ff2f..573a05041bff19 100644
--- a/llvm/test/Transforms/Attributor/denormal-fp-math.ll
+++ b/llvm/test/Transforms/Attributor/denormal-fp-math.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals --version 2
; RUN: opt -S -passes=attributor < %s | FileCheck %s
+; RUN: opt -S -passes=attributor-light < %s | FileCheck %s
; Keep the attribute checks clean by disabling inference of anything else.
declare void @call_of_mystery()
diff --git a/llvm/test/Transforms/FunctionAttrs/argmemonly.ll b/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
index ea6392714bf6f5..02674a3ba0b3bd 100644
--- a/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
+++ b/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
@@ -399,7 +399,6 @@ define void @test_recursive_argmem_read(ptr %p) {
; ATTRIBUTOR-LABEL: define void @test_recursive_argmem_read
; ATTRIBUTOR-SAME: (ptr nocapture nofree nonnull readonly [[P:%.*]]) #[[ATTR15:[0-9]+]] {
; ATTRIBUTOR-NEXT: [[PVAL:%.*]] = load ptr, ptr [[P]], align 8
-; ATTRIBUTOR-NEXT: call void @test_recursive_argmem_read(ptr nocapture nofree readonly [[PVAL]]) #[[ATTR15]]
; ATTRIBUTOR-NEXT: ret void
;
%pval = load ptr, ptr %p
@@ -444,7 +443,6 @@ define void @test_recursive_argmem_read_alloca(ptr %p) {
; ATTRIBUTOR-SAME: (ptr nocapture nofree nonnull readonly [[P:%.*]]) #[[ATTR17:[0-9]+]] {
; ATTRIBUTOR-NEXT: [[A:%.*]] = alloca ptr, align 8
; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = load i32, ptr [[P]], align 4
-; ATTRIBUTOR-NEXT: call void @test_recursive_argmem_read_alloca(ptr nocapture nofree nonnull readonly [[A]]) #[[ATTR15]]
; ATTRIBUTOR-NEXT: ret void
;
%a = alloca ptr
@@ -465,7 +463,6 @@ define void @test_scc_argmem_read_1(ptr %p) {
; ATTRIBUTOR-LABEL: define void @test_scc_argmem_read_1
; ATTRIBUTOR-SAME: (ptr nocapture nofree nonnull readonly [[P:%.*]]) #[[ATTR15]] {
; ATTRIBUTOR-NEXT: [[PVAL:%.*]] = load ptr, ptr [[P]], align 8
-; ATTRIBUTOR-NEXT: call void @test_scc_argmem_read_2(ptr nocapture nofree readonly [[PVAL]]) #[[ATTR15]]
; ATTRIBUTOR-NEXT: ret void
;
%pval = load ptr, ptr %p
@@ -483,7 +480,6 @@ define void @test_scc_argmem_read_2(ptr %p) {
; ATTRIBUTOR: Function Attrs: nofree nosync nounwind memory(read)
; ATTRIBUTOR-LABEL: define void @test_scc_argmem_read_2
; ATTRIBUTOR-SAME: (ptr nocapture nofree readonly [[P:%.*]]) #[[ATTR15]] {
-; ATTRIBUTOR-NEXT: call void @test_scc_argmem_read_1(ptr nocapture nofree readonly [[P]]) #[[ATTR15]]
; ATTRIBUTOR-NEXT: ret void
;
call void @test_scc_argmem_read_1(ptr %p)
diff --git a/llvm/test/Transforms/FunctionAttrs/nocapture.ll b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
index 3d483f671b1af7..6530e7a0fe692f 100644
--- a/llvm/test/Transforms/FunctionAttrs/nocapture.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
@@ -163,24 +163,24 @@ define i1 @c6(ptr %q, i8 %bit) personality ptr @__gxx_personality_v0 {
; FNATTRS-LABEL: define noundef i1 @c6
; FNATTRS-SAME: (ptr readonly [[Q:%.*]], i8 [[BIT:%.*]]) #[[ATTR5:[0-9]+]] personality ptr @__gxx_personality_v0 {
; FNATTRS-NEXT: invoke void @throw_if_bit_set(ptr [[Q]], i8 [[BIT]])
-; FNATTRS-NEXT: to label [[RET0:%.*]] unwind label [[RET1:%.*]]
+; FNATTRS-NEXT: to label [[RET0:%.*]] unwind label [[RET1:%.*]]
; FNATTRS: ret0:
; FNATTRS-NEXT: ret i1 false
; FNATTRS: ret1:
; FNATTRS-NEXT: [[EXN:%.*]] = landingpad { ptr, i32 }
-; FNATTRS-NEXT: cleanup
+; FNATTRS-NEXT: cleanup
; FNATTRS-NEXT: ret i1 true
;
; ATTRIBUTOR: Function Attrs: nosync memory(read)
; ATTRIBUTOR-LABEL: define i1 @c6
; ATTRIBUTOR-SAME: (ptr readonly [[Q:%.*]], i8 [[BIT:%.*]]) #[[ATTR4:[0-9]+]] personality ptr @__gxx_personality_v0 {
; ATTRIBUTOR-NEXT: invoke void @throw_if_bit_set(ptr [[Q]], i8 [[BIT]]) #[[ATTR4]]
-; ATTRIBUTOR-NEXT: to label [[RET0:%.*]] unwind label [[RET1:%.*]]
+; ATTRIBUTOR-NEXT: to label [[RET0:%.*]] unwind label [[RET1:%.*]]
; ATTRIBUTOR: ret0:
; ATTRIBUTOR-NEXT: ret i1 false
; ATTRIBUTOR: ret1:
; ATTRIBUTOR-NEXT: [[EXN:%.*]] = landingpad { ptr, i32 }
-; ATTRIBUTOR-NEXT: cleanup
+; ATTRIBUTOR-NEXT: cleanup
; ATTRIBUTOR-NEXT: ret i1 true
;
invoke void @throw_if_bit_set(ptr %q, i8 %bit)
@@ -371,7 +371,6 @@ define void @nc4(ptr %p) {
; ATTRIBUTOR: Function Attrs: nosync nounwind memory(read)
; ATTRIBUTOR-LABEL: define void @nc4
; ATTRIBUTOR-SAME: (ptr nocapture readonly [[P:%.*]]) #[[ATTR7:[0-9]+]] {
-; ATTRIBUTOR-NEXT: call void @external(ptr nocapture readonly [[P]]) #[[ATTR4]]
; ATTRIBUTOR-NEXT: ret void
;
call void @external(ptr %p)
@@ -387,7 +386,6 @@ define void @nc5(ptr %f, ptr %p) {
;
; ATTRIBUTOR-LABEL: define void @nc5
; ATTRIBUTOR-SAME: (ptr nocapture nofree nonnull [[F:%.*]], ptr nocapture [[P:%.*]]) {
-; ATTRIBUTOR-NEXT: call void [[F]](ptr [[P]]) #[[ATTR6:[0-9]+]]
; ATTRIBUTOR-NEXT: call void [[F]](ptr nocapture [[P]])
; ATTRIBUTOR-NEXT: ret void
;
@@ -500,7 +498,7 @@ define void @test4_1(ptr %x4_1, i1 %c) {
; ATTRIBUTOR: Function Attrs: nofree nosync nounwind memory(write)
; ATTRIBUTOR-LABEL: define void @test4_1
; ATTRIBUTOR-SAME: (ptr nocapture nofree readnone [[X4_1:%.*]], i1 [[C:%.*]]) #[[ATTR8]] {
-; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = call ptr @test4_2(ptr nocapture nofree readnone [[X4_1]], ptr nofree readnone [[X4_1]], ptr nocapture nofree readnone [[X4_1]], i1 [[C]]) #[[ATTR8]]
+; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = call ptr @test4_2(ptr nocapture nofree readnone undef, ptr nofree readnone [[X4_1]], ptr nocapture nofree readnone undef, i1 [[C]]) #[[ATTR8]]
; ATTRIBUTOR-NEXT: store ptr null, ptr @g, align 8
; ATTRIBUTOR-NEXT: ret void
;
@@ -706,7 +704,7 @@ define void @nocaptureStrip(ptr %p) {
; ATTRIBUTOR-LABEL: define void @nocaptureStrip
; ATTRIBUTOR-SAME: (ptr nocapture nofree writeonly [[P:%.*]]) #[[ATTR11:[0-9]+]] {
; ATTRIBUTOR-NEXT: entry:
-; ATTRIBUTOR-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr [[P]]) #[[ATTR17]]
+; ATTRIBUTOR-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr [[P]]) #[[ATTR20:[0-9]+]]
; ATTRIBUTOR-NEXT: store i8 42, ptr [[B]], align 1
; ATTRIBUTOR-NEXT: ret void
;
@@ -728,7 +726,7 @@ define void @captureStrip(ptr %p) {
; ATTRIBUTOR: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)
; ATTRIBUTOR-LABEL: define void @captureStrip
; ATTRIBUTOR-SAME: (ptr nofree writeonly [[P:%.*]]) #[[ATTR1]] {
-; ATTRIBUTOR-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr [[P]]) #[[ATTR17]]
+; ATTRIBUTOR-NEXT: [[B:%.*]] = call ptr @llvm.strip.invariant.group.p0(ptr [[P]]) #[[ATTR20]]
; ATTRIBUTOR-NEXT: store ptr [[B]], ptr @g3, align 8
; ATTRIBUTOR-NEXT: ret void
;
@@ -893,7 +891,7 @@ define void @readnone_indirec(ptr %f, ptr %p) {
; ATTRIBUTOR: Function Attrs: nosync memory(none)
; ATTRIBUTOR-LABEL: define void @readnone_indirec
; ATTRIBUTOR-SAME: (ptr nocapture nofree nonnull readnone [[F:%.*]], ptr readnone [[P:%.*]]) #[[ATTR13:[0-9]+]] {
-; ATTRIBUTOR-NEXT: call void [[F]](ptr [[P]]) #[[ATTR20:[0-9]+]]
+; ATTRIBUTOR-NEXT: call void [[F]](ptr [[P]]) #[[ATTR21:[0-9]+]]
; ATTRIBUTOR-NEXT: ret void
;
call void %f(ptr %p) readnone
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
index d9bdb6298ed0fd..9901e2f2e0ad69 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
@@ -119,7 +119,6 @@ define ptr @test5_helper(i1 %c) {
; ATTRIBUTOR-SAME: i1 [[C:%.*]]) #[[ATTR1]] {
; ATTRIBUTOR-NEXT: br i1 [[C]], label [[REC:%.*]], label [[END:%.*]]
; ATTRIBUTOR: rec:
-; ATTRIBUTOR-NEXT: [[RET:%.*]] = call ptr @test5(i1 [[C]]) #[[ATTR1]]
; ATTRIBUTOR-NEXT: br label [[END]]
; ATTRIBUTOR: end:
; ATTRIBUTOR-NEXT: ret ptr null
@@ -149,15 +148,25 @@ define ptr @test5(i1 %c) {
; Local analysis, but going through a self recursive phi
define ptr @test6a() {
-; COMMON-LABEL: define nonnull ptr @test6a() {
-; COMMON-NEXT: entry:
-; COMMON-NEXT: [[RET:%.*]] = call ptr @ret_nonnull()
-; COMMON-NEXT: br label [[LOOP:%.*]]
-; COMMON: loop:
-; COMMON-NEXT: [[PHI:%.*]] = phi ptr [ [[RET]], [[ENTRY:%.*]] ], [ [[PHI]], [[LOOP]] ]
-; COMMON-NEXT: br i1 undef, label [[LOOP]], label [[EXIT:%.*]]
-; COMMON: exit:
-; COMMON-NEXT: ret ptr [[PHI]]
+; FNATTRS-LABEL: define nonnull ptr @test6a() {
+; FNATTRS-NEXT: entry:
+; FNATTRS-NEXT: [[RET:%.*]] = call ptr @ret_nonnull()
+; FNATTRS-NEXT: br label [[LOOP:%.*]]
+; FNATTRS: loop:
+; FNATTRS-NEXT: [[PHI:%.*]] = phi ptr [ [[RET]], [[ENTRY:%.*]] ], [ [[PHI]], [[LOOP]] ]
+; FNATTRS-NEXT: br i1 undef, label [[LOOP]], label [[EXIT:%.*]]
+; FNATTRS: exit:
+; FNATTRS-NEXT: ret ptr [[PHI]]
+;
+; ATTRIBUTOR-LABEL: define nonnull ptr @test6a() {
+; ATTRIBUTOR-NEXT: entry:
+; ATTRIBUTOR-NEXT: [[RET:%.*]] = call ptr @ret_nonnull()
+; ATTRIBUTOR-NEXT: br label [[LOOP:%.*]]
+; ATTRIBUTOR: loop:
+; ATTRIBUTOR-NEXT: [[PHI:%.*]] = phi ptr [ [[RET]], [[ENTRY:%.*]] ], [ [[PHI]], [[LOOP]] ]
+; ATTRIBUTOR-NEXT: br i1 undef, label [[LOOP]], label [[EXIT:%.*]]
+; ATTRIBUTOR: exit:
+; ATTRIBUTOR-NEXT: unreachable
;
entry:
%ret = call ptr @ret_nonnull()
@@ -246,7 +255,7 @@ define ptr @test10(ptr %a, i64 %n) {
; ATTRIBUTOR-LABEL: define ptr @test10(
; ATTRIBUTOR-SAME: ptr nofree readnone [[A:%.*]], i64 [[N:%.*]]) #[[ATTR3:[0-9]+]] {
; ATTRIBUTOR-NEXT: [[CMP:%.*]] = icmp ne i64 [[N]], 0
-; ATTRIBUTOR-NEXT: call void @llvm.assume(i1 [[CMP]]) #[[ATTR14:[0-9]+]]
+; ATTRIBUTOR-NEXT: call void @llvm.assume(i1 [[CMP]]) #[[ATTR13:[0-9]+]]
; ATTRIBUTOR-NEXT: [[B:%.*]] = getelementptr inbounds i8, ptr [[A]], i64 [[N]]
; ATTRIBUTOR-NEXT: ret ptr [[B]]
;
@@ -322,8 +331,6 @@ define void @test13_helper() {
; ATTRIBUTOR-LABEL: define void @test13_helper() {
; ATTRIBUTOR-NEXT: [[NONNULLPTR:%.*]] = tail call ptr @ret_nonnull()
; ATTRIBUTOR-NEXT: [[MAYBENULLPTR:%.*]] = tail call ptr @unknown()
-; ATTRIBUTOR-NEXT: tail call void @test13(ptr nocapture nofree nonnull readnone [[NONNULLPTR]], ptr nocapture nofree nonnull readnone [[NONNULLPTR]], ptr nocapture nofree readnone [[MAYBENULLPTR]])
-; ATTRIBUTOR-NEXT: tail call void @test13(ptr nocapture nofree nonnull readnone [[NONNULLPTR]], ptr nocapture nofree readnone [[MAYBENULLPTR]], ptr nocapture nofree nonnull readnone [[NONNULLPTR]])
; ATTRIBUTOR-NEXT: ret void
;
%nonnullptr = tail call ptr @ret_nonnull()
@@ -338,7 +345,7 @@ define internal void @test13(ptr %a, ptr %b, ptr %c) {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define internal void @test13(
-; ATTRIBUTOR-SAME: ptr nocapture nofree readnone [[A:%.*]], ptr nocapture nofree readnone [[B:%.*]], ptr nocapture nofree readnone [[C:%.*]]) #[[ATTR4:[0-9]+]] {
+; ATTRIBUTOR-SAME: ) #[[ATTR0]] {
; ATTRIBUTOR-NEXT: ret void
;
ret void
@@ -382,7 +389,7 @@ define internal ptr @f1(ptr %arg) {
; FNATTRS-NEXT: ret ptr [[TMP10]]
;
; ATTRIBUTOR-LABEL: define internal ptr @f1(
-; ATTRIBUTOR-SAME: ptr nofree readonly [[ARG:%.*]]) #[[ATTR5:[0-9]+]] {
+; ATTRIBUTOR-SAME: ptr nofree readonly [[ARG:%.*]]) #[[ATTR4:[0-9]+]] {
; ATTRIBUTOR-NEXT: bb:
; ATTRIBUTOR-NEXT: [[TMP:%.*]] = icmp eq ptr [[ARG]], null
; ATTRIBUTOR-NEXT: br i1 [[TMP]], label [[BB9:%.*]], label [[BB1:%.*]]
@@ -392,11 +399,11 @@ define internal ptr @f1(ptr %arg) {
; ATTRIBUTOR-NEXT: br i1 [[TMP3]], label [[BB6:%.*]], label [[BB4:%.*]]
; ATTRIBUTOR: bb4:
; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr [[ARG]], i64 1
-; ATTRIBUTOR-NEXT: [[TMP5B:%.*]] = tail call ptr @f3(ptr readonly [[TMP5]]) #[[ATTR15:[0-9]+]]
+; ATTRIBUTOR-NEXT: [[TMP5B:%.*]] = tail call ptr @f3(ptr nofree nonnull readonly [[TMP5]]) #[[ATTR14:[0-9]+]]
; ATTRIBUTOR-NEXT: [[TMP5C:%.*]] = getelementptr inbounds i32, ptr [[TMP5B]], i64 -1
; ATTRIBUTOR-NEXT: br label [[BB9]]
; ATTRIBUTOR: bb6:
-; ATTRIBUTOR-NEXT: [[TMP7:%.*]] = tail call ptr @f2(ptr readonly [[ARG]]) #[[ATTR15]]
+; ATTRIBUTOR-NEXT: [[TMP7:%.*]] = tail call ptr @f2(ptr nofree nonnull readonly [[ARG]]) #[[ATTR14]]
; ATTRIBUTOR-NEXT: ret ptr [[TMP7]]
; ATTRIBUTOR: bb9:
; ATTRIBUTOR-NEXT: [[TMP10:%.*]] = phi ptr [ [[TMP5C]], [[BB4]] ], [ inttoptr (i64 4 to ptr), [[BB:%.*]] ]
@@ -436,9 +443,9 @@ define internal ptr @f2(ptr %arg) {
; FNATTRS-NEXT: ret ptr [[TMP]]
;
; ATTRIBUTOR-LABEL: define internal ptr @f2(
-; ATTRIBUTOR-SAME: ptr readonly [[ARG:%.*]]) #[[ATTR5]] {
+; ATTRIBUTOR-SAME: ptr nofree nonnull readonly [[ARG:%.*]]) #[[ATTR4]] {
; ATTRIBUTOR-NEXT: bb:
-; ATTRIBUTOR-NEXT: [[TMP:%.*]] = tail call ptr @f1(ptr readonly [[ARG]]) #[[ATTR15]]
+; ATTRIBUTOR-NEXT: [[TMP:%.*]] = tail call ptr @f1(ptr nofree nonnull readonly [[ARG]]) #[[ATTR14]]
; ATTRIBUTOR-NEXT: ret ptr [[TMP]]
;
bb:
@@ -457,9 +464,9 @@ define dso_local noalias ptr @f3(ptr %arg) {
; FNATTRS-NEXT: ret ptr [[TMP]]
;
; ATTRIBUTOR-LABEL: define dso_local noalias ptr @f3(
-; ATTRIBUTOR-SAME: ptr nofree readonly [[ARG:%.*]]) #[[ATTR5]] {
+; ATTRIBUTOR-SAME: ptr nofree readonly [[ARG:%.*]]) #[[ATTR4]] {
; ATTRIBUTOR-NEXT: bb:
-; ATTRIBUTOR-NEXT: [[TMP:%.*]] = call ptr @f1(ptr nofree readonly [[ARG]]) #[[ATTR15]]
+; ATTRIBUTOR-NEXT: [[TMP:%.*]] = call ptr @f1(ptr nofree readonly [[ARG]]) #[[ATTR14]]
; ATTRIBUTOR-NEXT: ret ptr [[TMP]]
;
bb:
@@ -508,14 +515,14 @@ define void @f16(ptr %a, ptr %b, i8 %c) {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define void @f16(
-; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], ptr [[B:%.*]], i8 [[C:%.*]]) #[[ATTR7:[0-9]+]] {
+; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], ptr [[B:%.*]], i8 [[C:%.*]]) #[[ATTR6:[0-9]+]] {
; ATTRIBUTOR-NEXT: [[CMP:%.*]] = icmp eq i8 [[C]], 0
; ATTRIBUTOR-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
; ATTRIBUTOR: if.then:
-; ATTRIBUTOR-NEXT: tail call void @fun2(ptr nonnull [[A]], ptr nonnull [[B]]) #[[ATTR16:[0-9]+]]
+; ATTRIBUTOR-NEXT: tail call void @fun2(ptr nonnull [[A]], ptr nonnull [[B]]) #[[ATTR5:[0-9]+]]
; ATTRIBUTOR-NEXT: ret void
; ATTRIBUTOR: if.else:
-; ATTRIBUTOR-NEXT: tail call void @fun2(ptr nonnull [[A]], ptr [[B]]) #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun2(ptr nonnull [[A]], ptr [[B]]) #[[ATTR5]]
; ATTRIBUTOR-NEXT: ret void
;
%cmp = icmp eq i8 %c, 0
@@ -550,17 +557,17 @@ define void @f17(ptr %a, i8 %c) {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define void @f17(
-; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], i8 [[C:%.*]]) #[[ATTR7]] {
+; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], i8 [[C:%.*]]) #[[ATTR6]] {
; ATTRIBUTOR-NEXT: [[CMP:%.*]] = icmp eq i8 [[C]], 0
; ATTRIBUTOR-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
; ATTRIBUTOR: if.then:
-; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR5]]
; ATTRIBUTOR-NEXT: br label [[CONT:%.*]]
; ATTRIBUTOR: if.else:
-; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR5]]
; ATTRIBUTOR-NEXT: br label [[CONT]]
; ATTRIBUTOR: cont:
-; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[A]]) #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[A]]) #[[ATTR5]]
; ATTRIBUTOR-NEXT: ret void
;
%cmp = icmp eq i8 %c, 0
@@ -611,26 +618,26 @@ define void @f18(ptr %a, ptr %b, i8 %c) {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define void @f18(
-; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], ptr [[B:%.*]], i8 [[C:%.*]]) #[[ATTR7]] {
+; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], ptr [[B:%.*]], i8 [[C:%.*]]) #[[ATTR6]] {
; ATTRIBUTOR-NEXT: [[CMP1:%.*]] = icmp eq i8 [[C]], 0
; ATTRIBUTOR-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
; ATTRIBUTOR: if.then:
-; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR5]]
; ATTRIBUTOR-NEXT: br label [[CONT:%.*]]
; ATTRIBUTOR: if.else:
-; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR5]]
; ATTRIBUTOR-NEXT: br label [[CONT]]
; ATTRIBUTOR: cont:
; ATTRIBUTOR-NEXT: [[CMP2:%.*]] = icmp eq i8 [[C]], 1
; ATTRIBUTOR-NEXT: br i1 [[CMP2]], label [[CONT_THEN:%.*]], label [[CONT_ELSE:%.*]]
; ATTRIBUTOR: cont.then:
-; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[B]]) #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[B]]) #[[ATTR5]]
; ATTRIBUTOR-NEXT: br label [[CONT2:%.*]]
; ATTRIBUTOR: cont.else:
-; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun0() #[[ATTR5]]
; ATTRIBUTOR-NEXT: br label [[CONT2]]
; ATTRIBUTOR: cont2:
-; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[A]]) #[[ATTR16]]
+; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[A]]) #[[ATTR5]]
; ATTRIBUTOR-NEXT: ret void
;
%cmp1 = icmp eq i8 %c, 0
@@ -674,17 +681,17 @@ define void @f19(ptr %a, ptr %b, i8 %c) {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define void @f19(
-; ATTRIBUTOR-SAME: ptr [[A:%.*]], ptr nonnull [[B:%.*]], i8 [[C:%.*]]) #[[ATTR8:[0-9]+]] {
+; ATTRIBUTOR-SAME: ptr [[A:%.*]], ptr nonnull [[B:%.*]], i8 [[C:%.*]]) #[[ATTR7:[0-9]+]] {
; ATTRIBUTOR-NEXT: br label [[LOOP_HEADER:%.*]]
; ATTRIBUTOR: loop.header:
; ATTRIBUTOR-NEXT: [[CMP2:%.*]] = icmp eq i8 [[C]], 0
; ATTRIBUTOR-NEXT: br i1 [[CMP2]], label [[LOOP_BODY:%.*]], label [[LOOP_EXIT:%.*]]
; ATTRIBUTOR: loop.body:
-; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[B]])
-; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[A]])
+; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[B]]) #[[ATTR7]]
+; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: br label [[LOOP_HEADER]]
; ATTRIBUTOR: loop.exit:
-; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[B]])
+; ATTRIBUTOR-NEXT: tail call void @fun1(ptr nonnull [[B]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: ret void
;
br label %loop.header
@@ -883,7 +890,7 @@ define i8 @parent7(ptr %a) {
;
; ATTRIBUTOR-LABEL: define i8 @parent7(
; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]]) {
-; ATTRIBUTOR-NEXT: [[RET:%.*]] = call i8 @use1safecall(ptr nonnull [[A]]) #[[ATTR16]]
+; ATTRIBUTOR-NEXT: [[RET:%.*]] = call i8 @use1safecall(ptr nonnull [[A]]) #[[ATTR5]]
; ATTRIBUTOR-NEXT: call void @use1nonnull(ptr nonnull [[A]])
; ATTRIBUTOR-NEXT: ret i8 [[RET]]
;
@@ -905,26 +912,26 @@ define i1 @parent8(ptr %a, ptr %bogus1, ptr %b) personality ptr @esfp{
; FNATTRS-SAME: ptr nonnull [[A:%.*]], ptr nocapture readnone [[BOGUS1:%.*]], ptr nonnull [[B:%.*]]) #[[ATTR7]] personality ptr @esfp {
; FNATTRS-NEXT: entry:
; FNATTRS-NEXT: invoke void @use2nonnull(ptr [[A]], ptr [[B]])
-; FNATTRS-NEXT: to label [[CONT:%.*]] unwind label [[EXC:%.*]]
+; FNATTRS-NEXT: to label [[CONT:%.*]] unwind label [[EXC:%.*]]
; FNATTRS: cont:
; FNATTRS-NEXT: [[NULL_CHECK:%.*]] = icmp eq ptr [[B]], null
; FNATTRS-NEXT: ret i1 [[NULL_CHECK]]
; FNATTRS: exc:
; FNATTRS-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
-; FNATTRS-NEXT: filter [0 x ptr] zeroinitializer
+; FNATTRS-NEXT: filter [0 x ptr] zeroinitializer
; FNATTRS-NEXT: unreachable
;
; ATTRIBUTOR-LABEL: define i1 @parent8(
-; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], ptr nocapture nofree readnone [[BOGUS1:%.*]], ptr nonnull [[B:%.*]]) #[[ATTR8]] personality ptr @esfp {
+; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], ptr nocapture nofree readnone [[BOGUS1:%.*]], ptr nonnull [[B:%.*]]) #[[ATTR7]] personality ptr @esfp {
; ATTRIBUTOR-NEXT: entry:
; ATTRIBUTOR-NEXT: invoke void @use2nonnull(ptr nonnull [[A]], ptr nonnull [[B]])
-; ATTRIBUTOR-NEXT: to label [[CONT:%.*]] unwind label [[EXC:%.*]]
+; ATTRIBUTOR-NEXT: to label [[CONT:%.*]] unwind label [[EXC:%.*]]
; ATTRIBUTOR: cont:
; ATTRIBUTOR-NEXT: [[NULL_CHECK:%.*]] = icmp eq ptr [[B]], null
; ATTRIBUTOR-NEXT: ret i1 [[NULL_CHECK]]
; ATTRIBUTOR: exc:
; ATTRIBUTOR-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
-; ATTRIBUTOR-NEXT: filter [0 x ptr] zeroinitializer
+; ATTRIBUTOR-NEXT: filter [0 x ptr] zeroinitializer
; ATTRIBUTOR-NEXT: unreachable
;
@@ -965,7 +972,7 @@ define ptr @gep1_no_null_opt(ptr %p) #0 {
; FNATTRS-NEXT: ret ptr [[Q]]
;
; ATTRIBUTOR-LABEL: define ptr @gep1_no_null_opt(
-; ATTRIBUTOR-SAME: ptr nofree readnone [[P:%.*]]) #[[ATTR9:[0-9]+]] {
+; ATTRIBUTOR-SAME: ptr nofree readnone [[P:%.*]]) #[[ATTR8:[0-9]+]] {
; ATTRIBUTOR-NEXT: [[Q:%.*]] = getelementptr inbounds i32, ptr [[P]], i32 1
; ATTRIBUTOR-NEXT: ret ptr [[Q]]
;
@@ -1006,8 +1013,8 @@ define internal ptr @g2() {
; FNATTRS-SAME: ) #[[ATTR0]] {
; FNATTRS-NEXT: ret ptr inttoptr (i64 4 to ptr)
;
-; ATTRIBUTOR-LABEL: define internal ptr @g2(
-; ATTRIBUTOR-SAME: ) #[[ATTR10:[0-9]+]] {
+; ATTRIBUTOR-LABEL: define internal nonnull ptr @g2(
+; ATTRIBUTOR-SAME: ) #[[ATTR0]] {
; ATTRIBUTOR-NEXT: ret ptr inttoptr (i64 4 to ptr)
;
ret ptr inttoptr (i64 4 to ptr)
@@ -1021,7 +1028,7 @@ define ptr @g1() {
;
; ATTRIBUTOR-LABEL: define ptr @g1(
; ATTRIBUTOR-SAME: ) #[[ATTR0]] {
-; ATTRIBUTOR-NEXT: [[C:%.*]] = call ptr @g2() #[[ATTR10]]
+; ATTRIBUTOR-NEXT: [[C:%.*]] = call ptr @g2() #[[ATTR15:[0-9]+]]
; ATTRIBUTOR-NEXT: ret ptr [[C]]
;
%c = call ptr @g2()
@@ -1036,8 +1043,7 @@ define internal void @called_by_weak(ptr %a) {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define internal void @called_by_weak(
-; ATTRIBUTOR-SAME: ptr nocapture readnone [[A:%.*]]) #[[ATTR11:[0-9]+]] {
-; ATTRIBUTOR-NEXT: call void @use_i32_ptr(ptr [[A]])
+; ATTRIBUTOR-SAME: ptr nocapture nonnull readnone [[A:%.*]]) #[[ATTR10:[0-9]+]] {
; ATTRIBUTOR-NEXT: ret void
;
call void @use_i32_ptr(ptr %a)
@@ -1053,7 +1059,6 @@ define weak_odr void @weak_caller(ptr nonnull %a) {
;
; ATTRIBUTOR-LABEL: define weak_odr void @weak_caller(
; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]]) {
-; ATTRIBUTOR-NEXT: call void @called_by_weak(ptr nocapture nonnull readnone [[A]])
; ATTRIBUTOR-NEXT: ret void
;
call void @called_by_weak(ptr %a)
@@ -1068,8 +1073,7 @@ define internal void @control(ptr dereferenceable(4) %a) {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define internal void @control(
-; ATTRIBUTOR-SAME: ptr nocapture readnone dereferenceable(4) [[A:%.*]]) #[[ATTR11]] {
-; ATTRIBUTOR-NEXT: call void @use_i32_ptr(ptr [[A]])
+; ATTRIBUTOR-SAME: ptr nocapture nonnull readnone dereferenceable(4) [[A:%.*]]) #[[ATTR10]] {
; ATTRIBUTOR-NEXT: ret void
;
call void @use_i32_ptr(ptr %a)
@@ -1083,7 +1087,7 @@ define internal void @naked(ptr dereferenceable(4) %a) naked {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define internal void @naked(
-; ATTRIBUTOR-SAME: ptr dereferenceable(4) [[A:%.*]]) #[[ATTR12:[0-9]+]] {
+; ATTRIBUTOR-SAME: ptr nonnull dereferenceable(4) [[A:%.*]]) #[[ATTR11:[0-9]+]] {
; ATTRIBUTOR-NEXT: call void @use_i32_ptr(ptr [[A]])
; ATTRIBUTOR-NEXT: ret void
;
@@ -1098,7 +1102,7 @@ define internal void @optnone(ptr dereferenceable(4) %a) optnone noinline {
; FNATTRS-NEXT: ret void
;
; ATTRIBUTOR-LABEL: define internal void @optnone(
-; ATTRIBUTOR-SAME: ptr dereferenceable(4) [[A:%.*]]) #[[ATTR13:[0-9]+]] {
+; ATTRIBUTOR-SAME: ptr nonnull dereferenceable(4) [[A:%.*]]) #[[ATTR12:[0-9]+]] {
; ATTRIBUTOR-NEXT: call void @use_i32_ptr(ptr [[A]])
; ATTRIBUTOR-NEXT: ret void
;
@@ -1116,7 +1120,6 @@ define void @make_live(ptr nonnull dereferenceable(8) %a) {
; ATTRIBUTOR-LABEL: define void @make_live(
; ATTRIBUTOR-SAME: ptr nonnull dereferenceable(8) [[A:%.*]]) {
; ATTRIBUTOR-NEXT: call void @naked(ptr nonnull align 16 dereferenceable(8) [[A]])
-; ATTRIBUTOR-NEXT: call void @control(ptr nocapture nonnull readnone align 16 dereferenceable(8) [[A]])
; ATTRIBUTOR-NEXT: call void @optnone(ptr nonnull align 16 dereferenceable(8) [[A]])
; ATTRIBUTOR-NEXT: ret void
;
@@ -1151,16 +1154,16 @@ define i32 @nonnull_exec_ctx_1(ptr %a, i32 %b) {
; FNATTRS-NEXT: br i1 [[TMP9]], label [[EX]], label [[HD]]
;
; ATTRIBUTOR-LABEL: define i32 @nonnull_exec_ctx_1(
-; ATTRIBUTOR-SAME: ptr [[A:%.*]], i32 [[B:%.*]]) #[[ATTR8]] {
+; ATTRIBUTOR-SAME: ptr [[A:%.*]], i32 [[B:%.*]]) #[[ATTR7]] {
; ATTRIBUTOR-NEXT: en:
; ATTRIBUTOR-NEXT: [[TMP3:%.*]] = icmp eq i32 [[B]], 0
; ATTRIBUTOR-NEXT: br i1 [[TMP3]], label [[EX:%.*]], label [[HD:%.*]]
; ATTRIBUTOR: ex:
-; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A]])
+; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: ret i32 [[TMP5]]
; ATTRIBUTOR: hd:
; ATTRIBUTOR-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP8:%.*]], [[HD]] ], [ 0, [[EN:%.*]] ]
-; ATTRIBUTOR-NEXT: tail call void @h(ptr [[A]])
+; ATTRIBUTOR-NEXT: tail call void @h(ptr [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: [[TMP8]] = add nuw i32 [[TMP7]], 1
; ATTRIBUTOR-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], [[B]]
; ATTRIBUTOR-NEXT: br i1 [[TMP9]], label [[EX]], label [[HD]]
@@ -1200,16 +1203,16 @@ define i32 @nonnull_exec_ctx_1b(ptr %a, i32 %b) {
; FNATTRS-NEXT: br i1 [[TMP9]], label [[EX]], label [[HD]]
;
; ATTRIBUTOR-LABEL: define i32 @nonnull_exec_ctx_1b(
-; ATTRIBUTOR-SAME: ptr [[A:%.*]], i32 [[B:%.*]]) #[[ATTR8]] {
+; ATTRIBUTOR-SAME: ptr [[A:%.*]], i32 [[B:%.*]]) #[[ATTR7]] {
; ATTRIBUTOR-NEXT: en:
; ATTRIBUTOR-NEXT: [[TMP3:%.*]] = icmp eq i32 [[B]], 0
; ATTRIBUTOR-NEXT: br i1 [[TMP3]], label [[EX:%.*]], label [[HD:%.*]]
; ATTRIBUTOR: ex:
-; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A]])
+; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: ret i32 [[TMP5]]
; ATTRIBUTOR: hd:
; ATTRIBUTOR-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP8:%.*]], [[HD2:%.*]] ], [ 0, [[EN:%.*]] ]
-; ATTRIBUTOR-NEXT: tail call void @h(ptr [[A]])
+; ATTRIBUTOR-NEXT: tail call void @h(ptr [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: br label [[HD2]]
; ATTRIBUTOR: hd2:
; ATTRIBUTOR-NEXT: [[TMP8]] = add nuw i32 [[TMP7]], 1
@@ -1252,16 +1255,16 @@ define i32 @nonnull_exec_ctx_2(ptr %a, i32 %b) willreturn nounwind {
; FNATTRS-NEXT: br i1 [[TMP9]], label [[EX]], label [[HD]]
;
; ATTRIBUTOR-LABEL: define i32 @nonnull_exec_ctx_2(
-; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], i32 [[B:%.*]]) #[[ATTR7]] {
+; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], i32 [[B:%.*]]) #[[ATTR6]] {
; ATTRIBUTOR-NEXT: en:
; ATTRIBUTOR-NEXT: [[TMP3:%.*]] = icmp eq i32 [[B]], 0
; ATTRIBUTOR-NEXT: br i1 [[TMP3]], label [[EX:%.*]], label [[HD:%.*]]
; ATTRIBUTOR: ex:
-; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A]])
+; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: ret i32 [[TMP5]]
; ATTRIBUTOR: hd:
; ATTRIBUTOR-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP8:%.*]], [[HD]] ], [ 0, [[EN:%.*]] ]
-; ATTRIBUTOR-NEXT: tail call void @h(ptr nonnull [[A]])
+; ATTRIBUTOR-NEXT: tail call void @h(ptr nonnull [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: [[TMP8]] = add nuw i32 [[TMP7]], 1
; ATTRIBUTOR-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], [[B]]
; ATTRIBUTOR-NEXT: br i1 [[TMP9]], label [[EX]], label [[HD]]
@@ -1301,16 +1304,16 @@ define i32 @nonnull_exec_ctx_2b(ptr %a, i32 %b) willreturn nounwind {
; FNATTRS-NEXT: br i1 [[TMP9]], label [[EX]], label [[HD]]
;
; ATTRIBUTOR-LABEL: define i32 @nonnull_exec_ctx_2b(
-; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], i32 [[B:%.*]]) #[[ATTR7]] {
+; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], i32 [[B:%.*]]) #[[ATTR6]] {
; ATTRIBUTOR-NEXT: en:
; ATTRIBUTOR-NEXT: [[TMP3:%.*]] = icmp eq i32 [[B]], 0
; ATTRIBUTOR-NEXT: br i1 [[TMP3]], label [[EX:%.*]], label [[HD:%.*]]
; ATTRIBUTOR: ex:
-; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A]])
+; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call i32 @g(ptr nonnull [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: ret i32 [[TMP5]]
; ATTRIBUTOR: hd:
; ATTRIBUTOR-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP8:%.*]], [[HD2:%.*]] ], [ 0, [[EN:%.*]] ]
-; ATTRIBUTOR-NEXT: tail call void @h(ptr nonnull [[A]])
+; ATTRIBUTOR-NEXT: tail call void @h(ptr nonnull [[A]]) #[[ATTR7]]
; ATTRIBUTOR-NEXT: br label [[HD2]]
; ATTRIBUTOR: hd2:
; ATTRIBUTOR-NEXT: [[TMP8]] = add nuw i32 [[TMP7]], 1
diff --git a/llvm/test/Transforms/FunctionAttrs/norecurse.ll b/llvm/test/Transforms/FunctionAttrs/norecurse.ll
index 7924428fb49897..1f92c2c506c4a5 100644
--- a/llvm/test/Transforms/FunctionAttrs/norecurse.ll
+++ b/llvm/test/Transforms/FunctionAttrs/norecurse.ll
@@ -4,10 +4,15 @@
define i32 @leaf() {
-; COMMON: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
-; COMMON-LABEL: define {{[^@]+}}@leaf
-; COMMON-SAME: () #[[ATTR0:[0-9]+]] {
-; COMMON-NEXT: ret i32 1
+; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; FNATTRS-LABEL: define {{[^@]+}}@leaf
+; FNATTRS-SAME: () #[[ATTR0:[0-9]+]] {
+; FNATTRS-NEXT: ret i32 1
+;
+; ATTRIBUTOR: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@leaf
+; ATTRIBUTOR-SAME: () #[[ATTR0:[0-9]+]] {
+; ATTRIBUTOR-NEXT: ret i32 1
;
ret i32 1
}
@@ -22,7 +27,6 @@ define i32 @self_rec() {
; ATTRIBUTOR: Function Attrs: nofree nosync nounwind memory(none)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@self_rec
; ATTRIBUTOR-SAME: () #[[ATTR1:[0-9]+]] {
-; ATTRIBUTOR-NEXT: [[A:%.*]] = call i32 @self_rec() #[[ATTR1]]
; ATTRIBUTOR-NEXT: ret i32 4
;
%a = call i32 @self_rec()
@@ -108,11 +112,11 @@ define internal i32 @called_by_norecurse() {
; FNATTRS-NEXT: [[A:%.*]] = call i32 @k()
; FNATTRS-NEXT: ret i32 [[A]]
;
-; ATTRIBUTOR: Function Attrs: nosync memory(none)
+; ATTRIBUTOR: Function Attrs: norecurse nosync memory(none)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@called_by_norecurse
-; ATTRIBUTOR-SAME: () #[[ATTR2]] {
+; ATTRIBUTOR-SAME: () #[[ATTR6:[0-9]+]] {
; ATTRIBUTOR-NEXT: [[A:%.*]] = call i32 @k() #[[ATTR7]]
-; ATTRIBUTOR-NEXT: ret i32 [[A]]
+; ATTRIBUTOR-NEXT: ret i32 undef
;
%a = call i32 @k()
ret i32 %a
@@ -127,7 +131,7 @@ define void @m() norecurse {
;
; ATTRIBUTOR: Function Attrs: norecurse nosync memory(none)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@m
-; ATTRIBUTOR-SAME: () #[[ATTR6:[0-9]+]] {
+; ATTRIBUTOR-SAME: () #[[ATTR6]] {
; ATTRIBUTOR-NEXT: [[A:%.*]] = call i32 @called_by_norecurse() #[[ATTR2]]
; ATTRIBUTOR-NEXT: ret void
;
@@ -142,11 +146,11 @@ define internal i32 @called_by_norecurse_indirectly() {
; FNATTRS-NEXT: [[A:%.*]] = call i32 @k()
; FNATTRS-NEXT: ret i32 [[A]]
;
-; ATTRIBUTOR: Function Attrs: nosync memory(none)
+; ATTRIBUTOR: Function Attrs: norecurse nosync memory(none)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@called_by_norecurse_indirectly
-; ATTRIBUTOR-SAME: () #[[ATTR2]] {
+; ATTRIBUTOR-SAME: () #[[ATTR6]] {
; ATTRIBUTOR-NEXT: [[A:%.*]] = call i32 @k() #[[ATTR7]]
-; ATTRIBUTOR-NEXT: ret i32 [[A]]
+; ATTRIBUTOR-NEXT: ret i32 undef
;
%a = call i32 @k()
ret i32 %a
@@ -159,9 +163,9 @@ define internal void @o() {
; FNATTRS-NEXT: [[A:%.*]] = call i32 @called_by_norecurse_indirectly()
; FNATTRS-NEXT: ret void
;
-; ATTRIBUTOR: Function Attrs: nosync memory(none)
+; ATTRIBUTOR: Function Attrs: norecurse nosync memory(none)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@o
-; ATTRIBUTOR-SAME: () #[[ATTR2]] {
+; ATTRIBUTOR-SAME: () #[[ATTR6]] {
; ATTRIBUTOR-NEXT: [[A:%.*]] = call i32 @called_by_norecurse_indirectly() #[[ATTR2]]
; ATTRIBUTOR-NEXT: ret void
;
@@ -213,7 +217,7 @@ define internal void @q() {
; ATTRIBUTOR: Function Attrs: norecurse nosync memory(none)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@q
; ATTRIBUTOR-SAME: () #[[ATTR6]] {
-; ATTRIBUTOR-NEXT: [[A:%.*]] = call i32 @escapes_as_parameter(ptr nonnull @escapes_as_parameter) #[[ATTR2]]
+; ATTRIBUTOR-NEXT: [[A:%.*]] = call i32 @escapes_as_parameter(ptr nocapture nofree nonnull readnone undef) #[[ATTR2]]
; ATTRIBUTOR-NEXT: ret void
;
%a = call i32 @escapes_as_parameter(ptr @escapes_as_parameter)
@@ -255,3 +259,5 @@ define void @r() norecurse {
; ATTRIBUTOR: attributes #[[ATTR7]] = { nosync }
; ATTRIBUTOR: attributes #[[ATTR8]] = { nofree willreturn }
;.
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; COMMON: {{.*}}
diff --git a/llvm/test/Transforms/FunctionAttrs/nosync.ll b/llvm/test/Transforms/FunctionAttrs/nosync.ll
index de5398f17ce51d..d097ccfe13c13f 100644
--- a/llvm/test/Transforms/FunctionAttrs/nosync.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nosync.ll
@@ -204,7 +204,6 @@ define i32 @volatile_load(ptr %0) norecurse nounwind uwtable {
}
; CHECK: Function Attrs: noinline nosync nounwind uwtable
-; CHECK-NEXT: declare void @nosync_function()
declare void @nosync_function() noinline nounwind uwtable nosync
define void @call_nosync_function() nounwind uwtable noinline {
@@ -218,7 +217,6 @@ define void @call_nosync_function() nounwind uwtable noinline {
}
; CHECK: Function Attrs: noinline nounwind uwtable
-; CHECK-NEXT: declare void @might_sync()
declare void @might_sync() noinline nounwind uwtable
define void @call_might_sync() nounwind uwtable noinline {
@@ -280,7 +278,6 @@ define void @convergent_readnone(){
}
; CHECK: Function Attrs: nounwind
-; CHECK-NEXT: declare void @llvm.x86.sse2.clflush(ptr)
declare void @llvm.x86.sse2.clflush(ptr)
@a = common global i32 0, align 4
diff --git a/llvm/test/Transforms/FunctionAttrs/nounwind.ll b/llvm/test/Transforms/FunctionAttrs/nounwind.ll
index afa9ae31b5fba4..025c2851eadaa2 100644
--- a/llvm/test/Transforms/FunctionAttrs/nounwind.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nounwind.ll
@@ -4,10 +4,15 @@
; TEST 1
define i32 @foo1() {
-; COMMON: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
-; COMMON-LABEL: define {{[^@]+}}@foo1
-; COMMON-SAME: () #[[ATTR0:[0-9]+]] {
-; COMMON-NEXT: ret i32 1
+; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; FNATTRS-LABEL: define {{[^@]+}}@foo1
+; FNATTRS-SAME: () #[[ATTR0:[0-9]+]] {
+; FNATTRS-NEXT: ret i32 1
+;
+; ATTRIBUTOR: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@foo1
+; ATTRIBUTOR-SAME: () #[[ATTR0:[0-9]+]] {
+; ATTRIBUTOR-NEXT: ret i32 1
;
ret i32 1
}
@@ -23,7 +28,6 @@ define i32 @scc1_foo() {
; ATTRIBUTOR: Function Attrs: nofree nosync nounwind memory(none)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@scc1_foo
; ATTRIBUTOR-SAME: () #[[ATTR1:[0-9]+]] {
-; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = call i32 @scc1_bar() #[[ATTR1]]
; ATTRIBUTOR-NEXT: ret i32 1
;
%1 = call i32 @scc1_bar()
@@ -42,7 +46,6 @@ define i32 @scc1_bar() {
; ATTRIBUTOR: Function Attrs: nofree nosync nounwind memory(none)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@scc1_bar
; ATTRIBUTOR-SAME: () #[[ATTR1]] {
-; ATTRIBUTOR-NEXT: [[TMP1:%.*]] = call i32 @scc1_foo() #[[ATTR1]]
; ATTRIBUTOR-NEXT: ret i32 1
;
%1 = call i32 @scc1_foo()
@@ -70,14 +73,23 @@ define void @call_non_nounwind(){
; }
define i32 @maybe_throw(i1 zeroext %0) {
-; COMMON-LABEL: define {{[^@]+}}@maybe_throw
-; COMMON-SAME: (i1 zeroext [[TMP0:%.*]]) {
-; COMMON-NEXT: br i1 [[TMP0]], label [[TMP2:%.*]], label [[TMP3:%.*]]
-; COMMON: 2:
-; COMMON-NEXT: tail call void @__cxa_rethrow()
-; COMMON-NEXT: unreachable
-; COMMON: 3:
-; COMMON-NEXT: ret i32 -1
+; FNATTRS-LABEL: define {{[^@]+}}@maybe_throw
+; FNATTRS-SAME: (i1 zeroext [[TMP0:%.*]]) {
+; FNATTRS-NEXT: br i1 [[TMP0]], label [[TMP2:%.*]], label [[TMP3:%.*]]
+; FNATTRS: 2:
+; FNATTRS-NEXT: tail call void @__cxa_rethrow()
+; FNATTRS-NEXT: unreachable
+; FNATTRS: 3:
+; FNATTRS-NEXT: ret i32 -1
+;
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@maybe_throw
+; ATTRIBUTOR-SAME: (i1 zeroext [[TMP0:%.*]]) {
+; ATTRIBUTOR-NEXT: br i1 [[TMP0]], label [[TMP2:%.*]], label [[TMP3:%.*]]
+; ATTRIBUTOR: 2:
+; ATTRIBUTOR-NEXT: tail call void @__cxa_rethrow()
+; ATTRIBUTOR-NEXT: unreachable
+; ATTRIBUTOR: 3:
+; ATTRIBUTOR-NEXT: ret i32 -1
;
br i1 %0, label %2, label %3
@@ -101,18 +113,31 @@ declare void @__cxa_rethrow()
; }
define i32 @catch_thing() personality ptr @__gxx_personality_v0 {
-; COMMON-LABEL: define {{[^@]+}}@catch_thing() personality ptr @__gxx_personality_v0 {
-; COMMON-NEXT: invoke void @__cxa_rethrow()
-; COMMON-NEXT: to label [[TMP1:%.*]] unwind label [[TMP2:%.*]]
-; COMMON: 1:
-; COMMON-NEXT: unreachable
-; COMMON: 2:
-; COMMON-NEXT: [[TMP3:%.*]] = landingpad { ptr, i32 }
-; COMMON-NEXT: catch ptr null
-; COMMON-NEXT: [[TMP4:%.*]] = extractvalue { ptr, i32 } [[TMP3]], 0
-; COMMON-NEXT: [[TMP5:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[TMP4]])
-; COMMON-NEXT: tail call void @__cxa_end_catch()
-; COMMON-NEXT: ret i32 -1
+; FNATTRS-LABEL: define {{[^@]+}}@catch_thing() personality ptr @__gxx_personality_v0 {
+; FNATTRS-NEXT: invoke void @__cxa_rethrow()
+; FNATTRS-NEXT: to label [[TMP1:%.*]] unwind label [[TMP2:%.*]]
+; FNATTRS: 1:
+; FNATTRS-NEXT: unreachable
+; FNATTRS: 2:
+; FNATTRS-NEXT: [[TMP3:%.*]] = landingpad { ptr, i32 }
+; FNATTRS-NEXT: catch ptr null
+; FNATTRS-NEXT: [[TMP4:%.*]] = extractvalue { ptr, i32 } [[TMP3]], 0
+; FNATTRS-NEXT: [[TMP5:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[TMP4]])
+; FNATTRS-NEXT: tail call void @__cxa_end_catch()
+; FNATTRS-NEXT: ret i32 -1
+;
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@catch_thing() personality ptr @__gxx_personality_v0 {
+; ATTRIBUTOR-NEXT: invoke void @__cxa_rethrow()
+; ATTRIBUTOR-NEXT: to label [[TMP1:%.*]] unwind label [[TMP2:%.*]]
+; ATTRIBUTOR: 1:
+; ATTRIBUTOR-NEXT: unreachable
+; ATTRIBUTOR: 2:
+; ATTRIBUTOR-NEXT: [[TMP3:%.*]] = landingpad { ptr, i32 }
+; ATTRIBUTOR-NEXT: catch ptr null
+; ATTRIBUTOR-NEXT: [[TMP4:%.*]] = extractvalue { ptr, i32 } [[TMP3]], 0
+; ATTRIBUTOR-NEXT: [[TMP5:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[TMP4]])
+; ATTRIBUTOR-NEXT: tail call void @__cxa_end_catch()
+; ATTRIBUTOR-NEXT: ret i32 -1
;
invoke void @__cxa_rethrow() #1
to label %1 unwind label %2
@@ -130,9 +155,13 @@ define i32 @catch_thing() personality ptr @__gxx_personality_v0 {
}
define i32 @catch_thing_user() {
-; COMMON-LABEL: define {{[^@]+}}@catch_thing_user() {
-; COMMON-NEXT: [[CATCH_THING_CALL:%.*]] = call i32 @catch_thing()
-; COMMON-NEXT: ret i32 [[CATCH_THING_CALL]]
+; FNATTRS-LABEL: define {{[^@]+}}@catch_thing_user() {
+; FNATTRS-NEXT: [[CATCH_THING_CALL:%.*]] = call i32 @catch_thing()
+; FNATTRS-NEXT: ret i32 [[CATCH_THING_CALL]]
+;
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@catch_thing_user() {
+; ATTRIBUTOR-NEXT: [[CATCH_THING_CALL:%.*]] = call i32 @catch_thing()
+; ATTRIBUTOR-NEXT: ret i32 [[CATCH_THING_CALL]]
;
%catch_thing_call = call i32 @catch_thing()
ret i32 %catch_thing_call
@@ -143,18 +172,31 @@ declare void @abort() nounwind
@catch_ty = external global ptr
define void @catch_specific_landingpad() personality ptr @__gxx_personality_v0 {
-; COMMON: Function Attrs: noreturn
-; COMMON-LABEL: define {{[^@]+}}@catch_specific_landingpad
-; COMMON-SAME: () #[[ATTR3:[0-9]+]] personality ptr @__gxx_personality_v0 {
-; COMMON-NEXT: invoke void @do_throw()
-; COMMON-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
-; COMMON: lpad:
-; COMMON-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
-; COMMON-NEXT: catch ptr @catch_ty
-; COMMON-NEXT: call void @abort()
-; COMMON-NEXT: unreachable
-; COMMON: unreachable:
-; COMMON-NEXT: unreachable
+; FNATTRS: Function Attrs: noreturn
+; FNATTRS-LABEL: define {{[^@]+}}@catch_specific_landingpad
+; FNATTRS-SAME: () #[[ATTR3:[0-9]+]] personality ptr @__gxx_personality_v0 {
+; FNATTRS-NEXT: invoke void @do_throw()
+; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; FNATTRS: lpad:
+; FNATTRS-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; FNATTRS-NEXT: catch ptr @catch_ty
+; FNATTRS-NEXT: call void @abort()
+; FNATTRS-NEXT: unreachable
+; FNATTRS: unreachable:
+; FNATTRS-NEXT: unreachable
+;
+; ATTRIBUTOR: Function Attrs: noreturn
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@catch_specific_landingpad
+; ATTRIBUTOR-SAME: () #[[ATTR3:[0-9]+]] personality ptr @__gxx_personality_v0 {
+; ATTRIBUTOR-NEXT: invoke void @do_throw()
+; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; ATTRIBUTOR: lpad:
+; ATTRIBUTOR-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; ATTRIBUTOR-NEXT: catch ptr @catch_ty
+; ATTRIBUTOR-NEXT: call void @abort() #[[ATTR2:[0-9]+]]
+; ATTRIBUTOR-NEXT: unreachable
+; ATTRIBUTOR: unreachable:
+; ATTRIBUTOR-NEXT: unreachable
;
invoke void @do_throw()
to label %unreachable unwind label %lpad
@@ -170,18 +212,31 @@ unreachable:
}
define void @catch_all_landingpad() personality ptr @__gxx_personality_v0 {
-; COMMON: Function Attrs: noreturn nounwind
-; COMMON-LABEL: define {{[^@]+}}@catch_all_landingpad
-; COMMON-SAME: () #[[ATTR4:[0-9]+]] personality ptr @__gxx_personality_v0 {
-; COMMON-NEXT: invoke void @do_throw()
-; COMMON-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
-; COMMON: lpad:
-; COMMON-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
-; COMMON-NEXT: catch ptr null
-; COMMON-NEXT: call void @abort()
-; COMMON-NEXT: unreachable
-; COMMON: unreachable:
-; COMMON-NEXT: unreachable
+; FNATTRS: Function Attrs: noreturn nounwind
+; FNATTRS-LABEL: define {{[^@]+}}@catch_all_landingpad
+; FNATTRS-SAME: () #[[ATTR4:[0-9]+]] personality ptr @__gxx_personality_v0 {
+; FNATTRS-NEXT: invoke void @do_throw()
+; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; FNATTRS: lpad:
+; FNATTRS-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; FNATTRS-NEXT: catch ptr null
+; FNATTRS-NEXT: call void @abort()
+; FNATTRS-NEXT: unreachable
+; FNATTRS: unreachable:
+; FNATTRS-NEXT: unreachable
+;
+; ATTRIBUTOR: Function Attrs: noreturn nounwind
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@catch_all_landingpad
+; ATTRIBUTOR-SAME: () #[[ATTR4:[0-9]+]] personality ptr @__gxx_personality_v0 {
+; ATTRIBUTOR-NEXT: invoke void @do_throw()
+; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; ATTRIBUTOR: lpad:
+; ATTRIBUTOR-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; ATTRIBUTOR-NEXT: catch ptr null
+; ATTRIBUTOR-NEXT: call void @abort() #[[ATTR2]]
+; ATTRIBUTOR-NEXT: unreachable
+; ATTRIBUTOR: unreachable:
+; ATTRIBUTOR-NEXT: unreachable
;
invoke void @do_throw()
to label %unreachable unwind label %lpad
@@ -197,18 +252,31 @@ unreachable:
}
define void @filter_specific_landingpad() personality ptr @__gxx_personality_v0 {
-; COMMON: Function Attrs: noreturn
-; COMMON-LABEL: define {{[^@]+}}@filter_specific_landingpad
-; COMMON-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
-; COMMON-NEXT: invoke void @do_throw()
-; COMMON-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
-; COMMON: lpad:
-; COMMON-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
-; COMMON-NEXT: filter [1 x ptr] [ptr @catch_ty]
-; COMMON-NEXT: call void @abort()
-; COMMON-NEXT: unreachable
-; COMMON: unreachable:
-; COMMON-NEXT: unreachable
+; FNATTRS: Function Attrs: noreturn
+; FNATTRS-LABEL: define {{[^@]+}}@filter_specific_landingpad
+; FNATTRS-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
+; FNATTRS-NEXT: invoke void @do_throw()
+; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; FNATTRS: lpad:
+; FNATTRS-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; FNATTRS-NEXT: filter [1 x ptr] [ptr @catch_ty]
+; FNATTRS-NEXT: call void @abort()
+; FNATTRS-NEXT: unreachable
+; FNATTRS: unreachable:
+; FNATTRS-NEXT: unreachable
+;
+; ATTRIBUTOR: Function Attrs: noreturn
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@filter_specific_landingpad
+; ATTRIBUTOR-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
+; ATTRIBUTOR-NEXT: invoke void @do_throw()
+; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; ATTRIBUTOR: lpad:
+; ATTRIBUTOR-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; ATTRIBUTOR-NEXT: filter [1 x ptr] [ptr @catch_ty]
+; ATTRIBUTOR-NEXT: call void @abort() #[[ATTR2]]
+; ATTRIBUTOR-NEXT: unreachable
+; ATTRIBUTOR: unreachable:
+; ATTRIBUTOR-NEXT: unreachable
;
invoke void @do_throw()
to label %unreachable unwind label %lpad
@@ -224,18 +292,31 @@ unreachable:
}
define void @filter_none_landingpad() personality ptr @__gxx_personality_v0 {
-; COMMON: Function Attrs: noreturn nounwind
-; COMMON-LABEL: define {{[^@]+}}@filter_none_landingpad
-; COMMON-SAME: () #[[ATTR4]] personality ptr @__gxx_personality_v0 {
-; COMMON-NEXT: invoke void @do_throw()
-; COMMON-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
-; COMMON: lpad:
-; COMMON-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
-; COMMON-NEXT: filter [0 x ptr] zeroinitializer
-; COMMON-NEXT: call void @abort()
-; COMMON-NEXT: unreachable
-; COMMON: unreachable:
-; COMMON-NEXT: unreachable
+; FNATTRS: Function Attrs: noreturn nounwind
+; FNATTRS-LABEL: define {{[^@]+}}@filter_none_landingpad
+; FNATTRS-SAME: () #[[ATTR4]] personality ptr @__gxx_personality_v0 {
+; FNATTRS-NEXT: invoke void @do_throw()
+; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; FNATTRS: lpad:
+; FNATTRS-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; FNATTRS-NEXT: filter [0 x ptr] zeroinitializer
+; FNATTRS-NEXT: call void @abort()
+; FNATTRS-NEXT: unreachable
+; FNATTRS: unreachable:
+; FNATTRS-NEXT: unreachable
+;
+; ATTRIBUTOR: Function Attrs: noreturn nounwind
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@filter_none_landingpad
+; ATTRIBUTOR-SAME: () #[[ATTR4]] personality ptr @__gxx_personality_v0 {
+; ATTRIBUTOR-NEXT: invoke void @do_throw()
+; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; ATTRIBUTOR: lpad:
+; ATTRIBUTOR-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; ATTRIBUTOR-NEXT: filter [0 x ptr] zeroinitializer
+; ATTRIBUTOR-NEXT: call void @abort() #[[ATTR2]]
+; ATTRIBUTOR-NEXT: unreachable
+; ATTRIBUTOR: unreachable:
+; ATTRIBUTOR-NEXT: unreachable
;
invoke void @do_throw()
to label %unreachable unwind label %lpad
@@ -251,18 +332,31 @@ unreachable:
}
define void @cleanup_landingpad() personality ptr @__gxx_personality_v0 {
-; COMMON: Function Attrs: noreturn
-; COMMON-LABEL: define {{[^@]+}}@cleanup_landingpad
-; COMMON-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
-; COMMON-NEXT: invoke void @do_throw()
-; COMMON-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
-; COMMON: lpad:
-; COMMON-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
-; COMMON-NEXT: cleanup
-; COMMON-NEXT: call void @abort()
-; COMMON-NEXT: unreachable
-; COMMON: unreachable:
-; COMMON-NEXT: unreachable
+; FNATTRS: Function Attrs: noreturn
+; FNATTRS-LABEL: define {{[^@]+}}@cleanup_landingpad
+; FNATTRS-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
+; FNATTRS-NEXT: invoke void @do_throw()
+; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; FNATTRS: lpad:
+; FNATTRS-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; FNATTRS-NEXT: cleanup
+; FNATTRS-NEXT: call void @abort()
+; FNATTRS-NEXT: unreachable
+; FNATTRS: unreachable:
+; FNATTRS-NEXT: unreachable
+;
+; ATTRIBUTOR: Function Attrs: noreturn
+; ATTRIBUTOR-LABEL: define {{[^@]+}}@cleanup_landingpad
+; ATTRIBUTOR-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
+; ATTRIBUTOR-NEXT: invoke void @do_throw()
+; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[LPAD:%.*]]
+; ATTRIBUTOR: lpad:
+; ATTRIBUTOR-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }
+; ATTRIBUTOR-NEXT: cleanup
+; ATTRIBUTOR-NEXT: call void @abort() #[[ATTR2]]
+; ATTRIBUTOR-NEXT: unreachable
+; ATTRIBUTOR: unreachable:
+; ATTRIBUTOR-NEXT: unreachable
;
invoke void @do_throw()
to label %unreachable unwind label %lpad
@@ -282,7 +376,7 @@ define void @cleanuppad() personality ptr @__gxx_personality_v0 {
; FNATTRS-LABEL: define {{[^@]+}}@cleanuppad
; FNATTRS-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
; FNATTRS-NEXT: invoke void @do_throw()
-; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CPAD:%.*]]
+; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CPAD:%.*]]
; FNATTRS: cpad:
; FNATTRS-NEXT: [[CP:%.*]] = cleanuppad within none []
; FNATTRS-NEXT: call void @abort()
@@ -294,10 +388,10 @@ define void @cleanuppad() personality ptr @__gxx_personality_v0 {
; ATTRIBUTOR-LABEL: define {{[^@]+}}@cleanuppad
; ATTRIBUTOR-SAME: () #[[ATTR4]] personality ptr @__gxx_personality_v0 {
; ATTRIBUTOR-NEXT: invoke void @do_throw()
-; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CPAD:%.*]]
+; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CPAD:%.*]]
; ATTRIBUTOR: cpad:
; ATTRIBUTOR-NEXT: [[CP:%.*]] = cleanuppad within none []
-; ATTRIBUTOR-NEXT: call void @abort()
+; ATTRIBUTOR-NEXT: call void @abort() #[[ATTR2]]
; ATTRIBUTOR-NEXT: unreachable
; ATTRIBUTOR: unreachable:
; ATTRIBUTOR-NEXT: unreachable
@@ -319,7 +413,7 @@ define void @catchswitch_cleanuppad() personality ptr @__gxx_personality_v0 {
; FNATTRS-LABEL: define {{[^@]+}}@catchswitch_cleanuppad
; FNATTRS-SAME: () #[[ATTR3]] personality ptr @__gxx_personality_v0 {
; FNATTRS-NEXT: invoke void @do_throw()
-; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CS:%.*]]
+; FNATTRS-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CS:%.*]]
; FNATTRS: cs:
; FNATTRS-NEXT: [[TOK:%.*]] = catchswitch within none [label %catch] unwind label [[CPAD:%.*]]
; FNATTRS: catch:
@@ -337,16 +431,16 @@ define void @catchswitch_cleanuppad() personality ptr @__gxx_personality_v0 {
; ATTRIBUTOR-LABEL: define {{[^@]+}}@catchswitch_cleanuppad
; ATTRIBUTOR-SAME: () #[[ATTR4]] personality ptr @__gxx_personality_v0 {
; ATTRIBUTOR-NEXT: invoke void @do_throw()
-; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CS:%.*]]
+; ATTRIBUTOR-NEXT: to label [[UNREACHABLE:%.*]] unwind label [[CS:%.*]]
; ATTRIBUTOR: cs:
; ATTRIBUTOR-NEXT: [[TOK:%.*]] = catchswitch within none [label %catch] unwind label [[CPAD:%.*]]
; ATTRIBUTOR: catch:
; ATTRIBUTOR-NEXT: [[C:%.*]] = catchpad within [[TOK]] [ptr @catch_ty, i32 0, ptr null]
-; ATTRIBUTOR-NEXT: call void @abort()
+; ATTRIBUTOR-NEXT: call void @abort() #[[ATTR2]]
; ATTRIBUTOR-NEXT: unreachable
; ATTRIBUTOR: cpad:
; ATTRIBUTOR-NEXT: [[CP:%.*]] = cleanuppad within none []
-; ATTRIBUTOR-NEXT: call void @abort()
+; ATTRIBUTOR-NEXT: call void @abort() #[[ATTR2]]
; ATTRIBUTOR-NEXT: unreachable
; ATTRIBUTOR: unreachable:
; ATTRIBUTOR-NEXT: unreachable
diff --git a/llvm/test/Transforms/FunctionAttrs/read-write-scc.ll b/llvm/test/Transforms/FunctionAttrs/read-write-scc.ll
index 3640eb59b88420..be61990fd6278b 100644
--- a/llvm/test/Transforms/FunctionAttrs/read-write-scc.ll
+++ b/llvm/test/Transforms/FunctionAttrs/read-write-scc.ll
@@ -4,7 +4,7 @@
@i = global i32 0
define void @foo() {
-; CHECK: Function Attrs: nofree nosync nounwind
+; CHECK: Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none)
; CHECK-LABEL: define {{[^@]+}}@foo
; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: store i32 1, ptr @i, align 4
@@ -17,7 +17,7 @@ define void @foo() {
}
define void @bar() {
-; CHECK: Function Attrs: nofree nosync nounwind
+; CHECK: Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none)
; CHECK-LABEL: define {{[^@]+}}@bar
; CHECK-SAME: () #[[ATTR0]] {
; CHECK-NEXT: [[I:%.*]] = load i32, ptr @i, align 4
diff --git a/llvm/test/Transforms/FunctionAttrs/readattrs.ll b/llvm/test/Transforms/FunctionAttrs/readattrs.ll
index 39513976f90d76..7e1f3ddfa3e14c 100644
--- a/llvm/test/Transforms/FunctionAttrs/readattrs.ll
+++ b/llvm/test/Transforms/FunctionAttrs/readattrs.ll
@@ -308,13 +308,13 @@ define <4 x i32> @test11_2(<4 x ptr> %ptrs) {
; ATTRIBUTOR: Function Attrs: nosync nounwind memory(argmem: read)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@test11_2
; ATTRIBUTOR-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR9:[0-9]+]] {
-; ATTRIBUTOR-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR3]]
+; ATTRIBUTOR-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR17:[0-9]+]]
; ATTRIBUTOR-NEXT: ret <4 x i32> [[RES]]
;
; ATTRIBUTOR-CGSCC: Function Attrs: nosync nounwind memory(argmem: read)
; ATTRIBUTOR-CGSCC-LABEL: define {{[^@]+}}@test11_2
; ATTRIBUTOR-CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR10:[0-9]+]] {
-; ATTRIBUTOR-CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR3]]
+; ATTRIBUTOR-CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR17:[0-9]+]]
; ATTRIBUTOR-CGSCC-NEXT: ret <4 x i32> [[RES]]
;
%res = call <4 x i32> @test11_1(<4 x ptr> %ptrs)
@@ -332,13 +332,13 @@ define <4 x i32> @test12_2(<4 x ptr> %ptrs) {
; ATTRIBUTOR: Function Attrs: nounwind memory(argmem: readwrite)
; ATTRIBUTOR-LABEL: define {{[^@]+}}@test12_2
; ATTRIBUTOR-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR10:[0-9]+]] {
-; ATTRIBUTOR-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]])
+; ATTRIBUTOR-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]]) #[[ATTR18:[0-9]+]]
; ATTRIBUTOR-NEXT: ret <4 x i32> [[RES]]
;
; ATTRIBUTOR-CGSCC: Function Attrs: nounwind memory(argmem: readwrite)
; ATTRIBUTOR-CGSCC-LABEL: define {{[^@]+}}@test12_2
; ATTRIBUTOR-CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR11:[0-9]+]] {
-; ATTRIBUTOR-CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]])
+; ATTRIBUTOR-CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]]) #[[ATTR18:[0-9]+]]
; ATTRIBUTOR-CGSCC-NEXT: ret <4 x i32> [[RES]]
;
%res = call <4 x i32> @test12_1(<4 x ptr> %ptrs)
diff --git a/llvm/test/Transforms/FunctionAttrs/readnone.ll b/llvm/test/Transforms/FunctionAttrs/readnone.ll
index 7a6d47cbabd8b8..848751ab5881c1 100644
--- a/llvm/test/Transforms/FunctionAttrs/readnone.ll
+++ b/llvm/test/Transforms/FunctionAttrs/readnone.ll
@@ -10,7 +10,6 @@ define void @bar(ptr readonly %0) {
;
; ATTRIBUTOR-LABEL: define void @bar(
; ATTRIBUTOR-SAME: ptr nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
-; ATTRIBUTOR-NEXT: call void @foo(ptr nocapture nofree readnone [[TMP0]]) #[[ATTR0]]
; ATTRIBUTOR-NEXT: ret void
;
call void @foo(ptr %0)
@@ -25,7 +24,6 @@ define void @foo(ptr readonly %0) {
;
; ATTRIBUTOR-LABEL: define void @foo(
; ATTRIBUTOR-SAME: ptr nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR0]] {
-; ATTRIBUTOR-NEXT: call void @bar(ptr nocapture nofree readnone [[TMP0]]) #[[ATTR0]]
; ATTRIBUTOR-NEXT: ret void
;
call void @bar(ptr %0)
diff --git a/llvm/test/Transforms/FunctionAttrs/willreturn.ll b/llvm/test/Transforms/FunctionAttrs/willreturn.ll
index bf3f4adf7eaa17..7c09836acca02e 100644
--- a/llvm/test/Transforms/FunctionAttrs/willreturn.ll
+++ b/llvm/test/Transforms/FunctionAttrs/willreturn.ll
@@ -87,9 +87,7 @@ define i32 @mustprogress_call_known_functions(ptr %ptr) mustprogress {
;
; ATTRIBUTOR: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read)
; ATTRIBUTOR-LABEL: @mustprogress_call_known_functions(
-; ATTRIBUTOR-NEXT: call void @mustprogress_readnone() #[[ATTR9:[0-9]+]]
-; ATTRIBUTOR-NEXT: [[R:%.*]] = call i32 @mustprogress_load(ptr nocapture nofree readonly [[PTR:%.*]]) #[[ATTR12:[0-9]+]]
-; ATTRIBUTOR-NEXT: ret i32 [[R]]
+; ATTRIBUTOR-NEXT: unreachable
;
call void @mustprogress_readnone()
%r = call i32 @mustprogress_load(ptr %ptr)
@@ -102,23 +100,23 @@ define i64 @mustprogress_mayunwind() mustprogress personality ptr @__gxx_persona
; FNATTRS: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
; FNATTRS-LABEL: @mustprogress_mayunwind(
; FNATTRS-NEXT: [[A:%.*]] = invoke i64 @fn_noread()
-; FNATTRS-NEXT: to label [[A:%.*]] unwind label [[B:%.*]]
+; FNATTRS-NEXT: to label [[A:%.*]] unwind label [[B:%.*]]
; FNATTRS: A:
; FNATTRS-NEXT: ret i64 10
; FNATTRS: B:
; FNATTRS-NEXT: [[VAL:%.*]] = landingpad { ptr, i32 }
-; FNATTRS-NEXT: catch ptr null
+; FNATTRS-NEXT: catch ptr null
; FNATTRS-NEXT: ret i64 0
;
; ATTRIBUTOR: Function Attrs: mustprogress nosync nounwind willreturn memory(none)
; ATTRIBUTOR-LABEL: @mustprogress_mayunwind(
-; ATTRIBUTOR-NEXT: [[A:%.*]] = invoke i64 @fn_noread()
-; ATTRIBUTOR-NEXT: to label [[A:%.*]] unwind label [[B:%.*]]
+; ATTRIBUTOR-NEXT: [[A:%.*]] = invoke i64 @fn_noread() #[[ATTR12:[0-9]+]]
+; ATTRIBUTOR-NEXT: to label [[A:%.*]] unwind label [[B:%.*]]
; ATTRIBUTOR: A:
; ATTRIBUTOR-NEXT: ret i64 10
; ATTRIBUTOR: B:
; ATTRIBUTOR-NEXT: [[VAL:%.*]] = landingpad { ptr, i32 }
-; ATTRIBUTOR-NEXT: catch ptr null
+; ATTRIBUTOR-NEXT: catch ptr null
; ATTRIBUTOR-NEXT: ret i64 0
;
%a = invoke i64 @fn_noread()
@@ -236,7 +234,6 @@ define void @willreturn_recursion() {
;
; ATTRIBUTOR: Function Attrs: nofree nosync nounwind memory(none)
; ATTRIBUTOR-LABEL: @willreturn_recursion(
-; ATTRIBUTOR-NEXT: tail call void @willreturn_recursion() #[[ATTR9]]
; ATTRIBUTOR-NEXT: ret void
;
tail call void @willreturn_recursion()
More information about the llvm-commits
mailing list