129 changes: 63 additions & 66 deletions llvm/test/Transforms/Attributor/align.ll
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ define i32* @test6_2() #0 {

; Function Attrs: nounwind readnone ssp uwtable
define internal i8* @f1(i8* readnone %0) local_unnamed_addr #0 {
; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable
; IS__CGSCC____-LABEL: define {{[^@]+}}@f1
; IS__CGSCC____-SAME: (i8* noalias nofree noundef nonnull readnone returned align 8 dereferenceable(1) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
; IS__CGSCC____-NEXT: br label [[TMP3:%.*]]
; IS__CGSCC____: 2:
; IS__CGSCC____-NEXT: unreachable
; IS__CGSCC____: 3:
; IS__CGSCC____-NEXT: ret i8* [[TMP0]]
; CHECK: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable
; CHECK-LABEL: define {{[^@]+}}@f1
; CHECK-SAME: (i8* noalias nofree nonnull readnone align 8 dereferenceable(1) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
; CHECK-NEXT: br label [[TMP3:%.*]]
; CHECK: 2:
; CHECK-NEXT: unreachable
; CHECK: 3:
; CHECK-NEXT: ret i8* [[TMP0]]
;
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
Expand All @@ -163,10 +163,10 @@ define internal i8* @f2(i8* readnone %0) local_unnamed_addr #0 {
; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f2
; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {
; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* undef, null
; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
; IS__CGSCC_OPM: 3:
; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias noundef nonnull readnone align 4294967296 dereferenceable(4294967295) [[TMP0]])
; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias nonnull readnone align 4294967296 dereferenceable(4294967295) undef)
; IS__CGSCC_OPM-NEXT: br label [[TMP7:%.*]]
; IS__CGSCC_OPM: 5:
; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3(i8* nonnull @a2)
Expand All @@ -178,10 +178,10 @@ define internal i8* @f2(i8* readnone %0) local_unnamed_addr #0 {
; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f2
; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {
; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* undef, null
; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
; IS__CGSCC_NPM: 3:
; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias noundef nonnull readnone align 4294967296 dereferenceable(4294967295) [[TMP0]])
; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias nonnull readnone align 4294967296 dereferenceable(4294967295) undef)
; IS__CGSCC_NPM-NEXT: br label [[TMP7:%.*]]
; IS__CGSCC_NPM: 5:
; IS__CGSCC_NPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3()
Expand Down Expand Up @@ -248,17 +248,20 @@ define align 4 i8* @test7() #0 {
; IS__TUNIT____: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable
; IS__TUNIT____-LABEL: define {{[^@]+}}@test7
; IS__TUNIT____-SAME: () #[[ATTR0]] {
; IS__TUNIT____-NEXT: ret i8* @a1
; IS__TUNIT____-NEXT: [[C:%.*]] = tail call i8* @f1(i8* noalias nofree noundef nonnull readnone align 8 dereferenceable(1) "no-capture-maybe-returned" @a1) #[[ATTR9:[0-9]+]]
; IS__TUNIT____-NEXT: ret i8* [[C]]
;
; IS__CGSCC_OPM: Function Attrs: nofree noinline nosync nounwind readnone willreturn uwtable
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test7
; IS__CGSCC_OPM-SAME: () #[[ATTR1]] {
; IS__CGSCC_OPM-NEXT: ret i8* @a1
; IS__CGSCC_OPM-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) i8* @f1(i8* noalias nofree noundef nonnull readnone align 8 dereferenceable(1) @a1) #[[ATTR13:[0-9]+]]
; IS__CGSCC_OPM-NEXT: ret i8* [[C]]
;
; IS__CGSCC_NPM: Function Attrs: nofree noinline nosync nounwind readnone willreturn uwtable
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test7
; IS__CGSCC_NPM-SAME: () #[[ATTR2:[0-9]+]] {
; IS__CGSCC_NPM-NEXT: ret i8* @a1
; IS__CGSCC_NPM-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) i8* @f1(i8* noalias nofree noundef nonnull readnone align 8 dereferenceable(1) @a1) #[[ATTR13:[0-9]+]]
; IS__CGSCC_NPM-NEXT: ret i8* [[C]]
;
%c = tail call i8* @f1(i8* align 8 dereferenceable(1) @a1)
ret i8* %c
Expand All @@ -267,23 +270,14 @@ define align 4 i8* @test7() #0 {
; TEST 7b
; Function Attrs: nounwind readnone ssp uwtable
define internal i8* @f1b(i8* readnone %0) local_unnamed_addr #0 {
; IS__CGSCC_OPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f1b
; IS__CGSCC_OPM-SAME: (i8* noalias nocapture nofree nonnull readnone align 8 dereferenceable(1) [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
; IS__CGSCC_OPM-NEXT: br label [[TMP3:%.*]]
; IS__CGSCC_OPM: 2:
; IS__CGSCC_OPM-NEXT: unreachable
; IS__CGSCC_OPM: 3:
; IS__CGSCC_OPM-NEXT: ret i8* undef
;
; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f1b
; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR0]] {
; IS__CGSCC_NPM-NEXT: br label [[TMP2:%.*]]
; IS__CGSCC_NPM: 1:
; IS__CGSCC_NPM-NEXT: unreachable
; IS__CGSCC_NPM: 2:
; IS__CGSCC_NPM-NEXT: ret i8* undef
; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable
; IS__CGSCC____-LABEL: define {{[^@]+}}@f1b
; IS__CGSCC____-SAME: (i8* noalias nofree nonnull readnone align 8 dereferenceable(1) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {
; IS__CGSCC____-NEXT: br label [[TMP3:%.*]]
; IS__CGSCC____: 2:
; IS__CGSCC____-NEXT: unreachable
; IS__CGSCC____: 3:
; IS__CGSCC____-NEXT: ret i8* [[TMP0]]
;
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
Expand All @@ -305,30 +299,32 @@ define internal i8* @f2b(i8* readnone %0) local_unnamed_addr #0 {
; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f2b
; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] {
; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* undef, null
; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
; IS__CGSCC_OPM: 3:
; IS__CGSCC_OPM-NEXT: br label [[TMP6:%.*]]
; IS__CGSCC_OPM: 4:
; IS__CGSCC_OPM-NEXT: [[TMP5:%.*]] = tail call i8* @f3b(i8* nonnull @a2)
; IS__CGSCC_OPM-NEXT: br label [[TMP6]]
; IS__CGSCC_OPM: 6:
; IS__CGSCC_OPM-NEXT: [[TMP7:%.*]] = phi i8* [ undef, [[TMP3]] ], [ [[TMP5]], [[TMP4]] ]
; IS__CGSCC_OPM-NEXT: ret i8* [[TMP7]]
; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1b(i8* noalias nonnull readnone align 4294967296 dereferenceable(4294967295) undef)
; IS__CGSCC_OPM-NEXT: br label [[TMP7:%.*]]
; IS__CGSCC_OPM: 5:
; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3b(i8* nonnull @a2)
; IS__CGSCC_OPM-NEXT: br label [[TMP7]]
; IS__CGSCC_OPM: 7:
; IS__CGSCC_OPM-NEXT: [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ]
; IS__CGSCC_OPM-NEXT: ret i8* [[TMP8]]
;
; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f2b
; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {
; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]
; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* undef, null
; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
; IS__CGSCC_NPM: 3:
; IS__CGSCC_NPM-NEXT: br label [[TMP6:%.*]]
; IS__CGSCC_NPM: 4:
; IS__CGSCC_NPM-NEXT: [[TMP5:%.*]] = tail call i8* @f3b()
; IS__CGSCC_NPM-NEXT: br label [[TMP6]]
; IS__CGSCC_NPM: 6:
; IS__CGSCC_NPM-NEXT: [[TMP7:%.*]] = phi i8* [ undef, [[TMP3]] ], [ [[TMP5]], [[TMP4]] ]
; IS__CGSCC_NPM-NEXT: ret i8* [[TMP7]]
; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1b(i8* noalias nonnull readnone align 4294967296 dereferenceable(4294967295) undef)
; IS__CGSCC_NPM-NEXT: br label [[TMP7:%.*]]
; IS__CGSCC_NPM: 5:
; IS__CGSCC_NPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3b()
; IS__CGSCC_NPM-NEXT: br label [[TMP7]]
; IS__CGSCC_NPM: 7:
; IS__CGSCC_NPM-NEXT: [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ]
; IS__CGSCC_NPM-NEXT: ret i8* [[TMP8]]
;
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
Expand All @@ -354,12 +350,13 @@ define internal i8* @f3b(i8* readnone %0) local_unnamed_addr #0 {
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f3b
; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] {
; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]]
; IS__CGSCC_OPM: 3:
; IS__CGSCC_OPM-NEXT: br label [[TMP4]]
; IS__CGSCC_OPM: 4:
; IS__CGSCC_OPM-NEXT: [[TMP5:%.*]] = phi i8* [ @a2, [[TMP3]] ], [ @a1, [[TMP1:%.*]] ]
; IS__CGSCC_OPM-NEXT: ret i8* [[TMP5]]
; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1b(i8* noalias noundef nonnull readnone align 16 dereferenceable(1) @a2)
; IS__CGSCC_OPM-NEXT: br label [[TMP5]]
; IS__CGSCC_OPM: 5:
; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ @a1, [[TMP1:%.*]] ]
; IS__CGSCC_OPM-NEXT: ret i8* [[TMP6]]
;
; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f3b
Expand Down Expand Up @@ -924,7 +921,7 @@ end:
define i64 @ptr2int(i32* %p) {
; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
; IS__TUNIT____-LABEL: define {{[^@]+}}@ptr2int
; IS__TUNIT____-SAME: (i32* nofree readnone [[P:%.*]]) #[[ATTR9:[0-9]+]] {
; IS__TUNIT____-SAME: (i32* nofree readnone [[P:%.*]]) #[[ATTR9]] {
; IS__TUNIT____-NEXT: [[P2I:%.*]] = ptrtoint i32* [[P]] to i64
; IS__TUNIT____-NEXT: ret i64 [[P2I]]
;
Expand Down Expand Up @@ -1042,7 +1039,7 @@ define i32 @musttail_caller_1(i32* %p) {
; IS__CGSCC____-NEXT: [[C:%.*]] = load i1, i1* @cnd, align 1
; IS__CGSCC____-NEXT: br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]]
; IS__CGSCC____: mt:
; IS__CGSCC____-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(i32* nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR13:[0-9]+]]
; IS__CGSCC____-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(i32* nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR14:[0-9]+]]
; IS__CGSCC____-NEXT: ret i32 [[V]]
; IS__CGSCC____: exit:
; IS__CGSCC____-NEXT: ret i32 0
Expand All @@ -1066,10 +1063,10 @@ define i32* @checkAndAdvance(i32* align(16) %p) {
; IS__TUNIT____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
; IS__TUNIT____: if.then:
; IS__TUNIT____-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 4
; IS__TUNIT____-NEXT: [[CALL:%.*]] = call nonnull align 16 i32* @checkAndAdvance(i32* nonnull readonly align 16 "no-capture-maybe-returned" [[ADD_PTR]]) #[[ATTR2]]
; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @checkAndAdvance(i32* nonnull readonly align 16 "no-capture-maybe-returned" [[ADD_PTR]]) #[[ATTR2]]
; IS__TUNIT____-NEXT: br label [[RETURN]]
; IS__TUNIT____: return:
; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[CALL]], [[IF_THEN]] ], [ [[P]], [[ENTRY:%.*]] ]
; IS__TUNIT____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[ADD_PTR]], [[IF_THEN]] ], [ [[P]], [[ENTRY:%.*]] ]
; IS__TUNIT____-NEXT: call void @user_i32_ptr(i32* noalias nocapture nonnull readnone align 16 [[RETVAL_0]]) #[[ATTR2]]
; IS__TUNIT____-NEXT: ret i32* [[RETVAL_0]]
;
Expand All @@ -1082,10 +1079,10 @@ define i32* @checkAndAdvance(i32* align(16) %p) {
; IS__CGSCC____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
; IS__CGSCC____: if.then:
; IS__CGSCC____-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[P]], i64 4
; IS__CGSCC____-NEXT: [[CALL:%.*]] = call nonnull align 16 i32* @checkAndAdvance(i32* nonnull readonly align 16 "no-capture-maybe-returned" [[ADD_PTR]]) #[[ATTR3]]
; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32* @checkAndAdvance(i32* nonnull readonly align 16 "no-capture-maybe-returned" [[ADD_PTR]]) #[[ATTR3]]
; IS__CGSCC____-NEXT: br label [[RETURN]]
; IS__CGSCC____: return:
; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[CALL]], [[IF_THEN]] ], [ [[P]], [[ENTRY:%.*]] ]
; IS__CGSCC____-NEXT: [[RETVAL_0:%.*]] = phi i32* [ [[ADD_PTR]], [[IF_THEN]] ], [ [[P]], [[ENTRY:%.*]] ]
; IS__CGSCC____-NEXT: call void @user_i32_ptr(i32* noalias nocapture nonnull readnone align 16 [[RETVAL_0]]) #[[ATTR3]]
; IS__CGSCC____-NEXT: ret i32* [[RETVAL_0]]
;
Expand Down Expand Up @@ -1180,7 +1177,7 @@ define i8* @aligned_8_return_caller(i8* align(16) %a, i1 %c1, i1 %c2) {
; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
; IS__CGSCC____-LABEL: define {{[^@]+}}@aligned_8_return_caller
; IS__CGSCC____-SAME: (i8* nofree readnone align 16 [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR12:[0-9]+]] {
; IS__CGSCC____-NEXT: [[R:%.*]] = call align 8 i8* @aligned_8_return(i8* noalias nofree readnone align 16 [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR14:[0-9]+]]
; IS__CGSCC____-NEXT: [[R:%.*]] = call align 8 i8* @aligned_8_return(i8* noalias nofree readnone align 16 [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR13:[0-9]+]]
; IS__CGSCC____-NEXT: ret i8* [[R]]
;
%r = call i8* @aligned_8_return(i8* %a, i1 %c1, i1 %c2)
Expand Down Expand Up @@ -1218,8 +1215,8 @@ attributes #2 = { null_pointer_is_valid }
; IS__CGSCC_OPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readnone willreturn }
; IS__CGSCC_OPM: attributes #[[ATTR11]] = { nofree nosync nounwind readonly willreturn }
; IS__CGSCC_OPM: attributes #[[ATTR12]] = { nofree nosync nounwind readnone willreturn }
; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readonly willreturn }
; IS__CGSCC_OPM: attributes #[[ATTR14]] = { readnone willreturn }
; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readnone willreturn }
; IS__CGSCC_OPM: attributes #[[ATTR14]] = { readonly willreturn }
;.
; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone willreturn uwtable }
; IS__CGSCC_NPM: attributes #[[ATTR1]] = { noinline nounwind uwtable }
Expand All @@ -1234,6 +1231,6 @@ attributes #2 = { null_pointer_is_valid }
; IS__CGSCC_NPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readnone willreturn }
; IS__CGSCC_NPM: attributes #[[ATTR11]] = { nofree nosync nounwind readonly willreturn }
; IS__CGSCC_NPM: attributes #[[ATTR12]] = { nofree nosync nounwind readnone willreturn }
; IS__CGSCC_NPM: attributes #[[ATTR13]] = { readonly willreturn }
; IS__CGSCC_NPM: attributes #[[ATTR14]] = { readnone willreturn }
; IS__CGSCC_NPM: attributes #[[ATTR13]] = { readnone willreturn }
; IS__CGSCC_NPM: attributes #[[ATTR14]] = { readonly willreturn }
;.
20 changes: 14 additions & 6 deletions llvm/test/Transforms/Attributor/allow_list.ll
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ define internal i32 @range_test(i32 %a) #0 {
; CHECK_DISABLED-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
; CHECK_DISABLED-NEXT: ret i32 [[TMP2]]
;
; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable
; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_test
; CHECK_ENABLED-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = icmp sgt i32 [[A]], 100
; CHECK_ENABLED-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
; CHECK_ENABLED-NEXT: ret i32 [[TMP2]]
;
; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_test
; CHECK_DISABLED_FUNCTION-SAME: (i32 [[A:%.*]]) #[[ATTR0:[0-9]+]] {
Expand Down Expand Up @@ -48,8 +55,9 @@ define i32 @range_use1() #0 {
;
; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable
; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_use1
; CHECK_ENABLED-SAME: () #[[ATTR0:[0-9]+]] {
; CHECK_ENABLED-NEXT: ret i32 1
; CHECK_ENABLED-SAME: () #[[ATTR0]] {
; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
; CHECK_ENABLED-NEXT: ret i32 [[TMP1]]
;
; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use1
Expand All @@ -74,10 +82,11 @@ define i32 @range_use2() #0 {
; CHECK_DISABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
; CHECK_DISABLED-NEXT: ret i32 [[TMP1]]
;
; CHECK_ENABLED: Function Attrs: noinline norecurse nounwind uwtable
; CHECK_ENABLED: Function Attrs: noinline nounwind uwtable
; CHECK_ENABLED-LABEL: define {{[^@]+}}@range_use2
; CHECK_ENABLED-SAME: () #[[ATTR1:[0-9]+]] {
; CHECK_ENABLED-NEXT: ret i32 1
; CHECK_ENABLED-SAME: () #[[ATTR0]] {
; CHECK_ENABLED-NEXT: [[TMP1:%.*]] = call i32 @range_test(i32 123)
; CHECK_ENABLED-NEXT: ret i32 [[TMP1]]
;
; CHECK_DISABLED_FUNCTION: Function Attrs: noinline nounwind uwtable
; CHECK_DISABLED_FUNCTION-LABEL: define {{[^@]+}}@range_use2
Expand All @@ -100,7 +109,6 @@ attributes #0 = { nounwind uwtable noinline }
; CHECK_DISABLED: attributes #[[ATTR0]] = { noinline nounwind uwtable }
;.
; CHECK_ENABLED: attributes #[[ATTR0]] = { noinline nounwind uwtable }
; CHECK_ENABLED: attributes #[[ATTR1]] = { noinline norecurse nounwind uwtable }
;.
; CHECK_DISABLED_FUNCTION: attributes #[[ATTR0]] = { noinline nounwind uwtable }
;.
Expand Down
16 changes: 8 additions & 8 deletions llvm/test/Transforms/Attributor/callbacks.ll
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ define internal void @t0_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a,
; IS__TUNIT_OPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8
; IS__TUNIT_OPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4
; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64
; IS__TUNIT_OPM-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 noundef 99, i32* noundef nonnull align 32 dereferenceable(4) [[TMP0]])
; IS__TUNIT_OPM-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 noundef 99, i32* nonnull align 32 [[TMP0]])
; IS__TUNIT_OPM-NEXT: ret void
;
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@t0_callback_callee
Expand All @@ -82,7 +82,7 @@ define internal void @t0_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a,
; IS__TUNIT_NPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8
; IS__TUNIT_NPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4
; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64
; IS__TUNIT_NPM-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 noundef 99, i32* noundef nonnull align 32 dereferenceable(4) [[TMP0]])
; IS__TUNIT_NPM-NEXT: tail call void @t0_check(i32* align 256 [[A]], i64 noundef 99, i32* nonnull align 32 [[TMP0]])
; IS__TUNIT_NPM-NEXT: ret void
;
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t0_callback_callee
Expand Down Expand Up @@ -192,7 +192,7 @@ define internal void @t1_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a,
; IS__TUNIT_OPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8
; IS__TUNIT_OPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4
; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64
; IS__TUNIT_OPM-NEXT: tail call void @t1_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]])
; IS__TUNIT_OPM-NEXT: tail call void @t1_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]])
; IS__TUNIT_OPM-NEXT: ret void
;
; IS__TUNIT_NPM: Function Attrs: nosync
Expand All @@ -202,7 +202,7 @@ define internal void @t1_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a,
; IS__TUNIT_NPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8
; IS__TUNIT_NPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4
; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64
; IS__TUNIT_NPM-NEXT: tail call void @t1_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]])
; IS__TUNIT_NPM-NEXT: tail call void @t1_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]])
; IS__TUNIT_NPM-NEXT: ret void
;
; IS__CGSCC_OPM: Function Attrs: nosync
Expand Down Expand Up @@ -313,7 +313,7 @@ define internal void @t2_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a,
; IS__TUNIT_OPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8
; IS__TUNIT_OPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4
; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64
; IS__TUNIT_OPM-NEXT: tail call void @t2_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]])
; IS__TUNIT_OPM-NEXT: tail call void @t2_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]])
; IS__TUNIT_OPM-NEXT: ret void
;
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@t2_callback_callee
Expand All @@ -322,7 +322,7 @@ define internal void @t2_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a,
; IS__TUNIT_NPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8
; IS__TUNIT_NPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4
; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64
; IS__TUNIT_NPM-NEXT: tail call void @t2_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]])
; IS__TUNIT_NPM-NEXT: tail call void @t2_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]])
; IS__TUNIT_NPM-NEXT: ret void
;
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t2_callback_callee
Expand Down Expand Up @@ -436,7 +436,7 @@ define internal void @t3_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a,
; IS__TUNIT_OPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8
; IS__TUNIT_OPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4
; IS__TUNIT_OPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64
; IS__TUNIT_OPM-NEXT: tail call void @t3_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]])
; IS__TUNIT_OPM-NEXT: tail call void @t3_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]])
; IS__TUNIT_OPM-NEXT: ret void
;
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@t3_callback_callee
Expand All @@ -445,7 +445,7 @@ define internal void @t3_callback_callee(i32* %is_not_null, i32* %ptr, i32* %a,
; IS__TUNIT_NPM-NEXT: [[PTR_VAL:%.*]] = load i32, i32* [[PTR]], align 8
; IS__TUNIT_NPM-NEXT: store i32 [[PTR_VAL]], i32* [[IS_NOT_NULL]], align 4
; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C]], align 64
; IS__TUNIT_NPM-NEXT: tail call void @t3_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture noundef nonnull align 32 dereferenceable(4) [[TMP0]])
; IS__TUNIT_NPM-NEXT: tail call void @t3_check(i32* nocapture align 256 [[A]], i64 noundef 99, i32* nocapture nonnull align 32 [[TMP0]])
; IS__TUNIT_NPM-NEXT: ret void
;
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@t3_callback_callee
Expand Down
18 changes: 7 additions & 11 deletions llvm/test/Transforms/Attributor/cb_liveness_disabled.ll
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ define i32 @test(i32 %0, i32 %1) #0 {
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 0
; IS__TUNIT____-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]]
; IS__TUNIT____: 4:
; IS__TUNIT____-NEXT: [[TMP5:%.*]] = call noundef i32 @test_range1(i32 [[TMP0]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP5:%.*]] = call i32 @test_range1(i32 [[TMP0]])
; IS__TUNIT____-NEXT: br label [[TMP8:%.*]]
; IS__TUNIT____: 6:
; IS__TUNIT____-NEXT: [[TMP7:%.*]] = call noundef i32 @test_range2(i32 [[TMP0]]) #[[ATTR1]], !range [[RNG1:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP7:%.*]] = call i32 @test_range2(i32 [[TMP0]])
; IS__TUNIT____-NEXT: br label [[TMP8]]
; IS__TUNIT____: 8:
; IS__TUNIT____-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ]
Expand Down Expand Up @@ -110,7 +110,7 @@ define i32 @test(i32 %0, i32 %1) #0 {
define i32 @test_pcheck1(i32 %0) #0 {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_pcheck1
; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101
; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP4]]
Expand All @@ -131,7 +131,7 @@ define i32 @test_pcheck1(i32 %0) #0 {
define i32 @test_pcheck2(i32 %0) #0 {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_pcheck2
; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]]
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99
; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP4]]
Expand All @@ -152,7 +152,7 @@ define i32 @test_pcheck2(i32 %0) #0 {
define i32 @test_ncheck1(i32 %0) #0 {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_ncheck1
; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2]]
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50
; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP4]]
Expand All @@ -173,7 +173,7 @@ define i32 @test_ncheck1(i32 %0) #0 {
define i32 @test_ncheck2(i32 %0) #0 {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_ncheck2
; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]]
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150
; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP4]]
Expand All @@ -197,13 +197,9 @@ attributes #0 = { noinline nounwind sspstrong uwtable}
; IS__TUNIT_____: !1 = !{i32 100, i32 201}
;.
; IS__TUNIT____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong willreturn uwtable }
; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn }
;.
; IS__CGSCC____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong willreturn uwtable }
; IS__CGSCC____: attributes #[[ATTR1]] = { nofree noinline nosync nounwind readnone sspstrong willreturn uwtable }
; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { readnone willreturn }
;.
; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 101}
; IS__TUNIT____: [[RNG1]] = !{i32 100, i32 201}
; IS__TUNIT____: [[RNG2]] = !{i32 0, i32 201}
;.
18 changes: 7 additions & 11 deletions llvm/test/Transforms/Attributor/cb_liveness_enabled.ll
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ define i32 @test(i32 %0, i32 %1) #0 {
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 0
; IS__TUNIT____-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]]
; IS__TUNIT____: 4:
; IS__TUNIT____-NEXT: [[TMP5:%.*]] = call noundef i32 @test_range1(i32 [[TMP0]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP5:%.*]] = call i32 @test_range1(i32 [[TMP0]])
; IS__TUNIT____-NEXT: br label [[TMP8:%.*]]
; IS__TUNIT____: 6:
; IS__TUNIT____-NEXT: [[TMP7:%.*]] = call noundef i32 @test_range2(i32 [[TMP0]]) #[[ATTR1]], !range [[RNG1:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP7:%.*]] = call i32 @test_range2(i32 [[TMP0]])
; IS__TUNIT____-NEXT: br label [[TMP8]]
; IS__TUNIT____: 8:
; IS__TUNIT____-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ]
Expand Down Expand Up @@ -110,7 +110,7 @@ define i32 @test(i32 %0, i32 %1) #0 {
define i32 @test_pcheck1(i32 %0) #0 {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_pcheck1
; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101
; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP4]]
Expand All @@ -134,7 +134,7 @@ define i32 @test_pcheck1(i32 %0) #0 {
define i32 @test_pcheck2(i32 %0) #0 {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_pcheck2
; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]]
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99
; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP4]]
Expand All @@ -155,7 +155,7 @@ define i32 @test_pcheck2(i32 %0) #0 {
define i32 @test_ncheck1(i32 %0) #0 {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_ncheck1
; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1) #[[ATTR1]], !range [[RNG2]]
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50
; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP4]]
Expand All @@ -176,7 +176,7 @@ define i32 @test_ncheck1(i32 %0) #0 {
define i32 @test_ncheck2(i32 %0) #0 {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_ncheck2
; IS__TUNIT____-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0) #[[ATTR1]], !range [[RNG2]]
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150
; IS__TUNIT____-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP4]]
Expand All @@ -200,13 +200,9 @@ attributes #0 = { noinline nounwind sspstrong uwtable}
; IS__TUNIT_____: !1 = !{i32 100, i32 201}
;.
; IS__TUNIT____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong willreturn uwtable }
; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn }
;.
; IS__CGSCC____: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone sspstrong willreturn uwtable }
; IS__CGSCC____: attributes #[[ATTR1]] = { nofree noinline nosync nounwind readnone sspstrong willreturn uwtable }
; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { readnone willreturn }
;.
; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 101}
; IS__TUNIT____: [[RNG1]] = !{i32 100, i32 201}
; IS__TUNIT____: [[RNG2]] = !{i32 0, i32 201}
;.
8 changes: 3 additions & 5 deletions llvm/test/Transforms/Attributor/cb_range_disabled.ll
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define i32 @test_range(i32 %unknown) {
define i32 @test1(i32 %unknown, i32 %b) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test1
; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]], i32 [[B:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]])
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = sub nsw i32 [[TMP1]], [[B]]
; IS__TUNIT____-NEXT: ret i32 [[TMP2]]
;
Expand All @@ -42,7 +42,7 @@ define i32 @test1(i32 %unknown, i32 %b) {
define i32 @test2(i32 %unknown, i32 %b) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test2
; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]], i32 [[B:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) #[[ATTR1]], !range [[RNG0]]
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]])
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP1]], [[B]]
; IS__TUNIT____-NEXT: ret i32 [[TMP2]]
;
Expand Down Expand Up @@ -146,11 +146,9 @@ define i32 @test2_ncheck(i32 %unknown) {
}
;.
; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn }
;.
; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { readnone willreturn }
;.
; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 101}
;.
24 changes: 13 additions & 11 deletions llvm/test/Transforms/Attributor/cb_range_enabled.ll
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define i32 @test_range(i32 %unknown) {
define i32 @test1(i32 %unknown, i32 %b) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test1
; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]], i32 [[B:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]])
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = sub nsw i32 [[TMP1]], [[B]]
; IS__TUNIT____-NEXT: ret i32 [[TMP2]]
;
Expand All @@ -42,7 +42,7 @@ define i32 @test1(i32 %unknown, i32 %b) {
define i32 @test2(i32 %unknown, i32 %b) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test2
; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]], i32 [[B:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]]) #[[ATTR1]], !range [[RNG0]]
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test_range(i32 [[UNKNOWN]])
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP1]], [[B]]
; IS__TUNIT____-NEXT: ret i32 [[TMP2]]
;
Expand All @@ -66,7 +66,10 @@ define i32 @test2(i32 %unknown, i32 %b) {
define i32 @test1_pcheck(i32 %unknown) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test1_pcheck
; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: ret i32 1
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test1(i32 [[UNKNOWN]], i32 noundef 20)
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp sle i32 [[TMP1]], 90
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = zext i1 [[TMP2]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP3]]
;
; IS__CGSCC____-LABEL: define {{[^@]+}}@test1_pcheck
; IS__CGSCC____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR1]] {
Expand All @@ -84,7 +87,10 @@ define i32 @test1_pcheck(i32 %unknown) {
define i32 @test2_pcheck(i32 %unknown) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_pcheck
; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: ret i32 1
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test2(i32 [[UNKNOWN]], i32 noundef 20)
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp sge i32 [[TMP1]], 20
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = zext i1 [[TMP2]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP3]]
;
; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_pcheck
; IS__CGSCC____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR1]] {
Expand All @@ -104,7 +110,7 @@ define i32 @test2_pcheck(i32 %unknown) {
define i32 @test1_ncheck(i32 %unknown) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test1_ncheck
; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test1(i32 [[UNKNOWN]], i32 noundef 20) #[[ATTR1]], !range [[RNG1:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test1(i32 [[UNKNOWN]], i32 noundef 20)
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp sle i32 [[TMP1]], 10
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = zext i1 [[TMP2]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP3]]
Expand All @@ -125,7 +131,7 @@ define i32 @test1_ncheck(i32 %unknown) {
define i32 @test2_ncheck(i32 %unknown) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_ncheck
; IS__TUNIT____-SAME: (i32 [[UNKNOWN:%.*]]) #[[ATTR0]] {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test2(i32 [[UNKNOWN]], i32 noundef 20) #[[ATTR1]], !range [[RNG2:![0-9]+]]
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i32 @test2(i32 [[UNKNOWN]], i32 noundef 20)
; IS__TUNIT____-NEXT: [[TMP2:%.*]] = icmp sge i32 [[TMP1]], 30
; IS__TUNIT____-NEXT: [[TMP3:%.*]] = zext i1 [[TMP2]] to i32
; IS__TUNIT____-NEXT: ret i32 [[TMP3]]
Expand All @@ -144,13 +150,9 @@ define i32 @test2_ncheck(i32 %unknown) {
}
;.
; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind readnone willreturn }
;.
; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
; IS__CGSCC____: attributes #[[ATTR2:[0-9]+]] = { readnone willreturn }
;.
; IS__TUNIT____: [[RNG0]] = !{i32 0, i32 101}
; IS__TUNIT____: [[RNG1]] = !{i32 -20, i32 81}
; IS__TUNIT____: [[RNG2]] = !{i32 20, i32 121}
;.
242 changes: 146 additions & 96 deletions llvm/test/Transforms/Attributor/depgraph.ll

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions llvm/test/Transforms/Attributor/dereferenceable-1.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
; FIXME: Figure out why we need 16 iterations here.
Expand Down Expand Up @@ -945,9 +945,10 @@ define void @max_offset(i1 %c) {
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; CHECK: t:
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i8, i8* bitcast (i64* @g to i8*), i64 2
; CHECK-NEXT: br label [[F]]
; CHECK: f:
; CHECK-NEXT: [[PHI:%.*]] = phi i8* [ getelementptr (i8, i8* bitcast (i64* @g to i8*), i64 2), [[T]] ], [ bitcast (i64* @g to i8*), [[ENTRY:%.*]] ]
; CHECK-NEXT: [[PHI:%.*]] = phi i8* [ [[GEP]], [[T]] ], [ bitcast (i64* @g to i8*), [[ENTRY:%.*]] ]
; CHECK-NEXT: call void @unknown_use8(i8* noundef align 2 dereferenceable_or_null(6) [[PHI]]) #[[ATTR1]]
; CHECK-NEXT: ret void
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,11 @@ define i32 @require_cfg_analysis(i32 %c, i32* %p) {
; IS________NPM-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[C]], 0
; IS________NPM-NEXT: br i1 [[TOBOOL1]], label [[L1:%.*]], label [[L2:%.*]]
; IS________NPM: l1:
; IS________NPM-NEXT: br label [[L4:%.*]]
; IS________NPM-NEXT: [[TOBOOL2:%.*]] = icmp eq i32 [[C]], 1
; IS________NPM-NEXT: br i1 [[TOBOOL2]], label [[L3:%.*]], label [[L4:%.*]]
; IS________NPM: l2:
; IS________NPM-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[C]], 2
; IS________NPM-NEXT: br i1 [[TOBOOL3]], label [[L3:%.*]], label [[L4]]
; IS________NPM-NEXT: br i1 [[TOBOOL3]], label [[L3]], label [[L4]]
; IS________NPM: l3:
; IS________NPM-NEXT: br label [[L5:%.*]]
; IS________NPM: l4:
Expand Down
5 changes: 3 additions & 2 deletions llvm/test/Transforms/Attributor/dereferenceable-2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,11 @@ define i32 @require_cfg_analysis(i32 %c, i32* %p) {
; IS________NPM-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[C]], 0
; IS________NPM-NEXT: br i1 [[TOBOOL1]], label [[L1:%.*]], label [[L2:%.*]]
; IS________NPM: l1:
; IS________NPM-NEXT: br label [[L4:%.*]]
; IS________NPM-NEXT: [[TOBOOL2:%.*]] = icmp eq i32 [[C]], 1
; IS________NPM-NEXT: br i1 [[TOBOOL2]], label [[L3:%.*]], label [[L4:%.*]]
; IS________NPM: l2:
; IS________NPM-NEXT: [[TOBOOL3:%.*]] = icmp eq i32 [[C]], 2
; IS________NPM-NEXT: br i1 [[TOBOOL3]], label [[L3:%.*]], label [[L4]]
; IS________NPM-NEXT: br i1 [[TOBOOL3]], label [[L3]], label [[L4]]
; IS________NPM: l3:
; IS________NPM-NEXT: br label [[L5:%.*]]
; IS________NPM: l4:
Expand Down
17 changes: 9 additions & 8 deletions llvm/test/Transforms/Attributor/heap_to_stack.ll
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ define void @h2s_value_simplify_interaction(i1 %c, i8* %A) {
; IS________OPM-LABEL: define {{[^@]+}}@h2s_value_simplify_interaction
; IS________OPM-SAME: (i1 [[C:%.*]], i8* nocapture nofree readnone [[A:%.*]]) {
; IS________OPM-NEXT: entry:
; IS________OPM-NEXT: [[M:%.*]] = tail call noalias align 16 i8* @malloc(i64 noundef 4)
; IS________OPM-NEXT: [[ADD:%.*]] = add i64 2, 2
; IS________OPM-NEXT: [[M:%.*]] = tail call noalias align 16 i8* @malloc(i64 noundef [[ADD]])
; IS________OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; IS________OPM: t:
; IS________OPM-NEXT: br i1 false, label [[DEAD:%.*]], label [[F2:%.*]]
Expand All @@ -57,21 +58,22 @@ define void @h2s_value_simplify_interaction(i1 %c, i8* %A) {
; IS________NPM-LABEL: define {{[^@]+}}@h2s_value_simplify_interaction
; IS________NPM-SAME: (i1 [[C:%.*]], i8* nocapture nofree readnone [[A:%.*]]) {
; IS________NPM-NEXT: entry:
; IS________NPM-NEXT: [[M_H2S:%.*]] = alloca i8, i64 4, align 16
; IS________NPM-NEXT: [[ADD:%.*]] = add i64 2, 2
; IS________NPM-NEXT: [[M:%.*]] = tail call noalias align 16 i8* @malloc(i64 noundef [[ADD]])
; IS________NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
; IS________NPM: t:
; IS________NPM-NEXT: br i1 false, label [[DEAD:%.*]], label [[F2:%.*]]
; IS________NPM: f:
; IS________NPM-NEXT: br label [[J:%.*]]
; IS________NPM: f2:
; IS________NPM-NEXT: [[L:%.*]] = load i8, i8* [[M_H2S]], align 16
; IS________NPM-NEXT: [[L:%.*]] = load i8, i8* [[M]], align 16
; IS________NPM-NEXT: call void @usei8(i8 [[L]])
; IS________NPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[M_H2S]]) #[[ATTR6:[0-9]+]]
; IS________NPM-NEXT: call void @no_sync_func(i8* nocapture nofree noundef align 16 [[M]]) #[[ATTR6:[0-9]+]]
; IS________NPM-NEXT: br label [[J]]
; IS________NPM: dead:
; IS________NPM-NEXT: unreachable
; IS________NPM: j:
; IS________NPM-NEXT: [[PHI:%.*]] = phi i8* [ [[M_H2S]], [[F]] ], [ null, [[F2]] ]
; IS________NPM-NEXT: [[PHI:%.*]] = phi i8* [ [[M]], [[F]] ], [ null, [[F2]] ]
; IS________NPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef align 16 [[PHI]]) #[[ATTR6]]
; IS________NPM-NEXT: ret void
;
Expand Down Expand Up @@ -587,9 +589,8 @@ define i32 @irreducible_cfg(i32 %0) {
; IS________NPM-NEXT: [[TMP13]] = add nsw i32 [[DOT1]], 1
; IS________NPM-NEXT: br label [[TMP7]]
; IS________NPM: 14:
; IS________NPM-NEXT: [[TMP15:%.*]] = bitcast i32* [[TMP2]] to i8*
; IS________NPM-NEXT: [[TMP16:%.*]] = load i32, i32* [[TMP2]], align 4
; IS________NPM-NEXT: ret i32 [[TMP16]]
; IS________NPM-NEXT: [[TMP15:%.*]] = load i32, i32* [[TMP2]], align 4
; IS________NPM-NEXT: ret i32 [[TMP15]]
;
%2 = call noalias i8* @malloc(i64 4)
%3 = bitcast i8* %2 to i32*
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,8 @@ define void @test17() {
; IS________OPM-NEXT: ret void
;
; IS________NPM-LABEL: define {{[^@]+}}@test17() {
; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 4, align 1, addrspace(5)
; IS________NPM-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[TMP1]] to i8*
; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1, addrspace(5)
; IS________NPM-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[DOTH2S]] to i8*
; IS________NPM-NEXT: tail call void @usei8(i8* noalias nocapture nofree [[MALLOC_CAST]]) #[[ATTR6:[0-9]+]]
; IS________NPM-NEXT: ret void
;
Expand Down Expand Up @@ -716,10 +716,10 @@ define void @move_alloca() {
;
; IS________NPM-LABEL: define {{[^@]+}}@move_alloca() {
; IS________NPM-NEXT: entry:
; IS________NPM-NEXT: [[TMP0:%.*]] = alloca i8, i64 4, align 1, addrspace(5)
; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 4, align 1, addrspace(5)
; IS________NPM-NEXT: br label [[NOT_ENTRY:%.*]]
; IS________NPM: not_entry:
; IS________NPM-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[TMP0]] to i8*
; IS________NPM-NEXT: [[MALLOC_CAST:%.*]] = addrspacecast i8 addrspace(5)* [[DOTH2S]] to i8*
; IS________NPM-NEXT: tail call void @usei8(i8* noalias nocapture nofree [[MALLOC_CAST]]) #[[ATTR6]]
; IS________NPM-NEXT: ret void
;
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/Attributor/internal-noalias.ll
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM

define dso_local i32 @visible(i32* noalias %A, i32* noalias %B) #0 {
; IS__TUNIT____: Function Attrs: argmemonly nofree noinline norecurse nosync nounwind readonly willreturn uwtable
; IS__TUNIT____-LABEL: define {{[^@]+}}@visible
; IS__TUNIT____-SAME: (i32* noalias nocapture nofree readonly align 4 [[A:%.*]], i32* noalias nocapture nofree readonly align 4 [[B:%.*]]) #[[ATTR0:[0-9]+]] {
; IS__TUNIT____-SAME: (i32* noalias nocapture nofree readonly [[A:%.*]], i32* noalias nocapture nofree readonly align 4 [[B:%.*]]) #[[ATTR0:[0-9]+]] {
; IS__TUNIT____-NEXT: entry:
; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(i32* noalias nocapture nofree readonly align 4 [[A]], i32* noalias nocapture nofree readonly align 4 [[B]]) #[[ATTR3:[0-9]+]]
; IS__TUNIT____-NEXT: [[CALL2:%.*]] = call i32 @noalias_args_argmem(i32* noalias nocapture nofree readonly align 4 [[A]], i32* noalias nocapture nofree readonly align 4 [[B]]) #[[ATTR3]]
Expand Down Expand Up @@ -166,7 +166,7 @@ define i32 @visible_local_2() {
; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@visible_local_2
; IS__CGSCC_NPM-SAME: () #[[ATTR3:[0-9]+]] {
; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem_ro(i32 noundef 5, i32 noundef 5) #[[ATTR6:[0-9]+]]
; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32 @noalias_args_argmem_ro(i32 5, i32 5) #[[ATTR6:[0-9]+]]
; IS__CGSCC_NPM-NEXT: ret i32 [[CALL]]
;
%B = alloca i32, align 4
Expand Down
64 changes: 27 additions & 37 deletions llvm/test/Transforms/Attributor/liveness.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=30 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=30 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; TODO: The old pass manager cgscc run is disabled as it causes a crash on windows which is under investigation: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23151
; opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
Expand Down Expand Up @@ -501,22 +501,22 @@ cleanup:
; FIXME: Should be able to detect undefined behavior.

define void @ub(i32* %0) {
; IS________OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS________OPM-LABEL: define {{[^@]+}}@ub
; IS________OPM-SAME: (i32* nocapture nofree writeonly [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] {
; IS________OPM-NEXT: store i32 0, i32* [[TMP0]], align 4
; IS________OPM-NEXT: ret void
;
; IS__TUNIT_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ub
; IS__TUNIT_NPM-SAME: (i32* nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] {
; IS__TUNIT_NPM-NEXT: store i32 0, i32* undef, align 4294967296
; IS__TUNIT_NPM-NEXT: ret void
; NOT_CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@ub
; NOT_CGSCC_NPM-SAME: (i32* nocapture nofree writeonly [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] {
; NOT_CGSCC_NPM-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1
; NOT_CGSCC_NPM-NEXT: [[STILL_POISON:%.*]] = and i32 [[POISON]], 0
; NOT_CGSCC_NPM-NEXT: [[POISON_YET_AGAIN:%.*]] = getelementptr i32, i32* [[TMP0]], i32 [[STILL_POISON]]
; NOT_CGSCC_NPM-NEXT: store i32 0, i32* [[POISON_YET_AGAIN]], align 4
; NOT_CGSCC_NPM-NEXT: ret void
;
; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
; IS__CGSCC____-LABEL: define {{[^@]+}}@ub
; IS__CGSCC____-SAME: (i32* nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR9:[0-9]+]] {
; IS__CGSCC____-NEXT: store i32 0, i32* undef, align 4294967296
; IS__CGSCC____-SAME: (i32* nocapture nofree writeonly [[TMP0:%.*]]) #[[ATTR9:[0-9]+]] {
; IS__CGSCC____-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1
; IS__CGSCC____-NEXT: [[STILL_POISON:%.*]] = and i32 [[POISON]], 0
; IS__CGSCC____-NEXT: [[POISON_YET_AGAIN:%.*]] = getelementptr i32, i32* [[TMP0]], i32 [[STILL_POISON]]
; IS__CGSCC____-NEXT: store i32 0, i32* [[POISON_YET_AGAIN]], align 4
; IS__CGSCC____-NEXT: ret void
;
%poison = sub nuw i32 0, 1 ; Results in a poison value.
Expand Down Expand Up @@ -2284,29 +2284,19 @@ define void @call_via_pointer_with_dead_args(i32* %a, i32* %b, void (i32*, i32*,
}

define internal void @call_via_pointer_with_dead_args_internal_a(i32* %a, i32* %b, void (i32*, i32*, i32*, i64, i32**)* %fp) {
; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a
; NOT_CGSCC_NPM-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {
; NOT_CGSCC_NPM-NEXT: call void poison(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
; NOT_CGSCC_NPM-NEXT: ret void
;
; IS__CGSCC____-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a
; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull [[FP:%.*]]) {
; IS__CGSCC____-NEXT: call void [[FP]](i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
; IS__CGSCC____-NEXT: ret void
; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a
; CHECK-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {
; CHECK-NEXT: call void poison(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
; CHECK-NEXT: ret void
;
call void %fp(i32* %a, i32* %b, i32* %a, i64 -1, i32** null)
ret void
}
define internal void @call_via_pointer_with_dead_args_internal_b(i32* %a, i32* %b, void (i32*, i32*, i32*, i64, i32**)* %fp) {
; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b
; NOT_CGSCC_NPM-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {
; NOT_CGSCC_NPM-NEXT: call void poison(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
; NOT_CGSCC_NPM-NEXT: ret void
;
; IS__CGSCC____-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b
; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull [[FP:%.*]]) {
; IS__CGSCC____-NEXT: call void [[FP]](i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
; IS__CGSCC____-NEXT: ret void
; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b
; CHECK-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {
; CHECK-NEXT: call void poison(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
; CHECK-NEXT: ret void
;
call void %fp(i32* %a, i32* %b, i32* %a, i64 -1, i32** null)
ret void
Expand All @@ -2332,8 +2322,8 @@ define void @call_via_pointer_with_dead_args_caller(i32* %a, i32* %b) {
; IS__CGSCC____-NEXT: [[PTR4:%.*]] = alloca i32, align 128
; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args(i32* [[A]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR1]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer)
; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args(i32* [[A]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR2]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer_internal_1)
; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args_internal_a(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR3]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer)
; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args_internal_b(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR4]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer_internal_2)
; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args_internal_a(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR3]])
; IS__CGSCC____-NEXT: call void @call_via_pointer_with_dead_args_internal_b(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR4]])
; IS__CGSCC____-NEXT: ret void
;
%ptr1 = alloca i32, align 128
Expand Down Expand Up @@ -2375,7 +2365,7 @@ entry:
; FIXME: Figure out why the MODULE has the unused arguments still
define internal void @called_via_pointer_internal_2(i32* %a, i32* %b, i32* %c, i64 %d, i32** %e) {
; IS__CGSCC____-LABEL: define {{[^@]+}}@called_via_pointer_internal_2
; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* nocapture nofree readnone [[B:%.*]], i32* nocapture nofree readnone [[C:%.*]], i64 [[D:%.*]], i32** nocapture nofree readnone [[E:%.*]]) {
; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* [[B:%.*]], i32* [[C:%.*]], i64 [[D:%.*]], i32** [[E:%.*]]) {
; IS__CGSCC____-NEXT: entry:
; IS__CGSCC____-NEXT: tail call void @use_i32p(i32* [[A]])
; IS__CGSCC____-NEXT: tail call void @use_i32p(i32* [[A]])
Expand Down Expand Up @@ -2668,7 +2658,7 @@ declare void @llvm.lifetime.end.p0i8(i64 %0, i8* %1)
; NOT_CGSCC_NPM: attributes #[[ATTR4]] = { noreturn }
; NOT_CGSCC_NPM: attributes #[[ATTR5]] = { nosync readnone }
; NOT_CGSCC_NPM: attributes #[[ATTR6]] = { argmemonly nofree norecurse nounwind willreturn uwtable }
; NOT_CGSCC_NPM: attributes #[[ATTR7:[0-9]+]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
; NOT_CGSCC_NPM: attributes #[[ATTR7]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
; NOT_CGSCC_NPM: attributes #[[ATTR8]] = { nofree norecurse noreturn nosync nounwind readnone }
; NOT_CGSCC_NPM: attributes #[[ATTR9]] = { nofree nosync nounwind readnone willreturn }
; NOT_CGSCC_NPM: attributes #[[ATTR10]] = { nofree nosync nounwind willreturn }
Expand Down
73 changes: 28 additions & 45 deletions llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM

Expand Down Expand Up @@ -28,11 +28,12 @@ define i8 @test1(i32 %a, i32 %length) {
; IS________NPM-NEXT: br label [[LOOP:%.*]]
; IS________NPM: loop:
; IS________NPM-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
; IS________NPM-NEXT: br label [[BACKEDGE]]
; IS________NPM-NEXT: [[CND:%.*]] = icmp sge i32 [[IV]], 0
; IS________NPM-NEXT: br i1 [[CND]], label [[BACKEDGE]], label [[EXIT:%.*]]
; IS________NPM: backedge:
; IS________NPM-NEXT: [[IV_NEXT]] = add nsw i32 [[IV]], 1
; IS________NPM-NEXT: [[CONT:%.*]] = icmp slt i32 [[IV_NEXT]], 400
; IS________NPM-NEXT: br i1 [[CONT]], label [[LOOP]], label [[EXIT:%.*]]
; IS________NPM-NEXT: br i1 [[CONT]], label [[LOOP]], label [[EXIT]]
; IS________NPM: exit:
; IS________NPM-NEXT: ret i8 0
;
Expand Down Expand Up @@ -84,8 +85,10 @@ define i8 @test2(i32 %n) {
; IS________NPM: loop:
; IS________NPM-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
; IS________NPM-NEXT: [[IV2:%.*]] = phi i32 [ [[N]], [[ENTRY]] ], [ [[IV2_NEXT:%.*]], [[BACKEDGE]] ]
; IS________NPM-NEXT: [[CND1:%.*]] = icmp sge i32 [[IV]], 0
; IS________NPM-NEXT: [[CND2:%.*]] = icmp sgt i32 [[IV2]], 0
; IS________NPM-NEXT: br i1 [[CND2]], label [[BACKEDGE]], label [[EXIT:%.*]]
; IS________NPM-NEXT: [[CND:%.*]] = and i1 [[CND1]], [[CND2]]
; IS________NPM-NEXT: br i1 [[CND]], label [[BACKEDGE]], label [[EXIT:%.*]]
; IS________NPM: backedge:
; IS________NPM-NEXT: [[IV_NEXT]] = add nsw i32 [[IV]], 1
; IS________NPM-NEXT: [[IV2_NEXT]] = sub nsw i32 [[IV2]], 1
Expand Down Expand Up @@ -122,46 +125,26 @@ exit:

; Merging cont block into do block.
define i32 @test3(i32 %i, i1 %f, i32 %n) {
; IS________OPM-LABEL: define {{[^@]+}}@test3
; IS________OPM-SAME: (i32 [[I:%.*]], i1 [[F:%.*]], i32 [[N:%.*]]) {
; IS________OPM-NEXT: entry:
; IS________OPM-NEXT: [[C:%.*]] = icmp ne i32 [[I]], -2134
; IS________OPM-NEXT: br i1 [[C]], label [[DO:%.*]], label [[EXIT:%.*]]
; IS________OPM: exit:
; IS________OPM-NEXT: [[C1:%.*]] = icmp ne i32 [[I]], -42
; IS________OPM-NEXT: br i1 [[C1]], label [[EXIT2:%.*]], label [[EXIT]]
; IS________OPM: cont:
; IS________OPM-NEXT: [[COND_3:%.*]] = icmp sgt i32 [[I]], [[N]]
; IS________OPM-NEXT: br i1 [[COND_3]], label [[EXIT2]], label [[EXIT]]
; IS________OPM: do:
; IS________OPM-NEXT: [[COND_0:%.*]] = icmp sgt i32 [[I]], 0
; IS________OPM-NEXT: [[CONSUME:%.*]] = call i32 @consume(i1 [[COND_0]])
; IS________OPM-NEXT: [[COND:%.*]] = icmp eq i32 [[I]], 0
; IS________OPM-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND]]) [ "deopt"() ]
; IS________OPM-NEXT: [[COND_2:%.*]] = icmp sgt i32 [[I]], 0
; IS________OPM-NEXT: br i1 [[COND_2]], label [[EXIT]], label [[CONT:%.*]]
; IS________OPM: exit2:
; IS________OPM-NEXT: ret i32 30
;
; IS________NPM-LABEL: define {{[^@]+}}@test3
; IS________NPM-SAME: (i32 [[I:%.*]], i1 [[F:%.*]], i32 [[N:%.*]]) {
; IS________NPM-NEXT: entry:
; IS________NPM-NEXT: [[C:%.*]] = icmp ne i32 [[I]], -2134
; IS________NPM-NEXT: br i1 [[C]], label [[DO:%.*]], label [[EXIT:%.*]]
; IS________NPM: exit:
; IS________NPM-NEXT: [[C1:%.*]] = icmp ne i32 [[I]], -42
; IS________NPM-NEXT: br i1 [[C1]], label [[EXIT2:%.*]], label [[EXIT]]
; IS________NPM: cont:
; IS________NPM-NEXT: [[COND_3:%.*]] = icmp sgt i32 [[I]], [[N]]
; IS________NPM-NEXT: br i1 [[COND_3]], label [[EXIT2]], label [[EXIT]]
; IS________NPM: do:
; IS________NPM-NEXT: [[COND_0:%.*]] = icmp sgt i32 [[I]], 0
; IS________NPM-NEXT: [[CONSUME:%.*]] = call i32 @consume(i1 [[COND_0]])
; IS________NPM-NEXT: [[COND:%.*]] = icmp eq i32 [[I]], 0
; IS________NPM-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND]]) [ "deopt"() ]
; IS________NPM-NEXT: br label [[CONT:%.*]]
; IS________NPM: exit2:
; IS________NPM-NEXT: ret i32 30
; CHECK-LABEL: define {{[^@]+}}@test3
; CHECK-SAME: (i32 [[I:%.*]], i1 [[F:%.*]], i32 [[N:%.*]]) {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[I]], -2134
; CHECK-NEXT: br i1 [[C]], label [[DO:%.*]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: [[C1:%.*]] = icmp ne i32 [[I]], -42
; CHECK-NEXT: br i1 [[C1]], label [[EXIT2:%.*]], label [[EXIT]]
; CHECK: cont:
; CHECK-NEXT: [[COND_3:%.*]] = icmp sgt i32 [[I]], [[N]]
; CHECK-NEXT: br i1 [[COND_3]], label [[EXIT2]], label [[EXIT]]
; CHECK: do:
; CHECK-NEXT: [[COND_0:%.*]] = icmp sgt i32 [[I]], 0
; CHECK-NEXT: [[CONSUME:%.*]] = call i32 @consume(i1 [[COND_0]])
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[I]], 0
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[COND]]) [ "deopt"() ]
; CHECK-NEXT: [[COND_2:%.*]] = icmp sgt i32 [[I]], 0
; CHECK-NEXT: br i1 [[COND_2]], label [[EXIT]], label [[CONT:%.*]]
; CHECK: exit2:
; CHECK-NEXT: ret i32 30
;
entry:
%c = icmp ne i32 %i, -2134
Expand Down
61 changes: 21 additions & 40 deletions llvm/test/Transforms/Attributor/lvi-for-ashr.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,26 @@
; FIXME: DOT should be replaced with 3

define i32 @test-ashr(i32 %c) {
; IS________OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
; IS________OPM-LABEL: define {{[^@]+}}@test-ashr
; IS________OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] {
; IS________OPM-NEXT: chk65:
; IS________OPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[C]], 65
; IS________OPM-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[CHK0:%.*]]
; IS________OPM: chk0:
; IS________OPM-NEXT: [[CMP1:%.*]] = icmp slt i32 [[C]], 0
; IS________OPM-NEXT: br i1 [[CMP]], label [[RETURN]], label [[BB_IF:%.*]]
; IS________OPM: bb_if:
; IS________OPM-NEXT: [[ASHR_VAL:%.*]] = ashr exact i32 [[C]], 2
; IS________OPM-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[ASHR_VAL]], 15
; IS________OPM-NEXT: br i1 [[CMP2]], label [[BB_THEN:%.*]], label [[RETURN]]
; IS________OPM: bb_then:
; IS________OPM-NEXT: [[CMP3:%.*]] = icmp eq i32 [[ASHR_VAL]], 16
; IS________OPM-NEXT: [[DOT:%.*]] = select i1 [[CMP3]], i32 3, i32 2
; IS________OPM-NEXT: br label [[RETURN]]
; IS________OPM: return:
; IS________OPM-NEXT: [[RETVAL:%.*]] = phi i32 [ 0, [[CHK65:%.*]] ], [ 1, [[CHK0]] ], [ [[DOT]], [[BB_THEN]] ], [ 4, [[BB_IF]] ]
; IS________OPM-NEXT: ret i32 [[RETVAL]]
;
; IS________NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
; IS________NPM-LABEL: define {{[^@]+}}@test-ashr
; IS________NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] {
; IS________NPM-NEXT: chk65:
; IS________NPM-NEXT: [[CMP:%.*]] = icmp sgt i32 [[C]], 65
; IS________NPM-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[CHK0:%.*]]
; IS________NPM: chk0:
; IS________NPM-NEXT: [[CMP1:%.*]] = icmp slt i32 [[C]], 0
; IS________NPM-NEXT: br i1 [[CMP]], label [[RETURN]], label [[BB_IF:%.*]]
; IS________NPM: bb_if:
; IS________NPM-NEXT: [[ASHR_VAL:%.*]] = ashr exact i32 [[C]], 2
; IS________NPM-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[ASHR_VAL]], 15
; IS________NPM-NEXT: br i1 [[CMP2]], label [[BB_THEN:%.*]], label [[RETURN]]
; IS________NPM: bb_then:
; IS________NPM-NEXT: br label [[RETURN]]
; IS________NPM: return:
; IS________NPM-NEXT: [[RETVAL:%.*]] = phi i32 [ 0, [[CHK65:%.*]] ], [ 1, [[CHK0]] ], [ 3, [[BB_THEN]] ], [ 4, [[BB_IF]] ]
; IS________NPM-NEXT: ret i32 [[RETVAL]]
; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
; CHECK-LABEL: define {{[^@]+}}@test-ashr
; CHECK-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: chk65:
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[C]], 65
; CHECK-NEXT: br i1 [[CMP]], label [[RETURN:%.*]], label [[CHK0:%.*]]
; CHECK: chk0:
; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[C]], 0
; CHECK-NEXT: br i1 [[CMP]], label [[RETURN]], label [[BB_IF:%.*]]
; CHECK: bb_if:
; CHECK-NEXT: [[ASHR_VAL:%.*]] = ashr exact i32 [[C]], 2
; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[ASHR_VAL]], 15
; CHECK-NEXT: br i1 [[CMP2]], label [[BB_THEN:%.*]], label [[RETURN]]
; CHECK: bb_then:
; CHECK-NEXT: [[CMP3:%.*]] = icmp eq i32 [[ASHR_VAL]], 16
; CHECK-NEXT: [[DOT:%.*]] = select i1 [[CMP3]], i32 3, i32 2
; CHECK-NEXT: br label [[RETURN]]
; CHECK: return:
; CHECK-NEXT: [[RETVAL:%.*]] = phi i32 [ 0, [[CHK65:%.*]] ], [ 1, [[CHK0]] ], [ [[DOT]], [[BB_THEN]] ], [ 4, [[BB_IF]] ]
; CHECK-NEXT: ret i32 [[RETVAL]]
;
chk65:
%cmp = icmp sgt i32 %c, 65
Expand All @@ -70,5 +51,5 @@ return:
ret i32 %retval
}
;.
; CHECK: attributes #[[ATTR0:[0-9]+]] = { nofree norecurse nosync nounwind readnone willreturn }
; CHECK: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
;.
22 changes: 12 additions & 10 deletions llvm/test/Transforms/Attributor/memory_locations.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=10 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=10 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
Expand Down Expand Up @@ -528,6 +528,7 @@ define internal i8 @recursive_not_readnone_internal(i8* %ptr, i1 %c) {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 noundef false) #[[ATTR11]]
; IS__TUNIT____-NEXT: ret i8 1
; IS__TUNIT____: f:
; IS__TUNIT____-NEXT: store i8 1, i8* [[PTR]], align 1
; IS__TUNIT____-NEXT: ret i8 0
;
; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind writeonly
Expand Down Expand Up @@ -558,14 +559,14 @@ define i8 @readnone_caller(i1 %c) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@readnone_caller
; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR9:[0-9]+]] {
; IS__TUNIT____-NEXT: [[A:%.*]] = alloca i8, align 1
; IS__TUNIT____-NEXT: [[R:%.*]] = call noundef i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR11]], !range [[RNG0:![0-9]+]]
; IS__TUNIT____-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR11]]
; IS__TUNIT____-NEXT: ret i8 [[R]]
;
; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone
; IS__CGSCC____-LABEL: define {{[^@]+}}@readnone_caller
; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR10:[0-9]+]] {
; IS__CGSCC____-NEXT: [[A:%.*]] = alloca i8, align 1
; IS__CGSCC____-NEXT: [[R:%.*]] = call noundef i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR13:[0-9]+]]
; IS__CGSCC____-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[A]], i1 [[C]]) #[[ATTR13:[0-9]+]]
; IS__CGSCC____-NEXT: ret i8 [[R]]
;
%a = alloca i8
Expand All @@ -583,6 +584,7 @@ define internal i8 @recursive_readnone_internal2(i8* %ptr, i1 %c) {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i8 @recursive_readnone_internal2(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 noundef false) #[[ATTR11]]
; IS__TUNIT____-NEXT: ret i8 1
; IS__TUNIT____: f:
; IS__TUNIT____-NEXT: store i8 1, i8* [[PTR]], align 1
; IS__TUNIT____-NEXT: ret i8 0
;
; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind writeonly
Expand All @@ -594,6 +596,7 @@ define internal i8 @recursive_readnone_internal2(i8* %ptr, i1 %c) {
; IS__CGSCC____-NEXT: [[TMP1:%.*]] = call i8 @recursive_readnone_internal2(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 noundef false) #[[ATTR12]]
; IS__CGSCC____-NEXT: ret i8 1
; IS__CGSCC____: f:
; IS__CGSCC____-NEXT: store i8 1, i8* [[PTR]], align 1
; IS__CGSCC____-NEXT: ret i8 0
;
%alloc = alloca i8
Expand All @@ -611,13 +614,13 @@ define i8 @readnone_caller2(i1 %c) {
; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone
; IS__TUNIT____-LABEL: define {{[^@]+}}@readnone_caller2
; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR9]] {
; IS__TUNIT____-NEXT: [[R:%.*]] = call noundef i8 @recursive_readnone_internal2(i8* undef, i1 [[C]]) #[[ATTR11]], !range [[RNG0]]
; IS__TUNIT____-NEXT: [[R:%.*]] = call i8 @recursive_readnone_internal2(i8* undef, i1 [[C]]) #[[ATTR11]]
; IS__TUNIT____-NEXT: ret i8 [[R]]
;
; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone
; IS__CGSCC____-LABEL: define {{[^@]+}}@readnone_caller2
; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR10]] {
; IS__CGSCC____-NEXT: [[R:%.*]] = call noundef i8 @recursive_readnone_internal2(i8* undef, i1 [[C]]) #[[ATTR13]]
; IS__CGSCC____-NEXT: [[R:%.*]] = call i8 @recursive_readnone_internal2(i8* undef, i1 [[C]]) #[[ATTR13]]
; IS__CGSCC____-NEXT: ret i8 [[R]]
;
%r = call i8 @recursive_readnone_internal2(i8* undef, i1 %c)
Expand All @@ -634,6 +637,7 @@ define internal i8 @recursive_not_readnone_internal3(i8* %ptr, i1 %c) {
; IS__TUNIT____-NEXT: [[TMP1:%.*]] = call i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 noundef false) #[[ATTR11]]
; IS__TUNIT____-NEXT: ret i8 1
; IS__TUNIT____: f:
; IS__TUNIT____-NEXT: store i8 1, i8* [[PTR]], align 1
; IS__TUNIT____-NEXT: ret i8 0
;
; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind writeonly
Expand Down Expand Up @@ -664,14 +668,14 @@ define i8 @readnone_caller3(i1 %c) {
; IS__TUNIT____-LABEL: define {{[^@]+}}@readnone_caller3
; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR9]] {
; IS__TUNIT____-NEXT: [[ALLOC:%.*]] = alloca i8, align 1
; IS__TUNIT____-NEXT: [[R:%.*]] = call noundef i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR11]], !range [[RNG0]]
; IS__TUNIT____-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR11]]
; IS__TUNIT____-NEXT: ret i8 [[R]]
;
; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone
; IS__CGSCC____-LABEL: define {{[^@]+}}@readnone_caller3
; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR10]] {
; IS__CGSCC____-NEXT: [[ALLOC:%.*]] = alloca i8, align 1
; IS__CGSCC____-NEXT: [[R:%.*]] = call noundef i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR13]]
; IS__CGSCC____-NEXT: [[R:%.*]] = call i8 @recursive_not_readnone_internal3(i8* noalias nocapture nofree noundef nonnull writeonly dereferenceable(1) [[ALLOC]], i1 [[C]]) #[[ATTR13]]
; IS__CGSCC____-NEXT: ret i8 [[R]]
;
%alloc = alloca i8
Expand Down Expand Up @@ -735,5 +739,3 @@ define void @argmemonky_caller() {
; IS__CGSCC____: attributes #[[ATTR12]] = { nofree nosync nounwind writeonly }
; IS__CGSCC____: attributes #[[ATTR13]] = { nounwind writeonly }
;.
; IS__TUNIT____: [[RNG0]] = !{i8 0, i8 2}
;.
40 changes: 11 additions & 29 deletions llvm/test/Transforms/Attributor/noalias.ll
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,11 @@ define void @test12_4(){
; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@test12_4() {
; NOT_TUNIT_OPM-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
; NOT_TUNIT_OPM-NEXT: [[B:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
; NOT_TUNIT_OPM-NEXT: [[A_0:%.*]] = getelementptr i8, i8* [[A]], i64 0
; NOT_TUNIT_OPM-NEXT: [[A_1:%.*]] = getelementptr i8, i8* [[A]], i64 1
; NOT_TUNIT_OPM-NEXT: [[B_0:%.*]] = getelementptr i8, i8* [[B]], i64 0
; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* noalias nocapture [[A]], i8* noalias nocapture [[B]])
; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A_0]])
; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A]])
; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A_1]])
; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A_0]], i8* nocapture [[B_0]])
; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[B]])
; NOT_TUNIT_OPM-NEXT: ret void
;
%A = tail call noalias i8* @malloc(i64 4)
Expand Down Expand Up @@ -499,17 +497,10 @@ define void @use_i8_internal(i8* %a) {
}

