Index: llvm/lib/Transforms/IPO/AttributorAttributes.cpp =================================================================== --- llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -7715,7 +7715,8 @@ indicatePessimisticFixpoint(); else if (isa(V)) indicateOptimisticFixpoint(); - else if (isGuaranteedNotToBeUndefOrPoison(&V)) + else if (getPositionKind() != IRPosition::IRP_RETURNED && + isGuaranteedNotToBeUndefOrPoison(&V)) indicateOptimisticFixpoint(); else AANoUndef::initialize(A); Index: llvm/test/Transforms/Attributor/ArgumentPromotion/X86/thiscall.ll =================================================================== --- llvm/test/Transforms/Attributor/ArgumentPromotion/X86/thiscall.ll +++ llvm/test/Transforms/Attributor/ArgumentPromotion/X86/thiscall.ll @@ -48,18 +48,18 @@ define void @exportedfun(%struct.a* %a) { ; IS__TUNIT____-LABEL: define {{[^@]+}}@exportedfun ; IS__TUNIT____-SAME: (%struct.a* nocapture nofree readnone [[A:%.*]]) -; IS__TUNIT____-NEXT: [[INALLOCA_SAVE:%.*]] = tail call noundef i8* @llvm.stacksave() +; IS__TUNIT____-NEXT: [[INALLOCA_SAVE:%.*]] = tail call i8* @llvm.stacksave() ; IS__TUNIT____-NEXT: [[ARGMEM:%.*]] = alloca inalloca <{ [[STRUCT_A:%.*]] }>, align 4 ; IS__TUNIT____-NEXT: call x86_thiscallcc void @internalfun(%struct.a* noalias nocapture nofree readnone undef, <{ [[STRUCT_A]] }>* inalloca noundef nonnull align 4 dereferenceable(1) [[ARGMEM]]) -; IS__TUNIT____-NEXT: call void @llvm.stackrestore(i8* noundef [[INALLOCA_SAVE]]) +; IS__TUNIT____-NEXT: call void @llvm.stackrestore(i8* [[INALLOCA_SAVE]]) ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____-LABEL: define {{[^@]+}}@exportedfun ; IS__CGSCC____-SAME: (%struct.a* nocapture nofree readnone [[A:%.*]]) -; IS__CGSCC____-NEXT: [[INALLOCA_SAVE:%.*]] = tail call noundef i8* @llvm.stacksave() +; IS__CGSCC____-NEXT: [[INALLOCA_SAVE:%.*]] = tail call i8* @llvm.stacksave() ; IS__CGSCC____-NEXT: [[ARGMEM:%.*]] = alloca inalloca <{ [[STRUCT_A:%.*]] }>, align 4 ; IS__CGSCC____-NEXT: call x86_thiscallcc void @internalfun(%struct.a* noalias nocapture nofree readnone [[A]], <{ [[STRUCT_A]] }>* inalloca noundef nonnull align 4 dereferenceable(1) [[ARGMEM]]) -; IS__CGSCC____-NEXT: call void @llvm.stackrestore(i8* noundef [[INALLOCA_SAVE]]) +; IS__CGSCC____-NEXT: call void @llvm.stackrestore(i8* [[INALLOCA_SAVE]]) ; IS__CGSCC____-NEXT: ret void ; %inalloca.save = tail call i8* @llvm.stacksave() Index: llvm/test/Transforms/Attributor/IPConstantProp/musttail-call.ll =================================================================== --- llvm/test/Transforms/Attributor/IPConstantProp/musttail-call.ll +++ llvm/test/Transforms/Attributor/IPConstantProp/musttail-call.ll @@ -30,16 +30,16 @@ ; IS__CGSCC____-NEXT: [[C1:%.*]] = icmp eq i8 [[V]], 0 ; IS__CGSCC____-NEXT: br i1 [[C1]], label [[TRUE:%.*]], label [[FALSE:%.*]] ; IS__CGSCC____: true: -; IS__CGSCC____-NEXT: [[CA:%.*]] = musttail call noalias align 536870912 i8* @side_effects(i8 [[V]]) +; IS__CGSCC____-NEXT: [[CA:%.*]] = musttail call noalias noundef align 536870912 i8* @side_effects(i8 [[V]]) ; IS__CGSCC____-NEXT: ret i8* [[CA]] ; IS__CGSCC____: false: ; IS__CGSCC____-NEXT: [[C2:%.*]] = icmp eq i8 [[V]], 1 ; IS__CGSCC____-NEXT: br i1 [[C2]], label [[C2_TRUE:%.*]], label [[C2_FALSE:%.*]] ; IS__CGSCC____: c2_true: -; IS__CGSCC____-NEXT: [[CA1:%.*]] = musttail call noalias align 536870912 i8* @no_side_effects(i8 [[V]]) +; IS__CGSCC____-NEXT: [[CA1:%.*]] = musttail call noalias noundef align 536870912 i8* @no_side_effects(i8 [[V]]) ; IS__CGSCC____-NEXT: ret i8* [[CA1]] ; IS__CGSCC____: c2_false: -; IS__CGSCC____-NEXT: [[CA2:%.*]] = musttail call noalias align 536870912 i8* @dont_zap_me(i8 [[V]]) +; IS__CGSCC____-NEXT: [[CA2:%.*]] = musttail call noalias noundef align 536870912 i8* @dont_zap_me(i8 [[V]]) ; IS__CGSCC____-NEXT: ret i8* [[CA2]] ; %c1 = icmp eq i8 %v, 0 @@ -70,7 +70,7 @@ ; IS__CGSCC____-LABEL: define {{[^@]+}}@side_effects ; IS__CGSCC____-SAME: (i8 [[V:%.*]]) ; IS__CGSCC____-NEXT: [[I1:%.*]] = call i32 @external() -; IS__CGSCC____-NEXT: [[CA:%.*]] = musttail call noalias align 536870912 i8* @start(i8 [[V]]) +; IS__CGSCC____-NEXT: [[CA:%.*]] = musttail call noalias noundef align 536870912 i8* @start(i8 [[V]]) ; IS__CGSCC____-NEXT: ret i8* [[CA]] ; %i1 = call i32 @external() Index: llvm/test/Transforms/Attributor/align.ll =================================================================== --- llvm/test/Transforms/Attributor/align.ll +++ llvm/test/Transforms/Attributor/align.ll @@ -234,7 +234,7 @@ ; ; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone uwtable willreturn ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test7() -; IS__CGSCC_NPM-NEXT: [[C:%.*]] = tail call nonnull align 8 dereferenceable(1) i8* @f1() +; IS__CGSCC_NPM-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) i8* @f1() ; IS__CGSCC_NPM-NEXT: ret i8* [[C]] ; %c = tail call i8* @f1(i8* align 8 dereferenceable(1) @a1) @@ -328,12 +328,12 @@ ; TEST 8 define void @test8_helper() { ; CHECK-LABEL: define {{[^@]+}}@test8_helper() -; CHECK-NEXT: [[PTR0:%.*]] = tail call noundef i32* @unknown() -; CHECK-NEXT: [[PTR1:%.*]] = tail call noundef align 4 i32* @unknown() -; CHECK-NEXT: [[PTR2:%.*]] = tail call noundef align 8 i32* @unknown() -; CHECK-NEXT: tail call void @test8(i32* noalias nocapture noundef readnone align 4 [[PTR1]], i32* noalias nocapture noundef readnone align 4 [[PTR1]], i32* noalias nocapture noundef readnone [[PTR0]]) -; CHECK-NEXT: tail call void @test8(i32* noalias nocapture noundef readnone align 8 [[PTR2]], i32* noalias nocapture noundef readnone align 4 [[PTR1]], i32* noalias nocapture noundef readnone align 4 [[PTR1]]) -; CHECK-NEXT: tail call void @test8(i32* noalias nocapture noundef readnone align 8 [[PTR2]], i32* noalias nocapture noundef readnone align 4 [[PTR1]], i32* noalias nocapture noundef readnone align 4 [[PTR1]]) +; CHECK-NEXT: [[PTR0:%.*]] = tail call i32* @unknown() +; CHECK-NEXT: [[PTR1:%.*]] = tail call align 4 i32* @unknown() +; CHECK-NEXT: [[PTR2:%.*]] = tail call align 8 i32* @unknown() +; CHECK-NEXT: tail call void @test8(i32* noalias nocapture readnone align 4 [[PTR1]], i32* noalias nocapture readnone align 4 [[PTR1]], i32* noalias nocapture readnone [[PTR0]]) +; CHECK-NEXT: tail call void @test8(i32* noalias nocapture readnone align 8 [[PTR2]], i32* noalias nocapture readnone align 4 [[PTR1]], i32* noalias nocapture readnone align 4 [[PTR1]]) +; CHECK-NEXT: tail call void @test8(i32* noalias nocapture readnone align 8 [[PTR2]], i32* noalias nocapture readnone align 4 [[PTR1]], i32* noalias nocapture readnone align 4 [[PTR1]]) ; CHECK-NEXT: ret void ; %ptr0 = tail call i32* @unknown() @@ -350,10 +350,10 @@ define internal void @test8(i32* %a, i32* %b, i32* %c) { ; IS__TUNIT____: Function Attrs: nounwind ; IS__TUNIT____-LABEL: define {{[^@]+}}@test8 -; IS__TUNIT____-SAME: (i32* noalias nocapture noundef readnone align 4 [[A:%.*]], i32* noalias nocapture noundef readnone align 4 [[B:%.*]], i32* noalias nocapture noundef readnone [[C:%.*]]) -; IS__TUNIT____-NEXT: call void @user_i32_ptr(i32* noalias nocapture noundef readnone align 4 [[A]]) -; IS__TUNIT____-NEXT: call void @user_i32_ptr(i32* noalias nocapture noundef readnone align 4 [[B]]) -; IS__TUNIT____-NEXT: call void @user_i32_ptr(i32* noalias nocapture noundef readnone [[C]]) +; IS__TUNIT____-SAME: (i32* noalias nocapture readnone align 4 [[A:%.*]], i32* noalias nocapture readnone align 4 [[B:%.*]], i32* noalias nocapture readnone [[C:%.*]]) +; IS__TUNIT____-NEXT: call void @user_i32_ptr(i32* noalias nocapture readnone align 4 [[A]]) +; IS__TUNIT____-NEXT: call void @user_i32_ptr(i32* noalias nocapture readnone align 4 [[B]]) +; IS__TUNIT____-NEXT: call void @user_i32_ptr(i32* noalias nocapture readnone [[C]]) ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nounwind Index: llvm/test/Transforms/Attributor/dereferenceable-1.ll =================================================================== --- llvm/test/Transforms/Attributor/dereferenceable-1.ll +++ llvm/test/Transforms/Attributor/dereferenceable-1.ll @@ -275,37 +275,21 @@ } define void @f7_2(i1 %c) { -; NOT_CGSCC_NPM: Function Attrs: nounwind willreturn -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@f7_2 -; NOT_CGSCC_NPM-SAME: (i1 [[C:%.*]]) -; NOT_CGSCC_NPM-NEXT: [[PTR:%.*]] = tail call noundef nonnull align 4 dereferenceable(4) i32* @unkown_ptr() -; NOT_CGSCC_NPM-NEXT: [[A:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(4) [[PTR]]) -; NOT_CGSCC_NPM-NEXT: [[ARG_A_0:%.*]] = load i32, i32* [[PTR]], align 4 -; NOT_CGSCC_NPM-NEXT: [[B:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(4) [[PTR]]) -; NOT_CGSCC_NPM-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] -; NOT_CGSCC_NPM: if.true: -; NOT_CGSCC_NPM-NEXT: [[C:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) -; NOT_CGSCC_NPM-NEXT: [[D:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) -; NOT_CGSCC_NPM-NEXT: [[E:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) -; NOT_CGSCC_NPM-NEXT: ret void -; NOT_CGSCC_NPM: if.false: -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC_NPM: Function Attrs: nounwind willreturn -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f7_2 -; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) -; IS__CGSCC_NPM-NEXT: [[PTR:%.*]] = tail call nonnull align 4 dereferenceable(4) i32* @unkown_ptr() -; IS__CGSCC_NPM-NEXT: [[A:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(4) [[PTR]]) -; IS__CGSCC_NPM-NEXT: [[ARG_A_0:%.*]] = load i32, i32* [[PTR]], align 4 -; IS__CGSCC_NPM-NEXT: [[B:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(4) [[PTR]]) -; IS__CGSCC_NPM-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] -; IS__CGSCC_NPM: if.true: -; IS__CGSCC_NPM-NEXT: [[C:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) -; IS__CGSCC_NPM-NEXT: [[D:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) -; IS__CGSCC_NPM-NEXT: [[E:%.*]] = tail call i32 @unkown_f(i32* noundef nonnull align 4 dereferenceable(8) [[PTR]]) -; IS__CGSCC_NPM-NEXT: ret void -; IS__CGSCC_NPM: if.false: -; IS__CGSCC_NPM-NEXT: ret void +; CHECK: Function Attrs: nounwind willreturn +; CHECK-LABEL: define {{[^@]+}}@f7_2 +; CHECK-SAME: (i1 [[C:%.*]]) +; CHECK-NEXT: [[PTR:%.*]] = tail call nonnull align 4 dereferenceable(4) i32* @unkown_ptr() +; CHECK-NEXT: [[A:%.*]] = tail call i32 @unkown_f(i32* nonnull align 4 dereferenceable(4) [[PTR]]) +; CHECK-NEXT: [[ARG_A_0:%.*]] = load i32, i32* [[PTR]], align 4 +; CHECK-NEXT: [[B:%.*]] = tail call i32 @unkown_f(i32* nonnull align 4 dereferenceable(4) [[PTR]]) +; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] +; CHECK: if.true: +; CHECK-NEXT: [[C:%.*]] = tail call i32 @unkown_f(i32* nonnull align 4 dereferenceable(8) [[PTR]]) +; CHECK-NEXT: [[D:%.*]] = tail call i32 @unkown_f(i32* nonnull align 4 dereferenceable(8) [[PTR]]) +; CHECK-NEXT: [[E:%.*]] = tail call i32 @unkown_f(i32* nonnull align 4 dereferenceable(8) [[PTR]]) +; CHECK-NEXT: ret void +; CHECK: if.false: +; CHECK-NEXT: ret void ; %ptr = tail call i32* @unkown_ptr() %A = tail call i32 @unkown_f(i32* %ptr) @@ -1033,41 +1017,23 @@ ; ATTRIBUTOR-NEXT: call void @unknown() ; ATTRIBUTOR-NEXT: ret void ; -; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@nonnull_assume_call -; NOT_CGSCC_OPM-SAME: (i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i8* [[ARG3:%.*]], i8* [[ARG4:%.*]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown() -; NOT_CGSCC_OPM-NEXT: [[P:%.*]] = call noundef nonnull dereferenceable(101) i32* @unkown_ptr() -; NOT_CGSCC_OPM-NEXT: call void @unknown_use32(i32* noundef nonnull dereferenceable(101) [[P]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) -; NOT_CGSCC_OPM-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(i8* [[ARG3]]), "dereferenceable"(i8* [[ARG1]], i64 1), "dereferenceable"(i8* [[ARG1]], i64 2), "dereferenceable"(i32* [[P]], i64 101), "dereferenceable_or_null"(i8* [[ARG2]], i64 31), "dereferenceable_or_null"(i8* [[ARG4]], i64 42) ] -; NOT_CGSCC_OPM-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown_use32(i32* noundef nonnull dereferenceable(101) [[P]]) -; NOT_CGSCC_OPM-NEXT: call void @unknown() -; NOT_CGSCC_OPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@nonnull_assume_call -; IS__CGSCC_OPM-SAME: (i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i8* [[ARG3:%.*]], i8* [[ARG4:%.*]]) -; IS__CGSCC_OPM-NEXT: call void @unknown() -; IS__CGSCC_OPM-NEXT: [[P:%.*]] = call nonnull dereferenceable(101) i32* @unkown_ptr() -; IS__CGSCC_OPM-NEXT: call void @unknown_use32(i32* noundef nonnull dereferenceable(101) [[P]]) -; IS__CGSCC_OPM-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) -; IS__CGSCC_OPM-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) -; IS__CGSCC_OPM-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) -; IS__CGSCC_OPM-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) -; IS__CGSCC_OPM-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(i8* [[ARG3]]), "dereferenceable"(i8* [[ARG1]], i64 1), "dereferenceable"(i8* [[ARG1]], i64 2), "dereferenceable"(i32* [[P]], i64 101), "dereferenceable_or_null"(i8* [[ARG2]], i64 31), "dereferenceable_or_null"(i8* [[ARG4]], i64 42) ] -; IS__CGSCC_OPM-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) -; IS__CGSCC_OPM-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) -; IS__CGSCC_OPM-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) -; IS__CGSCC_OPM-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) -; IS__CGSCC_OPM-NEXT: call void @unknown_use32(i32* noundef nonnull dereferenceable(101) [[P]]) -; IS__CGSCC_OPM-NEXT: call void @unknown() -; IS__CGSCC_OPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@nonnull_assume_call +; CHECK-SAME: (i8* [[ARG1:%.*]], i8* [[ARG2:%.*]], i8* [[ARG3:%.*]], i8* [[ARG4:%.*]]) +; CHECK-NEXT: call void @unknown() +; CHECK-NEXT: [[P:%.*]] = call nonnull dereferenceable(101) i32* @unkown_ptr() +; CHECK-NEXT: call void @unknown_use32(i32* nonnull dereferenceable(101) [[P]]) +; CHECK-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) +; CHECK-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) +; CHECK-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) +; CHECK-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) +; CHECK-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(i8* [[ARG3]]), "dereferenceable"(i8* [[ARG1]], i64 1), "dereferenceable"(i8* [[ARG1]], i64 2), "dereferenceable"(i32* [[P]], i64 101), "dereferenceable_or_null"(i8* [[ARG2]], i64 31), "dereferenceable_or_null"(i8* [[ARG4]], i64 42) ] +; CHECK-NEXT: call void @unknown_use8(i8* nonnull dereferenceable(2) [[ARG1]]) +; CHECK-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(31) [[ARG2]]) +; CHECK-NEXT: call void @unknown_use8(i8* nonnull [[ARG3]]) +; CHECK-NEXT: call void @unknown_use8(i8* dereferenceable_or_null(42) [[ARG4]]) +; CHECK-NEXT: call void @unknown_use32(i32* nonnull dereferenceable(101) [[P]]) +; CHECK-NEXT: call void @unknown() +; CHECK-NEXT: ret void ; call void @unknown() %p = call i32* @unkown_ptr() Index: llvm/test/Transforms/Attributor/heap_to_stack.ll =================================================================== --- llvm/test/Transforms/Attributor/heap_to_stack.ll +++ llvm/test/Transforms/Attributor/heap_to_stack.ll @@ -43,19 +43,12 @@ ; TEST 1 - negative, pointer freed in another function. define void @test1() { -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test1() -; NOT_CGSCC_NPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; NOT_CGSCC_NPM-NEXT: tail call void @nocapture_func_frees_pointer(i8* noalias nocapture noundef [[TMP1]]) -; NOT_CGSCC_NPM-NEXT: tail call void (...) @func_throws() -; NOT_CGSCC_NPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test1() -; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_NPM-NEXT: tail call void @nocapture_func_frees_pointer(i8* noalias nocapture noundef [[TMP1]]) -; IS__CGSCC_NPM-NEXT: tail call void (...) @func_throws() -; IS__CGSCC_NPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__CGSCC_NPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test1() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: tail call void @nocapture_func_frees_pointer(i8* noalias nocapture [[TMP1]]) +; CHECK-NEXT: tail call void (...) @func_throws() +; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @nocapture_func_frees_pointer(i8* %1) @@ -67,17 +60,11 @@ ; TEST 2 - negative, call to a sync function. define void @test2() { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test2() -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT____-NEXT: tail call void @sync_func(i8* noundef [[TMP1]]) -; IS__TUNIT____-NEXT: tail call void @free(i8* nocapture noundef [[TMP1]]) -; IS__TUNIT____-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test2() -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: tail call void @sync_func(i8* noundef [[TMP1]]) -; IS__CGSCC____-NEXT: tail call void @free(i8* nocapture noundef [[TMP1]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test2() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: tail call void @sync_func(i8* [[TMP1]]) +; CHECK-NEXT: tail call void @free(i8* nocapture [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @sync_func(i8* %1) @@ -88,22 +75,16 @@ ; TEST 3 - 1 malloc, 1 free define void @test3() { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test3() -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__TUNIT_OPM-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@test3() +; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) +; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test3() ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) +; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) ; IS________NPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test3() -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @no_sync_func(i8* %1) @@ -112,25 +93,18 @@ } define void @test3a(i8* %p) { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test3a -; IS__TUNIT_OPM-SAME: (i8* nocapture [[P:%.*]]) -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: tail call void @nofree_arg_only(i8* nocapture nofree noundef [[TMP1]], i8* nocapture [[P]]) -; IS__TUNIT_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__TUNIT_OPM-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@test3a +; IS________OPM-SAME: (i8* nocapture [[P:%.*]]) +; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: tail call void @nofree_arg_only(i8* nocapture nofree [[TMP1]], i8* nocapture [[P]]) +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) +; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test3a ; IS________NPM-SAME: (i8* nocapture [[P:%.*]]) ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree noundef [[TMP1]], i8* nocapture [[P]]) +; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[TMP1]], i8* nocapture [[P]]) ; IS________NPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test3a -; IS__CGSCC_OPM-SAME: (i8* nocapture [[P:%.*]]) -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: tail call void @nofree_arg_only(i8* nocapture nofree noundef [[TMP1]], i8* nocapture [[P]]) -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @nofree_arg_only(i8* %1, i8* %p) @@ -143,15 +117,15 @@ define void @test3b(i8* %p) { ; IS________OPM-LABEL: define {{[^@]+}}@test3b ; IS________OPM-SAME: (i8* nocapture [[P:%.*]]) -; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @aligned_alloc(i64 32, i64 128) -; IS________OPM-NEXT: tail call void @nofree_arg_only(i8* nocapture nofree noundef [[TMP1]], i8* nocapture [[P]]) -; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) +; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @aligned_alloc(i64 32, i64 128) +; IS________OPM-NEXT: tail call void @nofree_arg_only(i8* nocapture nofree [[TMP1]], i8* nocapture [[P]]) +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) ; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test3b ; IS________NPM-SAME: (i8* nocapture [[P:%.*]]) ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 128, align 32 -; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree noundef [[TMP1]], i8* nocapture [[P]]) +; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[TMP1]], i8* nocapture [[P]]) ; IS________NPM-NEXT: ret void ; %1 = tail call noalias i8* @aligned_alloc(i64 32, i64 128) @@ -162,17 +136,11 @@ ; leave alone non-constant alignments. define void @test3c(i64 %alignment) { -; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@test3c -; NOT_CGSCC_OPM-SAME: (i64 [[ALIGNMENT:%.*]]) -; NOT_CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @aligned_alloc(i64 [[ALIGNMENT]], i64 128) -; NOT_CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; NOT_CGSCC_OPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test3c -; IS__CGSCC_OPM-SAME: (i64 [[ALIGNMENT:%.*]]) -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @aligned_alloc(i64 [[ALIGNMENT]], i64 128) -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test3c +; CHECK-SAME: (i64 [[ALIGNMENT:%.*]]) +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @aligned_alloc(i64 [[ALIGNMENT]], i64 128) +; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @aligned_alloc(i64 %alignment, i64 128) tail call void @free(i8* %1) @@ -183,16 +151,16 @@ define void @test0() { ; IS________OPM-LABEL: define {{[^@]+}}@test0() -; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @calloc(i64 2, i64 4) -; IS________OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) +; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @calloc(i64 2, i64 4) +; IS________OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) ; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test0() ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 8, align 1 ; IS________NPM-NEXT: [[CALLOC_BC:%.*]] = bitcast i8* [[TMP1]] to i8* ; IS________NPM-NEXT: call void @llvm.memset.p0i8.i64(i8* [[CALLOC_BC]], i8 0, i64 8, i1 false) -; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) +; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) ; IS________NPM-NEXT: ret void ; %1 = tail call noalias i8* @calloc(i64 2, i64 4) @@ -203,20 +171,15 @@ ; TEST 4 define void @test4() { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4() -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT_OPM-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@test4() +; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[TMP1]]) +; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test4() ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP1]]) +; IS________NPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[TMP1]]) ; IS________NPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test4() -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @nofree_func(i8* %1) @@ -227,20 +190,20 @@ ; are in nofree functions and are not captured define void @test5(i32, i8* %p) { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test5 -; IS__TUNIT_OPM-SAME: (i32 [[TMP0:%.*]], i8* nocapture [[P:%.*]]) -; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 -; IS__TUNIT_OPM-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] -; IS__TUNIT_OPM: 4: -; IS__TUNIT_OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP2]]) -; IS__TUNIT_OPM-NEXT: br label [[TMP6:%.*]] -; IS__TUNIT_OPM: 5: -; IS__TUNIT_OPM-NEXT: tail call void @nofree_arg_only(i8* nocapture nofree noundef [[TMP2]], i8* nocapture [[P]]) -; IS__TUNIT_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP2]]) -; IS__TUNIT_OPM-NEXT: br label [[TMP6]] -; IS__TUNIT_OPM: 6: -; IS__TUNIT_OPM-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@test5 +; IS________OPM-SAME: (i32 [[TMP0:%.*]], i8* nocapture [[P:%.*]]) +; IS________OPM-NEXT: [[TMP2:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 +; IS________OPM-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] +; IS________OPM: 4: +; IS________OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[TMP2]]) +; IS________OPM-NEXT: br label [[TMP6:%.*]] +; IS________OPM: 5: +; IS________OPM-NEXT: tail call void @nofree_arg_only(i8* nocapture nofree [[TMP2]], i8* nocapture [[P]]) +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP2]]) +; IS________OPM-NEXT: br label [[TMP6]] +; IS________OPM: 6: +; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test5 ; IS________NPM-SAME: (i32 [[TMP0:%.*]], i8* nocapture [[P:%.*]]) @@ -248,28 +211,13 @@ ; IS________NPM-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 ; IS________NPM-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] ; IS________NPM: 4: -; IS________NPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP2]]) +; IS________NPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[TMP2]]) ; IS________NPM-NEXT: br label [[TMP6:%.*]] ; IS________NPM: 5: -; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree noundef [[TMP2]], i8* nocapture [[P]]) +; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[TMP2]], i8* nocapture [[P]]) ; IS________NPM-NEXT: br label [[TMP6]] ; IS________NPM: 6: ; IS________NPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test5 -; IS__CGSCC_OPM-SAME: (i32 [[TMP0:%.*]], i8* nocapture [[P:%.*]]) -; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 -; IS__CGSCC_OPM-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] -; IS__CGSCC_OPM: 4: -; IS__CGSCC_OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP2]]) -; IS__CGSCC_OPM-NEXT: br label [[TMP6:%.*]] -; IS__CGSCC_OPM: 5: -; IS__CGSCC_OPM-NEXT: tail call void @nofree_arg_only(i8* nocapture nofree noundef [[TMP2]], i8* nocapture [[P]]) -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP2]]) -; IS__CGSCC_OPM-NEXT: br label [[TMP6]] -; IS__CGSCC_OPM: 6: -; IS__CGSCC_OPM-NEXT: ret void ; %2 = tail call noalias i8* @malloc(i64 4) %3 = icmp eq i32 %0, 0 @@ -291,20 +239,20 @@ ; TEST 6 - all exit paths have a call to free define void @test6(i32) { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test6 -; IS__TUNIT_OPM-SAME: (i32 [[TMP0:%.*]]) -; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 -; IS__TUNIT_OPM-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] -; IS__TUNIT_OPM: 4: -; IS__TUNIT_OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP2]]) -; IS__TUNIT_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP2]]) -; IS__TUNIT_OPM-NEXT: br label [[TMP6:%.*]] -; IS__TUNIT_OPM: 5: -; IS__TUNIT_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP2]]) -; IS__TUNIT_OPM-NEXT: br label [[TMP6]] -; IS__TUNIT_OPM: 6: -; IS__TUNIT_OPM-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@test6 +; IS________OPM-SAME: (i32 [[TMP0:%.*]]) +; IS________OPM-NEXT: [[TMP2:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 +; IS________OPM-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] +; IS________OPM: 4: +; IS________OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[TMP2]]) +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP2]]) +; IS________OPM-NEXT: br label [[TMP6:%.*]] +; IS________OPM: 5: +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP2]]) +; IS________OPM-NEXT: br label [[TMP6]] +; IS________OPM: 6: +; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test6 ; IS________NPM-SAME: (i32 [[TMP0:%.*]]) @@ -312,27 +260,12 @@ ; IS________NPM-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 ; IS________NPM-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] ; IS________NPM: 4: -; IS________NPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP2]]) +; IS________NPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree [[TMP2]]) ; IS________NPM-NEXT: br label [[TMP6:%.*]] ; IS________NPM: 5: ; IS________NPM-NEXT: br label [[TMP6]] ; IS________NPM: 6: ; IS________NPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test6 -; IS__CGSCC_OPM-SAME: (i32 [[TMP0:%.*]]) -; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 -; IS__CGSCC_OPM-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] -; IS__CGSCC_OPM: 4: -; IS__CGSCC_OPM-NEXT: tail call void @nofree_func(i8* noalias nocapture nofree noundef [[TMP2]]) -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP2]]) -; IS__CGSCC_OPM-NEXT: br label [[TMP6:%.*]] -; IS__CGSCC_OPM: 5: -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP2]]) -; IS__CGSCC_OPM-NEXT: br label [[TMP6]] -; IS__CGSCC_OPM: 6: -; IS__CGSCC_OPM-NEXT: ret void ; %2 = tail call noalias i8* @malloc(i64 4) %3 = icmp eq i32 %0, 0 @@ -375,23 +308,14 @@ ; TEST 8 - Negative: bitcast pointer used in capture function define void @test8() { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test8() -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__TUNIT____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__TUNIT____-NEXT: tail call void @foo(i32* noundef align 4 [[TMP2]]) -; IS__TUNIT____-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__TUNIT____-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test8() -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__CGSCC____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__CGSCC____-NEXT: tail call void @foo(i32* noundef align 4 [[TMP2]]) -; IS__CGSCC____-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test8() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* +; CHECK-NEXT: store i32 10, i32* [[TMP2]], align 4 +; CHECK-NEXT: tail call void @foo(i32* align 4 [[TMP2]]) +; CHECK-NEXT: tail call void @free(i8* nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @no_sync_func(i8* %1) @@ -405,23 +329,14 @@ ; TEST 9 - FIXME: malloc should be converted. define void @test9() { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test9() -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__TUNIT____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__TUNIT____-NEXT: tail call void @foo_nounw(i32* nofree noundef align 4 [[TMP2]]) -; IS__TUNIT____-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__TUNIT____-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test9() -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__CGSCC____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__CGSCC____-NEXT: tail call void @foo_nounw(i32* nofree noundef align 4 [[TMP2]]) -; IS__CGSCC____-NEXT: tail call void @free(i8* nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test9() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* +; CHECK-NEXT: store i32 10, i32* [[TMP2]], align 4 +; CHECK-NEXT: tail call void @foo_nounw(i32* nofree align 4 [[TMP2]]) +; CHECK-NEXT: tail call void @free(i8* nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @no_sync_func(i8* %1) @@ -436,31 +351,22 @@ ; TEST 10 - 1 malloc, 1 free define i32 @test10() { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test10() -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__TUNIT_OPM-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__TUNIT_OPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__TUNIT_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__TUNIT_OPM-NEXT: ret i32 [[TMP3]] +; IS________OPM-LABEL: define {{[^@]+}}@test10() +; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; IS________OPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* +; IS________OPM-NEXT: store i32 10, i32* [[TMP2]], align 4 +; IS________OPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) +; IS________OPM-NEXT: ret i32 [[TMP3]] ; ; IS________NPM-LABEL: define {{[^@]+}}@test10() ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) +; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) ; IS________NPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* ; IS________NPM-NEXT: store i32 10, i32* [[TMP2]], align 4 ; IS________NPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 ; IS________NPM-NEXT: ret i32 [[TMP3]] -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test10() -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__CGSCC_OPM-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret i32 [[TMP3]] ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @no_sync_func(i8* %1) @@ -472,34 +378,24 @@ } define i32 @test_lifetime() { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test_lifetime() -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT_OPM-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__TUNIT_OPM-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__TUNIT_OPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__TUNIT_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__TUNIT_OPM-NEXT: ret i32 [[TMP3]] +; IS________OPM-LABEL: define {{[^@]+}}@test_lifetime() +; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; IS________OPM-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* noalias nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) +; IS________OPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* +; IS________OPM-NEXT: store i32 10, i32* [[TMP2]], align 4 +; IS________OPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) +; IS________OPM-NEXT: ret i32 [[TMP3]] ; ; IS________NPM-LABEL: define {{[^@]+}}@test_lifetime() ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 4, align 1 -; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS________NPM-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) +; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; IS________NPM-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* noalias nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) ; IS________NPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* ; IS________NPM-NEXT: store i32 10, i32* [[TMP2]], align 4 ; IS________NPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 ; IS________NPM-NEXT: ret i32 [[TMP3]] -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test_lifetime() -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__CGSCC_OPM-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret i32 [[TMP3]] ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @no_sync_func(i8* %1) @@ -514,17 +410,11 @@ ; TEST 11 define void @test11() { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test11() -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT____-NEXT: tail call void @sync_will_return(i8* noundef [[TMP1]]) -; IS__TUNIT____-NEXT: tail call void @free(i8* nocapture noundef [[TMP1]]) -; IS__TUNIT____-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test11() -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: tail call void @sync_will_return(i8* noundef [[TMP1]]) -; IS__CGSCC____-NEXT: tail call void @free(i8* nocapture noundef [[TMP1]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test11() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: tail call void @sync_will_return(i8* [[TMP1]]) +; CHECK-NEXT: tail call void @free(i8* nocapture [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) tail call void @sync_will_return(i8* %1) @@ -534,37 +424,37 @@ ; TEST 12 define i32 @irreducible_cfg(i32 %0) { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@irreducible_cfg -; IS__TUNIT_OPM-SAME: (i32 [[TMP0:%.*]]) -; IS__TUNIT_OPM-NEXT: [[TMP2:%.*]] = call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: [[TMP3:%.*]] = bitcast i8* [[TMP2]] to i32* -; IS__TUNIT_OPM-NEXT: store i32 10, i32* [[TMP3]], align 4 -; IS__TUNIT_OPM-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP0]], 1 -; IS__TUNIT_OPM-NEXT: br i1 [[TMP4]], label [[TMP5:%.*]], label [[TMP7:%.*]] -; IS__TUNIT_OPM: 5: -; IS__TUNIT_OPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[TMP0]], 5 -; IS__TUNIT_OPM-NEXT: br label [[TMP13:%.*]] -; IS__TUNIT_OPM: 7: -; IS__TUNIT_OPM-NEXT: br label [[TMP8:%.*]] -; IS__TUNIT_OPM: 8: -; IS__TUNIT_OPM-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP14:%.*]], [[TMP13]] ], [ 1, [[TMP7]] ] -; IS__TUNIT_OPM-NEXT: [[TMP9:%.*]] = load i32, i32* [[TMP3]], align 4 -; IS__TUNIT_OPM-NEXT: [[TMP10:%.*]] = add nsw i32 [[TMP9]], -1 -; IS__TUNIT_OPM-NEXT: store i32 [[TMP10]], i32* [[TMP3]], align 4 -; IS__TUNIT_OPM-NEXT: [[TMP11:%.*]] = icmp ne i32 [[TMP9]], 0 -; IS__TUNIT_OPM-NEXT: br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP15:%.*]] -; IS__TUNIT_OPM: 12: -; IS__TUNIT_OPM-NEXT: br label [[TMP13]] -; IS__TUNIT_OPM: 13: -; IS__TUNIT_OPM-NEXT: [[DOT1:%.*]] = phi i32 [ [[TMP6]], [[TMP5]] ], [ [[DOT0]], [[TMP12]] ] -; IS__TUNIT_OPM-NEXT: [[TMP14]] = add nsw i32 [[DOT1]], 1 -; IS__TUNIT_OPM-NEXT: br label [[TMP8]] -; IS__TUNIT_OPM: 15: -; IS__TUNIT_OPM-NEXT: [[TMP16:%.*]] = load i32, i32* [[TMP3]], align 4 -; IS__TUNIT_OPM-NEXT: [[TMP17:%.*]] = bitcast i32* [[TMP3]] to i8* -; IS__TUNIT_OPM-NEXT: call void @free(i8* nocapture noundef [[TMP17]]) -; IS__TUNIT_OPM-NEXT: [[TMP18:%.*]] = load i32, i32* [[TMP3]], align 4 -; IS__TUNIT_OPM-NEXT: ret i32 [[TMP18]] +; IS________OPM-LABEL: define {{[^@]+}}@irreducible_cfg +; IS________OPM-SAME: (i32 [[TMP0:%.*]]) +; IS________OPM-NEXT: [[TMP2:%.*]] = call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: [[TMP3:%.*]] = bitcast i8* [[TMP2]] to i32* +; IS________OPM-NEXT: store i32 10, i32* [[TMP3]], align 4 +; IS________OPM-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP0]], 1 +; IS________OPM-NEXT: br i1 [[TMP4]], label [[TMP5:%.*]], label [[TMP7:%.*]] +; IS________OPM: 5: +; IS________OPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[TMP0]], 5 +; IS________OPM-NEXT: br label [[TMP13:%.*]] +; IS________OPM: 7: +; IS________OPM-NEXT: br label [[TMP8:%.*]] +; IS________OPM: 8: +; IS________OPM-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP14:%.*]], [[TMP13]] ], [ 1, [[TMP7]] ] +; IS________OPM-NEXT: [[TMP9:%.*]] = load i32, i32* [[TMP3]], align 4 +; IS________OPM-NEXT: [[TMP10:%.*]] = add nsw i32 [[TMP9]], -1 +; IS________OPM-NEXT: store i32 [[TMP10]], i32* [[TMP3]], align 4 +; IS________OPM-NEXT: [[TMP11:%.*]] = icmp ne i32 [[TMP9]], 0 +; IS________OPM-NEXT: br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP15:%.*]] +; IS________OPM: 12: +; IS________OPM-NEXT: br label [[TMP13]] +; IS________OPM: 13: +; IS________OPM-NEXT: [[DOT1:%.*]] = phi i32 [ [[TMP6]], [[TMP5]] ], [ [[DOT0]], [[TMP12]] ] +; IS________OPM-NEXT: [[TMP14]] = add nsw i32 [[DOT1]], 1 +; IS________OPM-NEXT: br label [[TMP8]] +; IS________OPM: 15: +; IS________OPM-NEXT: [[TMP16:%.*]] = load i32, i32* [[TMP3]], align 4 +; IS________OPM-NEXT: [[TMP17:%.*]] = bitcast i32* [[TMP3]] to i8* +; IS________OPM-NEXT: call void @free(i8* nocapture [[TMP17]]) +; IS________OPM-NEXT: [[TMP18:%.*]] = load i32, i32* [[TMP3]], align 4 +; IS________OPM-NEXT: ret i32 [[TMP18]] ; ; IS________NPM-LABEL: define {{[^@]+}}@irreducible_cfg ; IS________NPM-SAME: (i32 [[TMP0:%.*]]) @@ -595,38 +485,6 @@ ; IS________NPM-NEXT: [[TMP16:%.*]] = bitcast i32* [[TMP3]] to i8* ; IS________NPM-NEXT: [[TMP17:%.*]] = load i32, i32* [[TMP3]], align 4 ; IS________NPM-NEXT: ret i32 [[TMP17]] -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@irreducible_cfg -; IS__CGSCC_OPM-SAME: (i32 [[TMP0:%.*]]) -; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: [[TMP3:%.*]] = bitcast i8* [[TMP2]] to i32* -; IS__CGSCC_OPM-NEXT: store i32 10, i32* [[TMP3]], align 4 -; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP0]], 1 -; IS__CGSCC_OPM-NEXT: br i1 [[TMP4]], label [[TMP5:%.*]], label [[TMP7:%.*]] -; IS__CGSCC_OPM: 5: -; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = add nsw i32 [[TMP0]], 5 -; IS__CGSCC_OPM-NEXT: br label [[TMP13:%.*]] -; IS__CGSCC_OPM: 7: -; IS__CGSCC_OPM-NEXT: br label [[TMP8:%.*]] -; IS__CGSCC_OPM: 8: -; IS__CGSCC_OPM-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP14:%.*]], [[TMP13]] ], [ 1, [[TMP7]] ] -; IS__CGSCC_OPM-NEXT: [[TMP9:%.*]] = load i32, i32* [[TMP3]], align 4 -; IS__CGSCC_OPM-NEXT: [[TMP10:%.*]] = add nsw i32 [[TMP9]], -1 -; IS__CGSCC_OPM-NEXT: store i32 [[TMP10]], i32* [[TMP3]], align 4 -; IS__CGSCC_OPM-NEXT: [[TMP11:%.*]] = icmp ne i32 [[TMP9]], 0 -; IS__CGSCC_OPM-NEXT: br i1 [[TMP11]], label [[TMP12:%.*]], label [[TMP15:%.*]] -; IS__CGSCC_OPM: 12: -; IS__CGSCC_OPM-NEXT: br label [[TMP13]] -; IS__CGSCC_OPM: 13: -; IS__CGSCC_OPM-NEXT: [[DOT1:%.*]] = phi i32 [ [[TMP6]], [[TMP5]] ], [ [[DOT0]], [[TMP12]] ] -; IS__CGSCC_OPM-NEXT: [[TMP14]] = add nsw i32 [[DOT1]], 1 -; IS__CGSCC_OPM-NEXT: br label [[TMP8]] -; IS__CGSCC_OPM: 15: -; IS__CGSCC_OPM-NEXT: [[TMP16:%.*]] = load i32, i32* [[TMP3]], align 4 -; IS__CGSCC_OPM-NEXT: [[TMP17:%.*]] = bitcast i32* [[TMP3]] to i8* -; IS__CGSCC_OPM-NEXT: call void @free(i8* nocapture noundef [[TMP17]]) -; IS__CGSCC_OPM-NEXT: [[TMP18:%.*]] = load i32, i32* [[TMP3]], align 4 -; IS__CGSCC_OPM-NEXT: ret i32 [[TMP18]] ; %2 = call noalias i8* @malloc(i64 4) %3 = bitcast i8* %2 to i32* @@ -731,23 +589,14 @@ ; Malloc/Calloc too large define i32 @test13() { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test13() -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 256) -; IS__TUNIT____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__TUNIT____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__TUNIT____-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__TUNIT____-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__TUNIT____-NEXT: ret i32 [[TMP3]] -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test13() -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 256) -; IS__CGSCC____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__CGSCC____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__CGSCC____-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__CGSCC____-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__CGSCC____-NEXT: ret i32 [[TMP3]] +; CHECK-LABEL: define {{[^@]+}}@test13() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 256) +; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* +; CHECK-NEXT: store i32 10, i32* [[TMP2]], align 4 +; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 +; CHECK-NEXT: tail call void @free(i8* noalias nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) +; CHECK-NEXT: ret i32 [[TMP3]] ; %1 = tail call noalias i8* @malloc(i64 256) tail call void @no_sync_func(i8* %1) @@ -759,23 +608,14 @@ } define i32 @test_sle() { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test_sle() -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 -1) -; IS__TUNIT____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__TUNIT____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__TUNIT____-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__TUNIT____-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__TUNIT____-NEXT: ret i32 [[TMP3]] -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test_sle() -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 -1) -; IS__CGSCC____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__CGSCC____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__CGSCC____-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__CGSCC____-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__CGSCC____-NEXT: ret i32 [[TMP3]] +; CHECK-LABEL: define {{[^@]+}}@test_sle() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 -1) +; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* +; CHECK-NEXT: store i32 10, i32* [[TMP2]], align 4 +; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 +; CHECK-NEXT: tail call void @free(i8* noalias nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) +; CHECK-NEXT: ret i32 [[TMP3]] ; %1 = tail call noalias i8* @malloc(i64 -1) tail call void @no_sync_func(i8* %1) @@ -787,23 +627,14 @@ } define i32 @test_overflow() { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test_overflow() -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @calloc(i64 65537, i64 65537) -; IS__TUNIT____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__TUNIT____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__TUNIT____-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__TUNIT____-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__TUNIT____-NEXT: ret i32 [[TMP3]] -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test_overflow() -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @calloc(i64 65537, i64 65537) -; IS__CGSCC____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC____-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* -; IS__CGSCC____-NEXT: store i32 10, i32* [[TMP2]], align 4 -; IS__CGSCC____-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 -; IS__CGSCC____-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull align 4 dereferenceable(4) [[TMP1]]) -; IS__CGSCC____-NEXT: ret i32 [[TMP3]] +; CHECK-LABEL: define {{[^@]+}}@test_overflow() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @calloc(i64 65537, i64 65537) +; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[TMP1]] to i32* +; CHECK-NEXT: store i32 10, i32* [[TMP2]], align 4 +; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4 +; CHECK-NEXT: tail call void @free(i8* noalias nocapture nonnull align 4 dereferenceable(4) [[TMP1]]) +; CHECK-NEXT: ret i32 [[TMP3]] ; %1 = tail call noalias i8* @calloc(i64 65537, i64 65537) tail call void @no_sync_func(i8* %1) @@ -815,17 +646,11 @@ } define void @test14() { -; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@test14() -; NOT_CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @calloc(i64 64, i64 4) -; NOT_CGSCC_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; NOT_CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; NOT_CGSCC_OPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test14() -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @calloc(i64 64, i64 4) -; IS__CGSCC_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test14() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @calloc(i64 64, i64 4) +; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @calloc(i64 64, i64 4) tail call void @no_sync_func(i8* %1) @@ -834,19 +659,12 @@ } define void @test15(i64 %S) { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test15 -; IS__TUNIT____-SAME: (i64 [[S:%.*]]) -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 [[S]]) -; IS__TUNIT____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__TUNIT____-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__TUNIT____-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test15 -; IS__CGSCC____-SAME: (i64 [[S:%.*]]) -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 [[S]]) -; IS__CGSCC____-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef [[TMP1]]) -; IS__CGSCC____-NEXT: tail call void @free(i8* noalias nocapture noundef [[TMP1]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test15 +; CHECK-SAME: (i64 [[S:%.*]]) +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 [[S]]) +; CHECK-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree [[TMP1]]) +; CHECK-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 %S) tail call void @no_sync_func(i8* %1) @@ -855,28 +673,20 @@ } define void @test16a(i8 %v, i8** %P) { -; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test16a -; IS__TUNIT_OPM-SAME: (i8 [[V:%.*]], i8** nocapture nofree readnone [[P:%.*]]) -; IS__TUNIT_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_OPM-NEXT: store i8 [[V]], i8* [[TMP1]], align 1 -; IS__TUNIT_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[TMP1]]) -; IS__TUNIT_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull dereferenceable(1) [[TMP1]]) -; IS__TUNIT_OPM-NEXT: ret void +; IS________OPM-LABEL: define {{[^@]+}}@test16a +; IS________OPM-SAME: (i8 [[V:%.*]], i8** nocapture nofree readnone [[P:%.*]]) +; IS________OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: store i8 [[V]], i8* [[TMP1]], align 1 +; IS________OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree nonnull dereferenceable(1) [[TMP1]]) +; IS________OPM-NEXT: tail call void @free(i8* noalias nocapture nonnull dereferenceable(1) [[TMP1]]) +; IS________OPM-NEXT: ret void ; ; IS________NPM-LABEL: define {{[^@]+}}@test16a ; IS________NPM-SAME: (i8 [[V:%.*]], i8** nocapture nofree readnone [[P:%.*]]) ; IS________NPM-NEXT: [[TMP1:%.*]] = alloca i8, i64 4, align 1 ; IS________NPM-NEXT: store i8 [[V]], i8* [[TMP1]], align 1 -; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[TMP1]]) +; IS________NPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree nonnull dereferenceable(1) [[TMP1]]) ; IS________NPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test16a -; IS__CGSCC_OPM-SAME: (i8 [[V:%.*]], i8** nocapture nofree readnone [[P:%.*]]) -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: store i8 [[V]], i8* [[TMP1]], align 1 -; IS__CGSCC_OPM-NEXT: tail call void @no_sync_func(i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[TMP1]]) -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* noalias nocapture noundef nonnull dereferenceable(1) [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) store i8 %v, i8* %1 @@ -886,21 +696,13 @@ } define void @test16b(i8 %v, i8** %P) { -; IS__TUNIT____-LABEL: define {{[^@]+}}@test16b -; IS__TUNIT____-SAME: (i8 [[V:%.*]], i8** nocapture writeonly [[P:%.*]]) -; IS__TUNIT____-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT____-NEXT: store i8* [[TMP1]], i8** [[P]], align 8 -; IS__TUNIT____-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef [[TMP1]]) -; IS__TUNIT____-NEXT: tail call void @free(i8* nocapture noundef [[TMP1]]) -; IS__TUNIT____-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test16b -; IS__CGSCC____-SAME: (i8 [[V:%.*]], i8** nocapture writeonly [[P:%.*]]) -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: store i8* [[TMP1]], i8** [[P]], align 8 -; IS__CGSCC____-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef [[TMP1]]) -; IS__CGSCC____-NEXT: tail call void @free(i8* nocapture noundef [[TMP1]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test16b +; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture writeonly [[P:%.*]]) +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: store i8* [[TMP1]], i8** [[P]], align 8 +; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[TMP1]]) +; CHECK-NEXT: tail call void @free(i8* nocapture [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) store i8* %1, i8** %P @@ -910,21 +712,13 @@ } define void @test16c(i8 %v, i8** %P) { -; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@test16c -; NOT_CGSCC_OPM-SAME: (i8 [[V:%.*]], i8** nocapture writeonly [[P:%.*]]) -; NOT_CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; NOT_CGSCC_OPM-NEXT: store i8* [[TMP1]], i8** [[P]], align 8 -; NOT_CGSCC_OPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef [[TMP1]]) -; NOT_CGSCC_OPM-NEXT: tail call void @free(i8* nocapture noundef [[TMP1]]) -; NOT_CGSCC_OPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test16c -; IS__CGSCC_OPM-SAME: (i8 [[V:%.*]], i8** nocapture writeonly [[P:%.*]]) -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC_OPM-NEXT: store i8* [[TMP1]], i8** [[P]], align 8 -; IS__CGSCC_OPM-NEXT: tail call void @no_sync_func(i8* nocapture nofree noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: tail call void @free(i8* nocapture noundef [[TMP1]]) -; IS__CGSCC_OPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test16c +; CHECK-SAME: (i8 [[V:%.*]], i8** nocapture writeonly [[P:%.*]]) +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: store i8* [[TMP1]], i8** [[P]], align 8 +; CHECK-NEXT: tail call void @no_sync_func(i8* nocapture nofree [[TMP1]]) +; CHECK-NEXT: tail call void @free(i8* nocapture [[TMP1]]) +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @malloc(i64 4) store i8* %1, i8** %P Index: llvm/test/Transforms/Attributor/memory_locations.ll =================================================================== --- llvm/test/Transforms/Attributor/memory_locations.ll +++ llvm/test/Transforms/Attributor/memory_locations.ll @@ -346,30 +346,20 @@ ret void } define void @callerC1() { -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@callerC1() -; NOT_CGSCC_NPM-NEXT: [[UNKNOWN:%.*]] = call noundef i8* @unknown_ptr() -; NOT_CGSCC_NPM-NEXT: [[TMP1:%.*]] = call i8* @argmem_only(i8* noundef [[UNKNOWN]]) -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@callerC1() -; IS__CGSCC_NPM-NEXT: [[UNKNOWN:%.*]] = call i8* @unknown_ptr() -; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = call i8* @argmem_only(i8* noundef [[UNKNOWN]]) -; IS__CGSCC_NPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@callerC1() +; CHECK-NEXT: [[UNKNOWN:%.*]] = call i8* @unknown_ptr() +; CHECK-NEXT: [[TMP1:%.*]] = call i8* @argmem_only(i8* [[UNKNOWN]]) +; CHECK-NEXT: ret void ; %unknown = call i8* @unknown_ptr() call i8* @argmem_only(i8* %unknown) ret void } define void @callerC2() { -; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@callerC2() -; NOT_CGSCC_OPM-NEXT: [[UNKNOWN:%.*]] = call noundef i8* @unknown_ptr() -; NOT_CGSCC_OPM-NEXT: [[TMP1:%.*]] = call i8* @inaccesible_argmem_only_decl(i8* noundef [[UNKNOWN]]) -; NOT_CGSCC_OPM-NEXT: ret void -; -; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@callerC2() -; IS__CGSCC_OPM-NEXT: [[UNKNOWN:%.*]] = call i8* @unknown_ptr() -; IS__CGSCC_OPM-NEXT: [[TMP1:%.*]] = call i8* @inaccesible_argmem_only_decl(i8* noundef [[UNKNOWN]]) -; IS__CGSCC_OPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@callerC2() +; CHECK-NEXT: [[UNKNOWN:%.*]] = call i8* @unknown_ptr() +; CHECK-NEXT: [[TMP1:%.*]] = call i8* @inaccesible_argmem_only_decl(i8* [[UNKNOWN]]) +; CHECK-NEXT: ret void ; %unknown = call i8* @unknown_ptr() call i8* @inaccesible_argmem_only_decl(i8* %unknown) Index: llvm/test/Transforms/Attributor/noalias.ll =================================================================== --- llvm/test/Transforms/Attributor/noalias.ll +++ llvm/test/Transforms/Attributor/noalias.ll @@ -56,13 +56,9 @@ } define i8* @return_noalias_looks_like_capture(){ -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@return_noalias_looks_like_capture() -; NOT_CGSCC_NPM-NEXT: [[TMP1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; NOT_CGSCC_NPM-NEXT: ret i8* [[TMP1]] -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@return_noalias_looks_like_capture() -; IS__CGSCC____-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: ret i8* [[TMP1]] +; CHECK-LABEL: define {{[^@]+}}@return_noalias_looks_like_capture() +; CHECK-NEXT: [[TMP1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: ret i8* [[TMP1]] ; %1 = tail call noalias i8* @malloc(i64 4) call void @nocapture(i8* %1) @@ -357,23 +353,14 @@ declare void @use_nocapture(i8* nocapture) declare void @use(i8*) define void @test12_1() { -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test12_1() -; NOT_CGSCC_NPM-NEXT: [[A:%.*]] = alloca i8, align 4 -; NOT_CGSCC_NPM-NEXT: [[B:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; NOT_CGSCC_NPM-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef nonnull align 4 dereferenceable(1) [[A]]) -; NOT_CGSCC_NPM-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef nonnull align 4 dereferenceable(1) [[A]]) -; NOT_CGSCC_NPM-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef [[B]]) -; NOT_CGSCC_NPM-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef [[B]]) -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test12_1() -; IS__CGSCC____-NEXT: [[A:%.*]] = alloca i8, align 4 -; IS__CGSCC____-NEXT: [[B:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef nonnull align 4 dereferenceable(1) [[A]]) -; IS__CGSCC____-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef nonnull align 4 dereferenceable(1) [[A]]) -; IS__CGSCC____-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef [[B]]) -; IS__CGSCC____-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef [[B]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test12_1() +; CHECK-NEXT: [[A:%.*]] = alloca i8, align 4 +; CHECK-NEXT: [[B:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef nonnull align 4 dereferenceable(1) [[A]]) +; CHECK-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef nonnull align 4 dereferenceable(1) [[A]]) +; CHECK-NEXT: tail call void @use_nocapture(i8* noalias nocapture [[B]]) +; CHECK-NEXT: tail call void @use_nocapture(i8* noalias nocapture [[B]]) +; CHECK-NEXT: ret void ; %A = alloca i8, align 4 %B = tail call noalias i8* @malloc(i64 4) @@ -385,21 +372,13 @@ } define void @test12_2(){ -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test12_2() -; NOT_CGSCC_NPM-NEXT: [[A:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; NOT_CGSCC_NPM-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef [[A]]) -; NOT_CGSCC_NPM-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef [[A]]) -; NOT_CGSCC_NPM-NEXT: tail call void @use(i8* noundef [[A]]) -; NOT_CGSCC_NPM-NEXT: tail call void @use_nocapture(i8* nocapture noundef [[A]]) -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test12_2() -; IS__CGSCC____-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef [[A]]) -; IS__CGSCC____-NEXT: tail call void @use_nocapture(i8* noalias nocapture noundef [[A]]) -; IS__CGSCC____-NEXT: tail call void @use(i8* noundef [[A]]) -; IS__CGSCC____-NEXT: tail call void @use_nocapture(i8* nocapture noundef [[A]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test12_2() +; CHECK-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: tail call void @use_nocapture(i8* noalias nocapture [[A]]) +; CHECK-NEXT: tail call void @use_nocapture(i8* noalias nocapture [[A]]) +; CHECK-NEXT: tail call void @use(i8* [[A]]) +; CHECK-NEXT: tail call void @use_nocapture(i8* nocapture [[A]]) +; CHECK-NEXT: ret void ; ; FIXME: This should be @use_nocapture(i8* noalias [[A]]) ; FIXME: This should be @use_nocapture(i8* noalias nocapture [[A]]) @@ -413,15 +392,10 @@ declare void @two_args(i8* nocapture , i8* nocapture) define void @test12_3(){ -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test12_3() -; NOT_CGSCC_NPM-NEXT: [[A:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; NOT_CGSCC_NPM-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture noundef [[A]]) -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test12_3() -; IS__CGSCC____-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture noundef [[A]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test12_3() +; CHECK-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A]]) +; CHECK-NEXT: ret void ; %A = tail call noalias i8* @malloc(i64 4) tail call void @two_args(i8* %A, i8* %A) @@ -430,40 +404,28 @@ define void @test12_4(){ ; IS________OPM-LABEL: define {{[^@]+}}@test12_4() -; IS________OPM-NEXT: [[A:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS________OPM-NEXT: [[B:%.*]] = tail call noalias noundef i8* @malloc(i64 4) +; IS________OPM-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 4) +; IS________OPM-NEXT: [[B:%.*]] = tail call noalias i8* @malloc(i64 4) ; IS________OPM-NEXT: [[A_0:%.*]] = getelementptr i8, i8* [[A]], i64 0 ; IS________OPM-NEXT: [[A_1:%.*]] = getelementptr i8, i8* [[A]], i64 1 ; IS________OPM-NEXT: [[B_0:%.*]] = getelementptr i8, i8* [[B]], i64 0 -; IS________OPM-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture noundef [[B]]) -; IS________OPM-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture noundef [[A_0]]) -; IS________OPM-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture [[A_1]]) -; IS________OPM-NEXT: tail call void @two_args(i8* nocapture noundef [[A_0]], i8* nocapture noundef [[B_0]]) +; IS________OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[B]]) +; IS________OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A_0]]) +; IS________OPM-NEXT: tail call void @two_args(i8* nocapture [[A]], i8* nocapture [[A_1]]) +; IS________OPM-NEXT: tail call void @two_args(i8* nocapture [[A_0]], i8* nocapture [[B_0]]) ; IS________OPM-NEXT: ret void ; -; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test12_4() -; IS__TUNIT_NPM-NEXT: [[A:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_NPM-NEXT: [[B:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; IS__TUNIT_NPM-NEXT: [[A_0:%.*]] = getelementptr i8, i8* [[A]], i64 0 -; IS__TUNIT_NPM-NEXT: [[A_1:%.*]] = getelementptr i8, i8* [[A]], i64 1 -; IS__TUNIT_NPM-NEXT: [[B_0:%.*]] = getelementptr i8, i8* [[B]], i64 0 -; IS__TUNIT_NPM-NEXT: tail call void @two_args(i8* noalias nocapture noundef [[A]], i8* noalias nocapture noundef [[B]]) -; IS__TUNIT_NPM-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture noundef [[A_0]]) -; IS__TUNIT_NPM-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture [[A_1]]) -; IS__TUNIT_NPM-NEXT: tail call void @two_args(i8* nocapture noundef [[A_0]], i8* nocapture noundef [[B_0]]) -; IS__TUNIT_NPM-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test12_4() -; IS__CGSCC____-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: [[B:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: [[A_0:%.*]] = getelementptr i8, i8* [[A]], i64 0 -; IS__CGSCC____-NEXT: [[A_1:%.*]] = getelementptr i8, i8* [[A]], i64 1 -; IS__CGSCC____-NEXT: [[B_0:%.*]] = getelementptr i8, i8* [[B]], i64 0 -; IS__CGSCC____-NEXT: tail call void @two_args(i8* noalias nocapture noundef [[A]], i8* noalias nocapture noundef [[B]]) -; IS__CGSCC____-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture noundef [[A_0]]) -; IS__CGSCC____-NEXT: tail call void @two_args(i8* nocapture noundef [[A]], i8* nocapture noundef [[A_1]]) -; IS__CGSCC____-NEXT: tail call void @two_args(i8* nocapture noundef [[A_0]], i8* nocapture noundef [[B_0]]) -; IS__CGSCC____-NEXT: ret void +; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@test12_4() +; NOT_TUNIT_OPM-NEXT: [[A:%.*]] = tail call noalias i8* @malloc(i64 4) +; NOT_TUNIT_OPM-NEXT: [[B:%.*]] = tail call noalias i8* @malloc(i64 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_1]]) +; NOT_TUNIT_OPM-NEXT: tail call void @two_args(i8* nocapture [[A_0]], i8* nocapture [[B_0]]) +; NOT_TUNIT_OPM-NEXT: ret void ; %A = tail call noalias i8* @malloc(i64 4) %B = tail call noalias i8* @malloc(i64 4) @@ -494,19 +456,12 @@ } define void @test13_use_noalias(){ -; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test13_use_noalias() -; NOT_CGSCC_NPM-NEXT: [[M1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) -; NOT_CGSCC_NPM-NEXT: [[C1:%.*]] = bitcast i8* [[M1]] to i16* -; NOT_CGSCC_NPM-NEXT: [[C2:%.*]] = bitcast i16* [[C1]] to i8* -; NOT_CGSCC_NPM-NEXT: call void @use_i8_internal(i8* noalias nocapture noundef [[C2]]) -; NOT_CGSCC_NPM-NEXT: ret void -; -; IS__CGSCC____-LABEL: define {{[^@]+}}@test13_use_noalias() -; IS__CGSCC____-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 4) -; IS__CGSCC____-NEXT: [[C1:%.*]] = bitcast i8* [[M1]] to i16* -; IS__CGSCC____-NEXT: [[C2:%.*]] = bitcast i16* [[C1]] to i8* -; IS__CGSCC____-NEXT: call void @use_i8_internal(i8* noalias nocapture noundef [[C2]]) -; IS__CGSCC____-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test13_use_noalias() +; CHECK-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 4) +; CHECK-NEXT: [[C1:%.*]] = bitcast i8* [[M1]] to i16* +; CHECK-NEXT: [[C2:%.*]] = bitcast i16* [[C1]] to i8* +; CHECK-NEXT: call void @use_i8_internal(i8* noalias nocapture [[C2]]) +; CHECK-NEXT: ret void ; ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test13_use_noalias() ; IS__CGSCC_OPM-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 4) @@ -523,12 +478,12 @@ define void @test13_use_alias(){ ; CHECK-LABEL: define {{[^@]+}}@test13_use_alias() -; CHECK-NEXT: [[M1:%.*]] = tail call noalias noundef i8* @malloc(i64 4) +; CHECK-NEXT: [[M1:%.*]] = tail call noalias i8* @malloc(i64 4) ; CHECK-NEXT: [[C1:%.*]] = bitcast i8* [[M1]] to i16* ; CHECK-NEXT: [[C2A:%.*]] = bitcast i16* [[C1]] to i8* ; CHECK-NEXT: [[C2B:%.*]] = bitcast i16* [[C1]] to i8* -; CHECK-NEXT: call void @use_i8_internal(i8* nocapture noundef [[C2A]]) -; CHECK-NEXT: call void @use_i8_internal(i8* nocapture noundef [[C2B]]) +; CHECK-NEXT: call void @use_i8_internal(i8* nocapture [[C2A]]) +; CHECK-NEXT: call void @use_i8_internal(i8* nocapture [[C2B]]) ; CHECK-NEXT: ret void ; %m1 = tail call noalias i8* @malloc(i64 4) Index: llvm/test/Transforms/Attributor/nocapture-2.ll =================================================================== --- llvm/test/Transforms/Attributor/nocapture-2.ll +++ llvm/test/Transforms/Attributor/nocapture-2.ll @@ -217,11 +217,11 @@ ; CHECK-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] ; CHECK: cond.true: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32* [[A]] to i16* -; CHECK-NEXT: [[CALL:%.*]] = call noundef dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP0]]) +; CHECK-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP0]]) ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i8* [[CALL]] to double* -; CHECK-NEXT: [[CALL1:%.*]] = call noundef dereferenceable_or_null(8) i64* @scc_B(double* noalias nofree noundef readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) +; CHECK-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(8) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i32* -; CHECK-NEXT: [[CALL2:%.*]] = call float* @scc_A(i32* noalias nofree noundef readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP2]]) +; CHECK-NEXT: [[CALL2:%.*]] = call float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP2]]) ; CHECK-NEXT: [[TMP3:%.*]] = bitcast float* [[CALL2]] to i32* ; CHECK-NEXT: br label [[COND_END:%.*]] ; CHECK: cond.false: @@ -263,11 +263,11 @@ ; CHECK-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] ; CHECK: cond.true: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast double* [[A]] to i32* -; CHECK-NEXT: [[CALL:%.*]] = call noundef dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP0]]) +; CHECK-NEXT: [[CALL:%.*]] = call dereferenceable_or_null(4) float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP0]]) ; CHECK-NEXT: [[TMP1:%.*]] = bitcast float* [[CALL]] to double* -; CHECK-NEXT: [[CALL1:%.*]] = call noundef dereferenceable_or_null(8) i64* @scc_B(double* noalias nofree noundef readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) +; CHECK-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(8) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP1]]) ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64* [[CALL1]] to i16* -; CHECK-NEXT: [[CALL2:%.*]] = call i8* @scc_C(i16* noalias nofree noundef readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP2]]) +; CHECK-NEXT: [[CALL2:%.*]] = call i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP2]]) ; CHECK-NEXT: br label [[COND_END:%.*]] ; CHECK: cond.false: ; CHECK-NEXT: [[TMP3:%.*]] = bitcast double* [[A]] to i8* @@ -312,16 +312,16 @@ ; CHECK-NEXT: br i1 [[TOBOOL]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]] ; CHECK: cond.true: ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i16* [[A]] to double* -; CHECK-NEXT: [[CALL1:%.*]] = call noundef dereferenceable_or_null(8) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP0]]) +; CHECK-NEXT: [[CALL1:%.*]] = call dereferenceable_or_null(8) i64* @scc_B(double* noalias nofree readnone dereferenceable_or_null(8) "no-capture-maybe-returned" [[TMP0]]) ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64* [[CALL1]] to i8* ; CHECK-NEXT: br label [[COND_END:%.*]] ; CHECK: cond.false: -; CHECK-NEXT: [[CALL2:%.*]] = call noundef dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[A]]) +; CHECK-NEXT: [[CALL2:%.*]] = call dereferenceable_or_null(4) i8* @scc_C(i16* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[A]]) ; CHECK-NEXT: br label [[COND_END]] ; CHECK: cond.end: ; CHECK-NEXT: [[COND:%.*]] = phi i8* [ [[TMP1]], [[COND_TRUE]] ], [ [[CALL2]], [[COND_FALSE]] ] ; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[COND]] to i32* -; CHECK-NEXT: [[CALL3:%.*]] = call float* @scc_A(i32* noalias nofree noundef readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP2]]) +; CHECK-NEXT: [[CALL3:%.*]] = call float* @scc_A(i32* noalias nofree readnone dereferenceable_or_null(4) "no-capture-maybe-returned" [[TMP2]]) ; CHECK-NEXT: [[TMP3:%.*]] = bitcast float* [[CALL3]] to i8* ; CHECK-NEXT: ret i8* [[TMP3]] ; Index: llvm/test/Transforms/Attributor/nonnull.ll =================================================================== --- llvm/test/Transforms/Attributor/nonnull.ll +++ llvm/test/Transforms/Attributor/nonnull.ll @@ -364,10 +364,10 @@ declare i8* @unknown() define void @test13_helper() { ; CHECK-LABEL: define {{[^@]+}}@test13_helper() -; CHECK-NEXT: [[NONNULLPTR:%.*]] = tail call noundef nonnull i8* @ret_nonnull() -; CHECK-NEXT: [[MAYBENULLPTR:%.*]] = tail call noundef i8* @unknown() -; CHECK-NEXT: tail call void @test13(i8* noalias nocapture nofree noundef nonnull readnone [[NONNULLPTR]], i8* noalias nocapture nofree noundef nonnull readnone [[NONNULLPTR]], i8* noalias nocapture nofree noundef readnone [[MAYBENULLPTR]]) -; CHECK-NEXT: tail call void @test13(i8* noalias nocapture nofree noundef nonnull readnone [[NONNULLPTR]], i8* noalias nocapture nofree noundef readnone [[MAYBENULLPTR]], i8* noalias nocapture nofree noundef nonnull readnone [[NONNULLPTR]]) +; CHECK-NEXT: [[NONNULLPTR:%.*]] = tail call nonnull i8* @ret_nonnull() +; CHECK-NEXT: [[MAYBENULLPTR:%.*]] = tail call i8* @unknown() +; CHECK-NEXT: tail call void @test13(i8* noalias nocapture nofree nonnull readnone [[NONNULLPTR]], i8* noalias nocapture nofree nonnull readnone [[NONNULLPTR]], i8* noalias nocapture nofree readnone [[MAYBENULLPTR]]) +; CHECK-NEXT: tail call void @test13(i8* noalias nocapture nofree nonnull readnone [[NONNULLPTR]], i8* noalias nocapture nofree readnone [[MAYBENULLPTR]], i8* noalias nocapture nofree nonnull readnone [[NONNULLPTR]]) ; CHECK-NEXT: ret void ; %nonnullptr = tail call i8* @ret_nonnull() @@ -379,10 +379,10 @@ define internal void @test13(i8* %a, i8* %b, i8* %c) { ; IS__TUNIT____: Function Attrs: nounwind ; IS__TUNIT____-LABEL: define {{[^@]+}}@test13 -; IS__TUNIT____-SAME: (i8* noalias nocapture nofree noundef nonnull readnone [[A:%.*]], i8* noalias nocapture nofree noundef readnone [[B:%.*]], i8* noalias nocapture nofree noundef readnone [[C:%.*]]) -; IS__TUNIT____-NEXT: call void @use_i8_ptr(i8* noalias nocapture nofree noundef nonnull readnone [[A]]) -; IS__TUNIT____-NEXT: call void @use_i8_ptr(i8* noalias nocapture nofree noundef readnone [[B]]) -; IS__TUNIT____-NEXT: call void @use_i8_ptr(i8* noalias nocapture nofree noundef readnone [[C]]) +; IS__TUNIT____-SAME: (i8* noalias nocapture nofree nonnull readnone [[A:%.*]], i8* noalias nocapture nofree readnone [[B:%.*]], i8* noalias nocapture nofree readnone [[C:%.*]]) +; IS__TUNIT____-NEXT: call void @use_i8_ptr(i8* noalias nocapture nofree nonnull readnone [[A]]) +; IS__TUNIT____-NEXT: call void @use_i8_ptr(i8* noalias nocapture nofree readnone [[B]]) +; IS__TUNIT____-NEXT: call void @use_i8_ptr(i8* noalias nocapture nofree readnone [[C]]) ; IS__TUNIT____-NEXT: ret void ; ; IS__CGSCC____: Function Attrs: nounwind Index: llvm/test/Transforms/Attributor/returned.ll =================================================================== --- llvm/test/Transforms/Attributor/returned.ll +++ llvm/test/Transforms/Attributor/returned.ll @@ -314,8 +314,8 @@ ; IS__TUNIT____-LABEL: define {{[^@]+}}@ptr_scc_r1 ; IS__TUNIT____-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone returned [[R:%.*]], double* nocapture nofree readnone [[B:%.*]]) ; IS__TUNIT____-NEXT: entry: -; IS__TUNIT____-NEXT: [[CALL:%.*]] = call noundef double* @ptr_sink_r0(double* noalias nofree readnone "no-capture-maybe-returned" [[R]]) -; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[R]], double* noalias nofree readnone [[A]], double* noalias nofree noundef readnone [[CALL]]) +; IS__TUNIT____-NEXT: [[CALL:%.*]] = call double* @ptr_sink_r0(double* noalias nofree readnone "no-capture-maybe-returned" [[R]]) +; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[R]], double* noalias nofree readnone [[A]], double* noalias nofree readnone [[CALL]]) ; IS__TUNIT____-NEXT: ret double* [[CALL1]] ; ; IS__CGSCC____: Function Attrs: nofree noinline nosync nounwind readnone uwtable @@ -323,7 +323,7 @@ ; IS__CGSCC____-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone returned [[R:%.*]], double* nocapture nofree readnone [[B:%.*]]) ; IS__CGSCC____-NEXT: entry: ; IS__CGSCC____-NEXT: [[CALL:%.*]] = call double* @ptr_sink_r0(double* noalias nofree readnone [[R]]) -; IS__CGSCC____-NEXT: [[CALL1:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[R]], double* noalias nofree readnone [[A]], double* noalias nofree noundef readnone [[CALL]]) +; IS__CGSCC____-NEXT: [[CALL1:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[R]], double* noalias nofree readnone [[A]], double* noalias nofree readnone [[CALL]]) ; IS__CGSCC____-NEXT: ret double* [[CALL1]] ; entry: @@ -340,20 +340,20 @@ ; IS__TUNIT____-NEXT: [[CMP:%.*]] = icmp ugt double* [[A]], [[B]] ; IS__TUNIT____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; IS__TUNIT____: if.then: -; IS__TUNIT____-NEXT: [[CALL:%.*]] = call noundef double* @ptr_sink_r0(double* noalias nofree readnone "no-capture-maybe-returned" [[R]]) -; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[B]], double* noalias nofree readnone [[A]], double* noalias nofree noundef readnone [[CALL]]) +; IS__TUNIT____-NEXT: [[CALL:%.*]] = call double* @ptr_sink_r0(double* noalias nofree readnone "no-capture-maybe-returned" [[R]]) +; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[B]], double* noalias nofree readnone [[A]], double* noalias nofree readnone [[CALL]]) ; IS__TUNIT____-NEXT: br label [[RETURN:%.*]] ; IS__TUNIT____: if.end: ; IS__TUNIT____-NEXT: [[CMP2:%.*]] = icmp ult double* [[A]], [[B]] ; IS__TUNIT____-NEXT: br i1 [[CMP2]], label [[IF_THEN3:%.*]], label [[IF_END12:%.*]] ; IS__TUNIT____: if.then3: -; IS__TUNIT____-NEXT: [[CALL4:%.*]] = call noundef double* @ptr_sink_r0(double* noalias nofree readnone "no-capture-maybe-returned" [[B]]) -; IS__TUNIT____-NEXT: [[CALL5:%.*]] = call noundef double* @ptr_scc_r1(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[B]], double* noalias nocapture nofree readnone undef) -; IS__TUNIT____-NEXT: [[CALL6:%.*]] = call noundef double* @ptr_scc_r2(double* noalias nofree readnone [[R]], double* noalias nofree readnone [[R]], double* noalias nofree readnone [[R]]) -; IS__TUNIT____-NEXT: [[CALL7:%.*]] = call noundef double* @ptr_scc_r1(double* noalias nofree readnone [[A]], double* noalias nofree noundef readnone [[CALL6]], double* noalias nocapture nofree readnone undef) -; IS__TUNIT____-NEXT: [[CALL8:%.*]] = call noundef double* @ptr_scc_r2(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[B]], double* noalias nofree readnone [[R]]) -; IS__TUNIT____-NEXT: [[CALL9:%.*]] = call noundef double* @ptr_scc_r2(double* noalias nofree noundef readnone [[CALL5]], double* noalias nofree noundef readnone [[CALL7]], double* noalias nofree noundef readnone [[CALL8]]) -; IS__TUNIT____-NEXT: [[CALL11:%.*]] = call double* @ptr_scc_r1(double* noalias nofree noundef readnone [[CALL4]], double* noalias nofree noundef readnone [[CALL9]], double* noalias nocapture nofree noundef readnone undef) +; IS__TUNIT____-NEXT: [[CALL4:%.*]] = call double* @ptr_sink_r0(double* noalias nofree readnone "no-capture-maybe-returned" [[B]]) +; IS__TUNIT____-NEXT: [[CALL5:%.*]] = call double* @ptr_scc_r1(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[B]], double* noalias nocapture nofree readnone undef) +; IS__TUNIT____-NEXT: [[CALL6:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[R]], double* noalias nofree readnone [[R]], double* noalias nofree readnone [[R]]) +; IS__TUNIT____-NEXT: [[CALL7:%.*]] = call double* @ptr_scc_r1(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[CALL6]], double* noalias nocapture nofree readnone undef) +; IS__TUNIT____-NEXT: [[CALL8:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[B]], double* noalias nofree readnone [[R]]) +; IS__TUNIT____-NEXT: [[CALL9:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[CALL5]], double* noalias nofree readnone [[CALL7]], double* noalias nofree readnone [[CALL8]]) +; IS__TUNIT____-NEXT: [[CALL11:%.*]] = call double* @ptr_scc_r1(double* noalias nofree readnone [[CALL4]], double* noalias nofree readnone [[CALL9]], double* noalias nocapture nofree readnone undef) ; IS__TUNIT____-NEXT: br label [[RETURN]] ; IS__TUNIT____: if.end12: ; IS__TUNIT____-NEXT: [[CMP13:%.*]] = icmp eq double* [[A]], [[B]] @@ -378,19 +378,19 @@ ; IS__CGSCC____-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] ; IS__CGSCC____: if.then: ; IS__CGSCC____-NEXT: [[CALL:%.*]] = call double* @ptr_sink_r0(double* noalias nofree readnone [[R]]) -; IS__CGSCC____-NEXT: [[CALL1:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[B]], double* noalias nofree readnone [[A]], double* noalias nofree noundef readnone [[CALL]]) +; IS__CGSCC____-NEXT: [[CALL1:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[B]], double* noalias nofree readnone [[A]], double* noalias nofree readnone [[CALL]]) ; IS__CGSCC____-NEXT: br label [[RETURN:%.*]] ; IS__CGSCC____: if.end: ; IS__CGSCC____-NEXT: [[CMP2:%.*]] = icmp ult double* [[A]], [[B]] ; IS__CGSCC____-NEXT: br i1 [[CMP2]], label [[IF_THEN3:%.*]], label [[IF_END12:%.*]] ; IS__CGSCC____: if.then3: ; IS__CGSCC____-NEXT: [[CALL4:%.*]] = call double* @ptr_sink_r0(double* noalias nofree readnone [[B]]) -; IS__CGSCC____-NEXT: [[CALL5:%.*]] = call noundef double* @ptr_scc_r1(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[B]], double* noalias nocapture nofree readnone undef) -; IS__CGSCC____-NEXT: [[CALL6:%.*]] = call noundef double* @ptr_scc_r2(double* noalias nofree readnone [[R]], double* noalias nofree readnone [[R]], double* noalias nofree readnone [[R]]) -; IS__CGSCC____-NEXT: [[CALL7:%.*]] = call noundef double* @ptr_scc_r1(double* noalias nofree readnone [[A]], double* noalias nofree noundef readnone [[CALL6]], double* noalias nocapture nofree readnone undef) -; IS__CGSCC____-NEXT: [[CALL8:%.*]] = call noundef double* @ptr_scc_r2(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[B]], double* noalias nofree readnone [[R]]) -; IS__CGSCC____-NEXT: [[CALL9:%.*]] = call noundef double* @ptr_scc_r2(double* noalias nofree noundef readnone [[CALL5]], double* noalias nofree noundef readnone [[CALL7]], double* noalias nofree noundef readnone [[CALL8]]) -; IS__CGSCC____-NEXT: [[CALL11:%.*]] = call double* @ptr_scc_r1(double* noalias nofree noundef readnone [[CALL4]], double* noalias nofree noundef readnone [[CALL9]], double* noalias nocapture nofree noundef readnone undef) +; IS__CGSCC____-NEXT: [[CALL5:%.*]] = call double* @ptr_scc_r1(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[B]], double* noalias nocapture nofree readnone undef) +; IS__CGSCC____-NEXT: [[CALL6:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[R]], double* noalias nofree readnone [[R]], double* noalias nofree readnone [[R]]) +; IS__CGSCC____-NEXT: [[CALL7:%.*]] = call double* @ptr_scc_r1(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[CALL6]], double* noalias nocapture nofree readnone undef) +; IS__CGSCC____-NEXT: [[CALL8:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[A]], double* noalias nofree readnone [[B]], double* noalias nofree readnone [[R]]) +; IS__CGSCC____-NEXT: [[CALL9:%.*]] = call double* @ptr_scc_r2(double* noalias nofree readnone [[CALL5]], double* noalias nofree readnone [[CALL7]], double* noalias nofree readnone [[CALL8]]) +; IS__CGSCC____-NEXT: [[CALL11:%.*]] = call double* @ptr_scc_r1(double* noalias nofree readnone [[CALL4]], double* noalias nofree readnone [[CALL9]], double* noalias nocapture nofree readnone undef) ; IS__CGSCC____-NEXT: br label [[RETURN]] ; IS__CGSCC____: if.end12: ; IS__CGSCC____-NEXT: [[CMP13:%.*]] = icmp eq double* [[A]], [[B]] @@ -1433,7 +1433,7 @@ ; ; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync nounwind readnone uwtable willreturn ; IS__CGSCC____-LABEL: define {{[^@]+}}@dont_use_const() -; IS__CGSCC____-NEXT: [[C:%.*]] = musttail call nonnull dereferenceable(1) i32* @ret_const() +; IS__CGSCC____-NEXT: [[C:%.*]] = musttail call noundef nonnull dereferenceable(1) i32* @ret_const() ; IS__CGSCC____-NEXT: ret i32* [[C]] ; %c = musttail call i32* @ret_const()