628 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC4 5; Most reduced from the OpenMC app running OpenMP offloading code, caused crashes before as we6; mixed local and remote (=intra and inter procedural) values.7 8target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"9 10%S = type { ptr }11%S.2 = type { ptr, i64, i64 }12%struct1 = type { %struct2 }13%struct2 = type <{ ptr, i64, i64, i32, [4 x i8] }>14 15define i64 @t1(ptr %first, ptr %first.addr, ptr %0) {16; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)17; TUNIT-LABEL: define {{[^@]+}}@t118; TUNIT-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST:%.*]], ptr nofree readnone captures(none) [[FIRST_ADDR:%.*]], ptr nofree readnone captures(none) [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {19; TUNIT-NEXT: entry:20; TUNIT-NEXT: [[FIRST_ADDR1:%.*]] = alloca ptr, i32 0, align 821; TUNIT-NEXT: store ptr [[FIRST]], ptr [[FIRST]], align 822; TUNIT-NEXT: br label [[IF_END:%.*]]23; TUNIT: if.end:24; TUNIT-NEXT: [[CALL:%.*]] = call ptr @foo.4(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST]]) #[[ATTR3:[0-9]+]]25; TUNIT-NEXT: ret i64 026;27; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write)28; CGSCC-LABEL: define {{[^@]+}}@t129; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST:%.*]], ptr nofree readnone captures(none) [[FIRST_ADDR:%.*]], ptr nofree readnone captures(none) [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {30; CGSCC-NEXT: entry:31; CGSCC-NEXT: [[FIRST_ADDR1:%.*]] = alloca ptr, i32 0, align 832; CGSCC-NEXT: store ptr [[FIRST]], ptr [[FIRST]], align 833; CGSCC-NEXT: br label [[IF_END:%.*]]34; CGSCC: if.end:35; CGSCC-NEXT: [[CALL:%.*]] = call ptr @foo.4(ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FIRST]]) #[[ATTR6:[0-9]+]]36; CGSCC-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds double, ptr [[CALL]], i64 -137; CGSCC-NEXT: ret i64 038;39entry:40 %first.addr1 = alloca ptr, i32 0, align 841 store ptr %first, ptr %first, align 842 br label %if.end43 44if.end: ; preds = %entry45 %1 = load ptr, ptr %first, align 846 %call = call ptr @foo.4(ptr %first)47 %add.ptr = getelementptr inbounds double, ptr %call, i64 -148 ret i64 049}50 51define internal ptr @foo.4(ptr %__first) {52; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)53; TUNIT-LABEL: define {{[^@]+}}@foo.454; TUNIT-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[__FIRST:%.*]]) #[[ATTR0]] {55; TUNIT-NEXT: entry:56; TUNIT-NEXT: [[__FIRST_ADDR:%.*]] = alloca ptr, i32 0, align 857; TUNIT-NEXT: store ptr [[__FIRST]], ptr [[__FIRST]], align 858; TUNIT-NEXT: ret ptr undef59;60; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write)61; CGSCC-LABEL: define {{[^@]+}}@foo.462; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[__FIRST:%.*]]) #[[ATTR0]] {63; CGSCC-NEXT: entry:64; CGSCC-NEXT: [[__FIRST_ADDR:%.*]] = alloca ptr, i32 0, align 865; CGSCC-NEXT: store ptr [[__FIRST]], ptr [[__FIRST]], align 866; CGSCC-NEXT: [[CALL1:%.*]] = call noalias noundef nonnull align 8 dereferenceable(8) ptr @bar(ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) [[__FIRST]]) #[[ATTR7:[0-9]+]]67; CGSCC-NEXT: ret ptr [[CALL1]]68;69entry:70 %__first.addr = alloca ptr, i32 0, align 871 store ptr %__first, ptr %__first, align 872 %0 = load ptr, ptr %__first, align 873 %call1 = call ptr @bar(ptr %__first)74 ret ptr %call175}76 77define internal ptr @bar(ptr %QQfirst) {78; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)79; CGSCC-LABEL: define {{[^@]+}}@bar80; CGSCC-SAME: (ptr noalias nofree noundef nonnull readnone returned align 8 dereferenceable(8) "no-capture-maybe-returned" [[QQFIRST:%.*]]) #[[ATTR1:[0-9]+]] {81; CGSCC-NEXT: entry:82; CGSCC-NEXT: [[QQFIRST_ADDR:%.*]] = alloca ptr, i32 0, align 883; CGSCC-NEXT: store ptr [[QQFIRST]], ptr [[QQFIRST_ADDR]], align 884; CGSCC-NEXT: br label [[WHILE_COND:%.*]]85; CGSCC: while.cond:86; CGSCC-NEXT: br label [[WHILE_END:%.*]]87; CGSCC: while.end:88; CGSCC-NEXT: ret ptr [[QQFIRST]]89;90entry:91 %QQfirst.addr = alloca ptr, i32 0, align 892 store ptr %QQfirst, ptr %QQfirst.addr, align 893 br label %while.cond94 95while.cond: ; preds = %entry96 br label %while.end97 98while.end: ; preds = %while.cond99 %0 = load ptr, ptr %QQfirst.addr, align 8100 ret ptr %0101}102 103define ptr @t2(ptr %this, ptr %this.addr, ptr %this1) {104; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)105; TUNIT-LABEL: define {{[^@]+}}@t2106; TUNIT-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree readnone captures(none) [[THIS_ADDR:%.*]], ptr nofree readnone captures(none) [[THIS1:%.*]]) #[[ATTR1:[0-9]+]] {107; TUNIT-NEXT: entry:108; TUNIT-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8109; TUNIT-NEXT: [[CALL:%.*]] = call [[S:%.*]] @[[FOO_1:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]](ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4:[0-9]+]]110; TUNIT-NEXT: [[TEST_RET:%.*]] = extractvalue [[S]] [[CALL]], 0111; TUNIT-NEXT: ret ptr [[TEST_RET]]112;113; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)114; CGSCC-LABEL: define {{[^@]+}}@t2115; CGSCC-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree readnone captures(none) [[THIS_ADDR:%.*]], ptr nofree readnone captures(none) [[THIS1:%.*]]) #[[ATTR2:[0-9]+]] {116; CGSCC-NEXT: entry:117; CGSCC-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8118; CGSCC-NEXT: [[CALL:%.*]] = call [[S:%.*]] @[[FOO_1:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]](ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8:[0-9]+]]119; CGSCC-NEXT: [[TEST_RET:%.*]] = extractvalue [[S]] [[CALL]], 0120; CGSCC-NEXT: ret ptr [[TEST_RET]]121;122entry:123 store ptr %this, ptr %this, align 8124 %this12 = load ptr, ptr %this, align 8125 %call = call %S @foo.1(ptr %this)126 %test.ret = extractvalue %S %call, 0127 ret ptr %test.ret128}129 130define internal %S @foo.1(ptr %foo.this) {131; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)132; TUNIT-LABEL: define {{[^@]+}}@foo.1133; TUNIT-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR1]] {134; TUNIT-NEXT: entry:135; TUNIT-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8136; TUNIT-NEXT: store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8137; TUNIT-NEXT: call void @bar.2(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR5:[0-9]+]]138; TUNIT-NEXT: [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8139; TUNIT-NEXT: ret [[S]] [[FOO_RET]]140;141; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)142; CGSCC-LABEL: define {{[^@]+}}@foo.1143; CGSCC-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[FOO_THIS:%.*]]) #[[ATTR2]] {144; CGSCC-NEXT: entry:145; CGSCC-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8146; CGSCC-NEXT: store ptr [[FOO_THIS]], ptr [[FOO_THIS]], align 8147; CGSCC-NEXT: call void @bar.2(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[FOO_THIS]]) #[[ATTR6]]148; CGSCC-NEXT: [[FOO_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8149; CGSCC-NEXT: ret [[S]] [[FOO_RET]]150;151entry:152 %retval = alloca %S, i32 0, align 8153 store ptr %foo.this, ptr %foo.this, align 8154 call void @bar.2(ptr %retval, ptr %foo.this)155 %foo.ret = load %S, ptr %retval, align 8156 ret %S %foo.ret157}158 159define internal void @bar.2(ptr %bar.this, ptr %bar.data) {160; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)161; TUNIT-LABEL: define {{[^@]+}}@bar.2162; TUNIT-SAME: (ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {163; TUNIT-NEXT: entry:164; TUNIT-NEXT: store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8165; TUNIT-NEXT: call void @baz(ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR5]]166; TUNIT-NEXT: ret void167;168; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write)169; CGSCC-LABEL: define {{[^@]+}}@bar.2170; CGSCC-SAME: (ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[BAR_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA:%.*]]) #[[ATTR0]] {171; CGSCC-NEXT: entry:172; CGSCC-NEXT: store ptr [[BAR_DATA]], ptr [[BAR_THIS]], align 8173; CGSCC-NEXT: call void @baz(ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[BAR_THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAR_DATA]]) #[[ATTR6]]174; CGSCC-NEXT: ret void175;176entry:177 store ptr %bar.data, ptr %bar.this, align 8178 call void @baz(ptr %bar.this, ptr %bar.data)179 ret void180}181 182define internal void @baz(ptr %baz.this, ptr %baz.data) {183; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)184; TUNIT-LABEL: define {{[^@]+}}@baz185; TUNIT-SAME: (ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[BAZ_THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[BAZ_DATA:%.*]]) #[[ATTR0]] {186; TUNIT-NEXT: entry:187; TUNIT-NEXT: store ptr [[BAZ_DATA]], ptr [[BAZ_THIS]], align 8188; TUNIT-NEXT: ret void189;190; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)191; CGSCC-LABEL: define {{[^@]+}}@baz192; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[BAZ_THIS:%.*]], ptr nofree writeonly [[BAZ_DATA:%.*]]) #[[ATTR3:[0-9]+]] {193; CGSCC-NEXT: entry:194; CGSCC-NEXT: store ptr [[BAZ_DATA]], ptr [[BAZ_THIS]], align 8195; CGSCC-NEXT: ret void196;197entry:198 store ptr %baz.data, ptr %baz.this, align 8199 ret void200}201 202define ptr @foo(ptr %this, ptr %this.addr, ptr %this1) {203; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)204; TUNIT-LABEL: define {{[^@]+}}@foo205; TUNIT-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree readnone captures(none) [[THIS_ADDR:%.*]], ptr nofree readnone captures(none) [[THIS1:%.*]]) #[[ATTR1]] {206; TUNIT-NEXT: entry:207; TUNIT-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8208; TUNIT-NEXT: [[CALL:%.*]] = call [[S:%.*]] @[[BAR_5:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]](ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]]209; TUNIT-NEXT: [[FOO_RET:%.*]] = extractvalue [[S]] [[CALL]], 0210; TUNIT-NEXT: ret ptr [[FOO_RET]]211;212; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)213; CGSCC-LABEL: define {{[^@]+}}@foo214; CGSCC-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree readnone captures(none) [[THIS_ADDR:%.*]], ptr nofree readnone captures(none) [[THIS1:%.*]]) #[[ATTR2]] {215; CGSCC-NEXT: entry:216; CGSCC-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8217; CGSCC-NEXT: [[CALL:%.*]] = call [[S:%.*]] @[[BAR_5:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]](ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]218; CGSCC-NEXT: [[FOO_RET:%.*]] = extractvalue [[S]] [[CALL]], 0219; CGSCC-NEXT: ret ptr [[FOO_RET]]220;221entry:222 store ptr %this, ptr %this, align 8223 %this12 = load ptr, ptr %this, align 8224 %call = call %S @bar.5(ptr %this)225 %foo.ret = extractvalue %S %call, 0226 ret ptr %foo.ret227}228 229define internal %S @bar.5(ptr %this) {230; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)231; TUNIT-LABEL: define {{[^@]+}}@bar.5232; TUNIT-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR1]] {233; TUNIT-NEXT: entry:234; TUNIT-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8235; TUNIT-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8236; TUNIT-NEXT: call void @baz.6(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR4]]237; TUNIT-NEXT: [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8238; TUNIT-NEXT: ret [[S]] [[BAR_RET]]239;240; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)241; CGSCC-LABEL: define {{[^@]+}}@bar.5242; CGSCC-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {243; CGSCC-NEXT: entry:244; CGSCC-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8245; CGSCC-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8246; CGSCC-NEXT: call void @baz.6(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR9:[0-9]+]]247; CGSCC-NEXT: [[BAR_RET:%.*]] = load [[S]], ptr [[RETVAL]], align 8248; CGSCC-NEXT: ret [[S]] [[BAR_RET]]249;250entry:251 %retval = alloca %S, i32 0, align 8252 store ptr %this, ptr %this, align 8253 %0 = load ptr, ptr %this, align 8254 call void @baz.6(ptr %retval, ptr %this)255 %bar.ret = load %S, ptr %retval, align 8256 ret %S %bar.ret257}258 259define internal void @baz.6(ptr %this, ptr %data) {260; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)261; TUNIT-LABEL: define {{[^@]+}}@baz.6262; TUNIT-SAME: (ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] {263; TUNIT-NEXT: entry:264; TUNIT-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8265; TUNIT-NEXT: call void @boom(ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR4]]266; TUNIT-NEXT: ret void267;268; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)269; CGSCC-LABEL: define {{[^@]+}}@baz.6270; CGSCC-SAME: (ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR2]] {271; CGSCC-NEXT: entry:272; CGSCC-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8273; CGSCC-NEXT: call void @boom(ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA]]) #[[ATTR9]]274; CGSCC-NEXT: ret void275;276entry:277 store ptr %data, ptr %this, align 8278 call void @boom(ptr %this, ptr %data)279 ret void280}281 282define internal void @boom(ptr %this, ptr %data) {283; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)284; TUNIT-LABEL: define {{[^@]+}}@boom285; TUNIT-SAME: (ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR1]] {286; TUNIT-NEXT: entry:287; TUNIT-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8288; TUNIT-NEXT: store ptr [[DATA]], ptr [[DATA_ADDR]], align 8289; TUNIT-NEXT: [[V:%.*]] = load ptr, ptr [[DATA_ADDR]], align 8290; TUNIT-NEXT: store ptr [[V]], ptr [[THIS]], align 8291; TUNIT-NEXT: ret void292;293; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)294; CGSCC-LABEL: define {{[^@]+}}@boom295; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]], ptr nofree [[DATA:%.*]]) #[[ATTR4:[0-9]+]] {296; CGSCC-NEXT: entry:297; CGSCC-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8298; CGSCC-NEXT: store ptr [[DATA]], ptr [[DATA_ADDR]], align 8299; CGSCC-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8300; CGSCC-NEXT: ret void301;302entry:303 %data.addr = alloca ptr, i32 0, align 8304 store ptr %data, ptr %data.addr, align 8305 %v = load ptr, ptr %data.addr, align 8306 store ptr %v, ptr %this, align 8307 ret void308}309 310define weak_odr void @t3() {311; CHECK-LABEL: define {{[^@]+}}@t3() {312; CHECK-NEXT: entry:313; CHECK-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_target_init(ptr noundef null)314; CHECK-NEXT: br label [[USER_CODE_ENTRY:%.*]]315; CHECK: user_code.entry:316; CHECK-NEXT: br label [[FOR_COND:%.*]]317; CHECK: for.cond:318; CHECK-NEXT: br label [[FOR_BODY:%.*]]319; CHECK: for.body:320; CHECK-NEXT: [[CALL4:%.*]] = call [[S_2:%.*]] @[[T3_HELPER:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]]()321; CHECK-NEXT: ret void322;323entry:324 %0 = call i32 @__kmpc_target_init(ptr null)325 br label %user_code.entry326 327user_code.entry: ; preds = %entry328 br label %for.cond329 330for.cond: ; preds = %user_code.entry331 br label %for.body332 333for.body: ; preds = %for.cond334 %call4 = call %S.2 @t3.helper()335 ret void336}337 338declare i32 @__kmpc_target_init(ptr)339 340define %S.2 @t3.helper() {341; CHECK-LABEL: define {{[^@]+}}@t3.helper() {342; CHECK-NEXT: entry:343; CHECK-NEXT: [[RETVAL:%.*]] = alloca [[S_2:%.*]], align 8344; CHECK-NEXT: call void @ext1(ptr noundef nonnull align 8 dereferenceable(24) [[RETVAL]])345; CHECK-NEXT: ret [[S_2]] zeroinitializer346;347entry:348 %retval = alloca %S.2, align 8349 call void @ext1(ptr %retval)350 %.fca.0.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 0351 %.fca.0.load = load ptr, ptr %.fca.0.gep, align 8352 %.fca.0.insert = insertvalue %S.2 poison, ptr %.fca.0.load, 0353 %.fca.1.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 1354 %.fca.1.load = load i64, ptr %.fca.1.gep, align 8355 %.fca.1.insert = insertvalue %S.2 %.fca.0.insert, i64 %.fca.1.load, 1356 %.fca.2.gep = getelementptr inbounds %S.2, ptr %retval, i32 0, i32 2357 %.fca.2.load = load i64, ptr %.fca.2.gep, align 8358 %.fca.2.insert = insertvalue %S.2 %.fca.1.insert, i64 %.fca.2.load, 2359 ret %S.2 zeroinitializer360}361 362declare void @ext1(ptr)363 364; Taken from https://github.com/llvm/llvm-project/issues/54981365define dso_local void @spam() {366; TUNIT: Function Attrs: nofree norecurse noreturn nosync nounwind memory(none)367; TUNIT-LABEL: define {{[^@]+}}@spam368; TUNIT-SAME: () #[[ATTR2:[0-9]+]] {369; TUNIT-NEXT: bb:370; TUNIT-NEXT: [[TMP:%.*]] = alloca i32, align 4371; TUNIT-NEXT: [[X:%.*]] = fptosi float undef to i32372; TUNIT-NEXT: store i32 [[X]], ptr [[TMP]], align 4373; TUNIT-NEXT: br label [[BB16:%.*]]374; TUNIT: bb16:375; TUNIT-NEXT: [[TMP18:%.*]] = icmp eq i32 [[X]], 0376; TUNIT-NEXT: br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]377; TUNIT: bb19:378; TUNIT-NEXT: br label [[BB23:%.*]]379; TUNIT: bb23:380; TUNIT-NEXT: br label [[BB25:%.*]]381; TUNIT: bb25:382; TUNIT-NEXT: unreachable383; TUNIT: bb28:384; TUNIT-NEXT: unreachable385; TUNIT: bb34:386; TUNIT-NEXT: unreachable387; TUNIT: bb35:388; TUNIT-NEXT: unreachable389;390; CGSCC: Function Attrs: nofree norecurse noreturn nosync nounwind memory(none)391; CGSCC-LABEL: define {{[^@]+}}@spam392; CGSCC-SAME: () #[[ATTR5:[0-9]+]] {393; CGSCC-NEXT: bb:394; CGSCC-NEXT: [[TMP:%.*]] = alloca i32, align 4395; CGSCC-NEXT: [[X:%.*]] = fptosi float undef to i32396; CGSCC-NEXT: store i32 [[X]], ptr [[TMP]], align 4397; CGSCC-NEXT: br label [[BB16:%.*]]398; CGSCC: bb16:399; CGSCC-NEXT: [[TMP18:%.*]] = icmp eq i32 [[X]], 0400; CGSCC-NEXT: br i1 [[TMP18]], label [[BB35:%.*]], label [[BB19:%.*]]401; CGSCC: bb19:402; CGSCC-NEXT: br label [[BB23:%.*]]403; CGSCC: bb23:404; CGSCC-NEXT: br label [[BB25:%.*]]405; CGSCC: bb25:406; CGSCC-NEXT: unreachable407; CGSCC: bb28:408; CGSCC-NEXT: unreachable409; CGSCC: bb34:410; CGSCC-NEXT: unreachable411; CGSCC: bb35:412; CGSCC-NEXT: unreachable413;414bb:415 %tmp = alloca i32, align 4416 %tmp12 = getelementptr inbounds i32, ptr %tmp, i64 0417 %tmp15 = getelementptr inbounds i32, ptr %tmp, i64 0418 %x = fptosi float undef to i32419 store i32 %x, ptr %tmp15, align 4420 br label %bb16421 422bb16: ; preds = %bb423 %tmp17 = load i32, ptr %tmp12, align 4424 %tmp18 = icmp eq i32 %tmp17, 0425 br i1 %tmp18, label %bb35, label %bb19426 427bb19: ; preds = %bb16428 %y = getelementptr inbounds i32, ptr %tmp, i64 0429 %tmp20 = bitcast ptr %y to ptr430 %tmp21 = load float, ptr %tmp20, align 4431 %tmp22 = fadd fast float %tmp21, 0.000000e+00432 br label %bb23433 434bb23: ; preds = %bb34, %bb19435 %tmp24 = phi <2 x float> [ undef, %bb19 ], [ %tmp26, %bb34 ]436 br label %bb25437 438bb25: ; preds = %bb28, %bb23439 %tmp26 = phi <2 x float> [ %tmp30, %bb28 ], [ %tmp24, %bb23 ]440 %tmp27 = icmp ult i32 undef, 8441 br i1 %tmp27, label %bb28, label %bb34442 443bb28: ; preds = %bb25444 %tmp29 = insertelement <2 x float> %tmp26, float undef, i32 0445 %tmp30 = insertelement <2 x float> %tmp29, float %tmp22, i32 1446 br label %bb25447 448bb34: ; preds = %bb25449 br label %bb23450 451bb35: ; preds = %bb16452 unreachable453}454 455define double @t4(ptr %this, ptr %this.addr, ptr %this1) {456; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)457; TUNIT-LABEL: define {{[^@]+}}@t4458; TUNIT-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree readnone captures(none) [[THIS_ADDR:%.*]], ptr nofree readnone captures(none) [[THIS1:%.*]]) #[[ATTR0]] {459; TUNIT-NEXT: entry:460; TUNIT-NEXT: [[THIS_ADDR1:%.*]] = alloca ptr, i32 0, align 8461; TUNIT-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8462; TUNIT-NEXT: [[CALL:%.*]] = call [[S:%.*]] @[[T4A:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]](ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR5]]463; TUNIT-NEXT: ret double 0.000000e+00464;465; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)466; CGSCC-LABEL: define {{[^@]+}}@t4467; CGSCC-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]], ptr nofree readnone captures(none) [[THIS_ADDR:%.*]], ptr nofree readnone captures(none) [[THIS1:%.*]]) #[[ATTR2]] {468; CGSCC-NEXT: entry:469; CGSCC-NEXT: [[THIS_ADDR1:%.*]] = alloca ptr, i32 0, align 8470; CGSCC-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8471; CGSCC-NEXT: [[CALL:%.*]] = call [[S:%.*]] @[[T4A:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]](ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS]]) #[[ATTR8]]472; CGSCC-NEXT: [[TMP0:%.*]] = extractvalue [[S]] [[CALL]], 0473; CGSCC-NEXT: ret double 0.000000e+00474;475entry:476 %this.addr1 = alloca ptr, i32 0, align 8477 store ptr %this, ptr %this, align 8478 %this12 = load ptr, ptr %this, align 8479 %call = call %S @t4a(ptr %this)480 %0 = extractvalue %S %call, 0481 ret double 0.000000e+00482}483 484define internal %S @t4a(ptr %this) {485; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)486; TUNIT-LABEL: define {{[^@]+}}@t4a487; TUNIT-SAME: (ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {488; TUNIT-NEXT: entry:489; TUNIT-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8490; TUNIT-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8491; TUNIT-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8492; TUNIT-NEXT: call void @t4b(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) [[RETVAL]]) #[[ATTR5]]493; TUNIT-NEXT: ret [[S]] undef494;495; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)496; CGSCC-LABEL: define {{[^@]+}}@t4a497; CGSCC-SAME: (ptr nofree noundef nonnull align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR2]] {498; CGSCC-NEXT: entry:499; CGSCC-NEXT: [[RETVAL:%.*]] = alloca [[S:%.*]], i32 0, align 8500; CGSCC-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8501; CGSCC-NEXT: store ptr [[THIS]], ptr [[THIS]], align 8502; CGSCC-NEXT: call void @t4b(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[RETVAL]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[THIS]]) #[[ATTR6]]503; CGSCC-NEXT: [[TMP0:%.*]] = load [[S]], ptr [[RETVAL]], align 8504; CGSCC-NEXT: ret [[S]] [[TMP0]]505;506entry:507 %retval = alloca %S, i32 0, align 8508 %this.addr = alloca ptr, i32 0, align 8509 store ptr %this, ptr %this, align 8510 %this1 = load ptr, ptr %this, align 8511 %buffer_ = getelementptr inbounds %struct1, ptr %this1, i32 0, i32 0512 %data_ = getelementptr inbounds %struct2, ptr %buffer_, i32 0, i32 0513 %0 = load ptr, ptr %this, align 8514 call void @t4b(ptr %retval, ptr %this)515 %1 = load %S, ptr %retval, align 8516 ret %S %1517}518 519define internal void @t4b(ptr %this, ptr %data) {520; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)521; TUNIT-LABEL: define {{[^@]+}}@t4b522; TUNIT-SAME: (ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {523; TUNIT-NEXT: entry:524; TUNIT-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8525; TUNIT-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8526; TUNIT-NEXT: call void @t4c(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS]]) #[[ATTR5]]527; TUNIT-NEXT: ret void528;529; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write)530; CGSCC-LABEL: define {{[^@]+}}@t4b531; CGSCC-SAME: (ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA:%.*]]) #[[ATTR0]] {532; CGSCC-NEXT: entry:533; CGSCC-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8534; CGSCC-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8535; CGSCC-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8536; CGSCC-NEXT: call void @t4c(ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS]], ptr nofree noundef nonnull writeonly align 8 dereferenceable(8) [[DATA]]) #[[ATTR6]]537; CGSCC-NEXT: ret void538;539entry:540 %this.addr = alloca ptr, i32 0, align 8541 %data.addr = alloca ptr, i32 0, align 8542 store ptr %this, ptr %this.addr, align 8543 store ptr %data, ptr %this, align 8544 %this1 = load ptr, ptr %this, align 8545 %0 = load ptr, ptr %this, align 8546 call void @t4c(ptr %this, ptr %data)547 ret void548}549 550define internal void @t4c(ptr %this, ptr %data) {551; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)552; TUNIT-LABEL: define {{[^@]+}}@t4c553; TUNIT-SAME: (ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] {554; TUNIT-NEXT: entry:555; TUNIT-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8556; TUNIT-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8557; TUNIT-NEXT: ret void558;559; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)560; CGSCC-LABEL: define {{[^@]+}}@t4c561; CGSCC-SAME: (ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[THIS:%.*]], ptr nofree writeonly [[DATA:%.*]]) #[[ATTR3]] {562; CGSCC-NEXT: entry:563; CGSCC-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, i32 0, align 8564; CGSCC-NEXT: [[DATA_ADDR:%.*]] = alloca ptr, i32 0, align 8565; CGSCC-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8566; CGSCC-NEXT: store ptr [[DATA]], ptr [[THIS]], align 8567; CGSCC-NEXT: ret void568;569entry:570 %this.addr = alloca ptr, i32 0, align 8571 %data.addr = alloca ptr, i32 0, align 8572 store ptr %this, ptr %this.addr, align 8573 store ptr %data, ptr %this, align 8574 %this1 = load ptr, ptr %this, align 8575 %data_ = getelementptr inbounds %S, ptr %this1, i32 0, i32 0576 %0 = load ptr, ptr %this, align 8577 store ptr %data, ptr %this, align 8578 ret void579}580 581!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7}582 583!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]}584!1 = !{i32 1, !"wchar_size", i32 4}585!2 = !{i32 7, !"openmp", i32 50}586!3 = !{i32 7, !"openmp-device", i32 50}587!4 = !{i32 8, !"PIC Level", i32 2}588!5 = !{i32 7, !"frame-pointer", i32 2}589!6 = !{i32 7, !"Dwarf Version", i32 2}590!7 = !{i32 2, !"Debug Info Version", i32 3}591;.592; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }593; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }594; TUNIT: attributes #[[ATTR2]] = { nofree norecurse noreturn nosync nounwind memory(none) }595; TUNIT: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn memory(write) }596; TUNIT: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn }597; TUNIT: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn memory(write) }598;.599; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) }600; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }601; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) }602; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }603; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }604; CGSCC: attributes #[[ATTR5]] = { nofree norecurse noreturn nosync nounwind memory(none) }605; CGSCC: attributes #[[ATTR6]] = { nofree nounwind willreturn memory(write) }606; CGSCC: attributes #[[ATTR7]] = { nofree nosync willreturn }607; CGSCC: attributes #[[ATTR8]] = { nofree nounwind willreturn }608; CGSCC: attributes #[[ATTR9]] = { nofree nounwind willreturn memory(readwrite) }609;.610; TUNIT: [[META0:![0-9]+]] = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]}611; TUNIT: [[META1:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}612; TUNIT: [[META2:![0-9]+]] = !{i32 7, !"openmp", i32 50}613; TUNIT: [[META3:![0-9]+]] = !{i32 7, !"openmp-device", i32 50}614; TUNIT: [[META4:![0-9]+]] = !{i32 8, !"PIC Level", i32 2}615; TUNIT: [[META5:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}616; TUNIT: [[META6:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 2}617; TUNIT: [[META7:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}618;.619; CGSCC: [[META0:![0-9]+]] = !{i32 2, !"SDK Version", [2 x i32] [i32 11, i32 5]}620; CGSCC: [[META1:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}621; CGSCC: [[META2:![0-9]+]] = !{i32 7, !"openmp", i32 50}622; CGSCC: [[META3:![0-9]+]] = !{i32 7, !"openmp-device", i32 50}623; CGSCC: [[META4:![0-9]+]] = !{i32 8, !"PIC Level", i32 2}624; CGSCC: [[META5:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}625; CGSCC: [[META6:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 2}626; CGSCC: [[META7:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}627;.628