define void @test13_use_noalias(){
; IS________OPM-LABEL: define {{[^@]+}}@test13_use_noalias() {
; IS________OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
; IS________OPM-NEXT: call void @use_i8_internal(i8* noalias nocapture [[M1]])
; IS________OPM-NEXT: ret void
;
; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@test13_use_noalias() {
; NOT_TUNIT_OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
; NOT_TUNIT_OPM-NEXT: [[C1:%.*]] = bitcast i8* [[M1]] to i16*
; NOT_TUNIT_OPM-NEXT: [[C2:%.*]] = bitcast i16* [[C1]] to i8*
; NOT_TUNIT_OPM-NEXT: call void @use_i8_internal(i8* noalias nocapture [[C2]])
; NOT_TUNIT_OPM-NEXT: ret void
; CHECK-LABEL: define {{[^@]+}}@test13_use_noalias() {
; CHECK-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
; CHECK-NEXT: call void @use_i8_internal(i8* noalias nocapture [[M1]])
; CHECK-NEXT: ret void
;
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test13_use_noalias()
; IS__CGSCC_OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 4)
Expand All @@ -525,20 +516,11 @@ define void @test13_use_noalias(){
}

define void @test13_use_alias(){
; IS________OPM-LABEL: define {{[^@]+}}@test13_use_alias() {
; IS________OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
; IS________OPM-NEXT: call void @use_i8_internal(i8* nocapture [[M1]])
; IS________OPM-NEXT: call void @use_i8_internal(i8* nocapture [[M1]])
; IS________OPM-NEXT: ret void
;
; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@test13_use_alias() {
; NOT_TUNIT_OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
; NOT_TUNIT_OPM-NEXT: [[C1:%.*]] = bitcast i8* [[M1]] to i16*
; NOT_TUNIT_OPM-NEXT: [[C2A:%.*]] = bitcast i16* [[C1]] to i8*
; NOT_TUNIT_OPM-NEXT: [[C2B:%.*]] = bitcast i16* [[C1]] to i8*
; NOT_TUNIT_OPM-NEXT: call void @use_i8_internal(i8* nocapture [[C2A]])
; NOT_TUNIT_OPM-NEXT: call void @use_i8_internal(i8* nocapture [[C2B]])
; NOT_TUNIT_OPM-NEXT: ret void
; CHECK-LABEL: define {{[^@]+}}@test13_use_alias() {
; CHECK-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 noundef 4)
; CHECK-NEXT: call void @use_i8_internal(i8* nocapture [[M1]])
; CHECK-NEXT: call void @use_i8_internal(i8* nocapture [[M1]])
; CHECK-NEXT: ret void
;
%m1 = tail call noalias i8* @malloc(i64 4)
%c1 = bitcast i8* %m1 to i16*
Expand Down
116 changes: 56 additions & 60 deletions llvm/test/Transforms/Attributor/nocapture-1.ll

Large diffs are not rendered by default.

166 changes: 105 additions & 61 deletions llvm/test/Transforms/Attributor/nocapture-2.ll

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions llvm/test/Transforms/Attributor/nonnull.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=13 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM

Expand Down
37 changes: 24 additions & 13 deletions llvm/test/Transforms/Attributor/norecurse.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM

Expand Down Expand Up @@ -257,16 +257,27 @@ Dead:
}

define i1 @test_rec_neg(i1 %c) norecurse {
; CHECK: Function Attrs: norecurse
; CHECK-LABEL: define {{[^@]+}}@test_rec_neg
; CHECK-SAME: (i1 [[C:%.*]]) #[[ATTR8:[0-9]+]] {
; CHECK-NEXT: [[RC1:%.*]] = call noundef i1 @rec(i1 noundef true)
; CHECK-NEXT: br i1 [[RC1]], label [[T:%.*]], label [[F:%.*]]
; CHECK: t:
; CHECK-NEXT: [[RC2:%.*]] = call noundef i1 @rec(i1 [[C]])
; CHECK-NEXT: ret i1 [[RC2]]
; CHECK: f:
; CHECK-NEXT: ret i1 [[RC1]]
; IS__TUNIT____: Function Attrs: norecurse
; IS__TUNIT____-LABEL: define {{[^@]+}}@test_rec_neg
; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR8:[0-9]+]] {
; IS__TUNIT____-NEXT: [[RC1:%.*]] = call i1 @rec(i1 noundef true)
; IS__TUNIT____-NEXT: br i1 [[RC1]], label [[T:%.*]], label [[F:%.*]]
; IS__TUNIT____: t:
; IS__TUNIT____-NEXT: [[RC2:%.*]] = call i1 @rec(i1 [[C]])
; IS__TUNIT____-NEXT: ret i1 [[RC2]]
; IS__TUNIT____: f:
; IS__TUNIT____-NEXT: ret i1 [[RC1]]
;
; IS__CGSCC____: Function Attrs: norecurse
; IS__CGSCC____-LABEL: define {{[^@]+}}@test_rec_neg
; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR8:[0-9]+]] {
; IS__CGSCC____-NEXT: [[RC1:%.*]] = call noundef i1 @rec(i1 noundef true)
; IS__CGSCC____-NEXT: br i1 [[RC1]], label [[T:%.*]], label [[F:%.*]]
; IS__CGSCC____: t:
; IS__CGSCC____-NEXT: [[RC2:%.*]] = call noundef i1 @rec(i1 [[C]])
; IS__CGSCC____-NEXT: ret i1 [[RC2]]
; IS__CGSCC____: f:
; IS__CGSCC____-NEXT: ret i1 [[RC1]]
;
%rc1 = call i1 @rec(i1 true)
br i1 %rc1, label %t, label %f
Expand Down Expand Up @@ -306,6 +317,6 @@ f:
; CHECK: attributes #[[ATTR5:[0-9]+]] = { argmemonly nofree nounwind willreturn }
; CHECK: attributes #[[ATTR6]] = { norecurse nosync readnone }
; CHECK: attributes #[[ATTR7]] = { null_pointer_is_valid }
; CHECK: attributes #[[ATTR8]] = { norecurse }
; CHECK: attributes #[[ATTR8:[0-9]+]] = { norecurse }
; CHECK: attributes #[[ATTR9]] = { willreturn }
;.
4 changes: 2 additions & 2 deletions llvm/test/Transforms/Attributor/openmp_parallel.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM

Expand Down
Loading