3745 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals all --version 62; 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%struct.S = type { i32, i32, i32, float, float, float }6 7@globalBytes = global [1024 x i8] zeroinitializer, align 168@Gint1 = global i32 zeroinitializer, align 49@Gint2 = global i32 zeroinitializer, align 410@Gstatic_int1 = internal global i32 zeroinitializer, align 411@Gstatic_int2 = internal global i32 zeroinitializer, align 412@Gstatic_int3 = internal global i32 zeroinitializer, align 413@Gstatic_undef_int1 = internal global i32 undef, align 414@Gstatic_undef_int2 = internal global i32 undef, align 415@GI1 = internal global i32 undef, align 416@GI2 = internal global i32 undef, align 417@Gs1 = internal global %struct.S undef, align 418@Gs2 = internal global %struct.S zeroinitializer, align 419@Vs1 = internal global %struct.S undef, align 420@Vs2 = internal global %struct.S undef, align 421@GBytes = internal global [1024 x i8] zeroinitializer, align 1622@Flag0 = global i32 0, align 423@Flag1 = internal global i32 undef, align 424@Flag2 = internal global i32 undef, align 425@Flag4 = internal global i32 undef, align 426@Flag3 = internal global i32 zeroinitializer, align 427@a1 = internal global i32 zeroinitializer28@a2 = internal global i32 zeroinitializer29@a3 = internal global i32 undef30@bytes1 = internal global i32 undef31@bytes2 = internal global i32 undef32@rec_storage = internal global i32 undef33 34;.35; CHECK: @globalBytes = global [1024 x i8] zeroinitializer, align 1636; CHECK: @Gint1 = global i32 0, align 437; CHECK: @Gint2 = global i32 0, align 438; CHECK: @Gstatic_int1 = internal global i32 0, align 439; CHECK: @Gstatic_int2 = internal global i32 0, align 440; CHECK: @Gstatic_int3 = internal global i32 0, align 441; CHECK: @Gstatic_undef_int1 = internal global i32 undef, align 442; CHECK: @Gstatic_undef_int2 = internal global i32 undef, align 443; CHECK: @GI1 = internal global i32 undef, align 444; CHECK: @GI2 = internal global i32 undef, align 445; CHECK: @Gs1 = internal global %struct.S undef, align 446; CHECK: @Gs2 = internal global %struct.S zeroinitializer, align 447; CHECK: @Vs1 = internal global %struct.S undef, align 448; CHECK: @Vs2 = internal global %struct.S undef, align 449; CHECK: @GBytes = internal global [1024 x i8] zeroinitializer, align 1650; CHECK: @Flag0 = global i32 0, align 451; CHECK: @Flag1 = internal global i32 undef, align 452; CHECK: @Flag2 = internal global i32 undef, align 453; CHECK: @Flag4 = internal global i32 undef, align 454; CHECK: @Flag3 = internal global i32 0, align 455; CHECK: @a1 = internal global i32 056; CHECK: @a2 = internal global i32 057; CHECK: @a3 = internal global i32 undef58; CHECK: @bytes1 = internal global i32 undef59; CHECK: @bytes2 = internal global i32 undef60; CHECK: @rec_storage = internal global i32 undef61; CHECK: @global = internal global %struct.STy zeroinitializer, align 862; CHECK: @G = internal global i32 0, align 463; CHECK: @GC = internal global i32 undef, align 464; CHECK: @GRS = internal thread_local global i32 undef65; CHECK: @GRS2 = global i32 undef66;.67define void @write_arg(ptr %p, i32 %v) {68; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)69; CHECK-LABEL: define void @write_arg(70; CHECK-SAME: ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[P:%.*]], i32 [[V:%.*]]) #[[ATTR0:[0-9]+]] {71; CHECK-NEXT: [[ENTRY:.*:]]72; CHECK-NEXT: store i32 [[V]], ptr [[P]], align 4, !tbaa [[INT_TBAA3:![0-9]+]]73; CHECK-NEXT: ret void74;75entry:76 store i32 %v, ptr %p, align 4, !tbaa !377 ret void78}79 80define void @write_random(ptr %p) {81; CHECK-LABEL: define void @write_random(82; CHECK-SAME: ptr nofree writeonly captures(none) [[P:%.*]]) {83; CHECK-NEXT: [[ENTRY:.*:]]84; CHECK-NEXT: [[CALL:%.*]] = call i32 (...) @random()85; CHECK-NEXT: store i32 [[CALL]], ptr [[P]], align 4, !tbaa [[INT_TBAA3]]86; CHECK-NEXT: ret void87;88entry:89 %call = call i32 (...) @random()90 store i32 %call, ptr %p, align 4, !tbaa !391 ret void92}93 94declare i32 @random(...)95 96; struct S local_alloca_simplifiable_1(void) {97; struct S s;98; s.f1 = 1.1;99; s.f2 = 2.2;100; s.f3 = 3.3;101; write_arg(&s.i1, 1);102; write_arg(&s.i2, 2);103; write_arg(&s.i3, 3);104; struct S r;105; r.f1 = s.f1;106; r.f2 = s.f2 * 2;107; r.f3 = s.f3 + s.f1;108; r.i1 = s.i1;109; r.i2 = s.i2 * 2;110; r.i3 = s.i3 + s.i1;111; return r;112; }113define void @local_alloca_simplifiable_1(ptr noalias sret(%struct.S) align 4 %agg.result) {114; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)115; TUNIT-LABEL: define void @local_alloca_simplifiable_1(116; TUNIT-SAME: ptr noalias nofree writeonly sret([[STRUCT_S:%.*]]) align 4 captures(none) dereferenceable_or_null(24) [[AGG_RESULT:%.*]]) #[[ATTR1:[0-9]+]] {117; TUNIT-NEXT: [[ENTRY:.*:]]118; TUNIT-NEXT: [[S:%.*]] = alloca [[STRUCT_S]], align 4119; TUNIT-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(24) [[S]]) #[[ATTR17:[0-9]+]]120; TUNIT-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3121; TUNIT-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4122; TUNIT-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5123; TUNIT-NEXT: call void @write_arg(ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(24) [[S]], i32 noundef 1) #[[ATTR18:[0-9]+]]124; TUNIT-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1125; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(20) [[I2]], i32 noundef 2) #[[ATTR18]]126; TUNIT-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2127; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(16) [[I3]], i32 noundef 3) #[[ATTR18]]128; TUNIT-NEXT: [[F12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3129; TUNIT-NEXT: store float 0x3FF19999A0000000, ptr [[F12]], align 4, !tbaa [[FLOAT_TBAA7:![0-9]+]]130; TUNIT-NEXT: [[F24:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4131; TUNIT-NEXT: store float 0x40119999A0000000, ptr [[F24]], align 4, !tbaa [[FLOAT_TBAA10:![0-9]+]]132; TUNIT-NEXT: [[F37:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5133; TUNIT-NEXT: store float 0x40119999A0000000, ptr [[F37]], align 4, !tbaa [[FLOAT_TBAA11:![0-9]+]]134; TUNIT-NEXT: store i32 1, ptr [[AGG_RESULT]], align 4, !tbaa [[INT_TBAA12:![0-9]+]]135; TUNIT-NEXT: [[I212:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1136; TUNIT-NEXT: store i32 4, ptr [[I212]], align 4, !tbaa [[INT_TBAA13:![0-9]+]]137; TUNIT-NEXT: [[I316:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2138; TUNIT-NEXT: store i32 4, ptr [[I316]], align 4, !tbaa [[INT_TBAA14:![0-9]+]]139; TUNIT-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(24) [[S]]) #[[ATTR17]]140; TUNIT-NEXT: ret void141;142; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)143; CGSCC-LABEL: define void @local_alloca_simplifiable_1(144; CGSCC-SAME: ptr noalias nofree noundef nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 captures(none) dereferenceable(24) [[AGG_RESULT:%.*]]) #[[ATTR1:[0-9]+]] {145; CGSCC-NEXT: [[ENTRY:.*:]]146; CGSCC-NEXT: [[S:%.*]] = alloca [[STRUCT_S]], align 4147; CGSCC-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(24) [[S]]) #[[ATTR20:[0-9]+]]148; CGSCC-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3149; CGSCC-NEXT: store float 0x3FF19999A0000000, ptr [[F1]], align 4, !tbaa [[FLOAT_TBAA7:![0-9]+]]150; CGSCC-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4151; CGSCC-NEXT: store float 0x40019999A0000000, ptr [[F2]], align 4, !tbaa [[FLOAT_TBAA10:![0-9]+]]152; CGSCC-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5153; CGSCC-NEXT: store float 0x400A666660000000, ptr [[F3]], align 4, !tbaa [[FLOAT_TBAA11:![0-9]+]]154; CGSCC-NEXT: call void @write_arg(ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(24) [[S]], i32 noundef 1) #[[ATTR21:[0-9]+]]155; CGSCC-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1156; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(20) [[I2]], i32 noundef 2) #[[ATTR21]]157; CGSCC-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2158; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(16) [[I3]], i32 noundef 3) #[[ATTR21]]159; CGSCC-NEXT: [[F11:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3160; CGSCC-NEXT: [[I4:%.*]] = load float, ptr [[F11]], align 4, !tbaa [[FLOAT_TBAA7]]161; CGSCC-NEXT: [[F12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3162; CGSCC-NEXT: store float [[I4]], ptr [[F12]], align 4, !tbaa [[FLOAT_TBAA7]]163; CGSCC-NEXT: [[F23:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 4164; CGSCC-NEXT: [[I5:%.*]] = load float, ptr [[F23]], align 4, !tbaa [[FLOAT_TBAA10]]165; CGSCC-NEXT: [[MUL:%.*]] = fmul float [[I5]], 2.000000e+00166; CGSCC-NEXT: [[F24:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4167; CGSCC-NEXT: store float [[MUL]], ptr [[F24]], align 4, !tbaa [[FLOAT_TBAA10]]168; CGSCC-NEXT: [[F35:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 5169; CGSCC-NEXT: [[I6:%.*]] = load float, ptr [[F35]], align 4, !tbaa [[FLOAT_TBAA11]]170; CGSCC-NEXT: [[F16:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 3171; CGSCC-NEXT: [[I7:%.*]] = load float, ptr [[F16]], align 4, !tbaa [[FLOAT_TBAA7]]172; CGSCC-NEXT: [[ADD:%.*]] = fadd float [[I6]], [[I7]]173; CGSCC-NEXT: [[F37:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5174; CGSCC-NEXT: store float [[ADD]], ptr [[F37]], align 4, !tbaa [[FLOAT_TBAA11]]175; CGSCC-NEXT: [[I8:%.*]] = load i32, ptr [[S]], align 4, !tbaa [[INT_TBAA12:![0-9]+]]176; CGSCC-NEXT: store i32 [[I8]], ptr [[AGG_RESULT]], align 4, !tbaa [[INT_TBAA12]]177; CGSCC-NEXT: [[I210:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 1178; CGSCC-NEXT: [[I9:%.*]] = load i32, ptr [[I210]], align 4, !tbaa [[INT_TBAA13:![0-9]+]]179; CGSCC-NEXT: [[MUL11:%.*]] = shl nsw i32 [[I9]], 1180; CGSCC-NEXT: [[I212:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1181; CGSCC-NEXT: store i32 [[MUL11]], ptr [[I212]], align 4, !tbaa [[INT_TBAA13]]182; CGSCC-NEXT: [[I313:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 2183; CGSCC-NEXT: [[I10:%.*]] = load i32, ptr [[I313]], align 4, !tbaa [[INT_TBAA14:![0-9]+]]184; CGSCC-NEXT: [[I11:%.*]] = load i32, ptr [[S]], align 4, !tbaa [[INT_TBAA12]]185; CGSCC-NEXT: [[ADD15:%.*]] = add nsw i32 [[I10]], [[I11]]186; CGSCC-NEXT: [[I316:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2187; CGSCC-NEXT: store i32 [[ADD15]], ptr [[I316]], align 4, !tbaa [[INT_TBAA14]]188; CGSCC-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(24) [[S]]) #[[ATTR20]]189; CGSCC-NEXT: ret void190;191entry:192 %s = alloca %struct.S, align 4193 call void @llvm.lifetime.start.p0(ptr nonnull %s)194 %f1 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3195 store float 0x3FF19999A0000000, ptr %f1, align 4, !tbaa !7196 %f2 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 4197 store float 0x40019999A0000000, ptr %f2, align 4, !tbaa !10198 %f3 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 5199 store float 0x400A666660000000, ptr %f3, align 4, !tbaa !11200 call void @write_arg(ptr nonnull %s, i32 1)201 %i2 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 1202 call void @write_arg(ptr nonnull %i2, i32 2)203 %i3 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 2204 call void @write_arg(ptr nonnull %i3, i32 3)205 %f11 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3206 %i4 = load float, ptr %f11, align 4, !tbaa !7207 %f12 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 3208 store float %i4, ptr %f12, align 4, !tbaa !7209 %f23 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 4210 %i5 = load float, ptr %f23, align 4, !tbaa !10211 %mul = fmul float %i5, 2.000000e+00212 %f24 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 4213 store float %mul, ptr %f24, align 4, !tbaa !10214 %f35 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 5215 %i6 = load float, ptr %f35, align 4, !tbaa !11216 %f16 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 3217 %i7 = load float, ptr %f16, align 4, !tbaa !7218 %add = fadd float %i6, %i7219 %f37 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 5220 store float %add, ptr %f37, align 4, !tbaa !11221 %i8 = load i32, ptr %s, align 4, !tbaa !12222 store i32 %i8, ptr %agg.result, align 4, !tbaa !12223 %i210 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 1224 %i9 = load i32, ptr %i210, align 4, !tbaa !13225 %mul11 = shl nsw i32 %i9, 1226 %i212 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 1227 store i32 %mul11, ptr %i212, align 4, !tbaa !13228 %i313 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 2229 %i10 = load i32, ptr %i313, align 4, !tbaa !14230 %i11 = load i32, ptr %s, align 4, !tbaa !12231 %add15 = add nsw i32 %i10, %i11232 %i316 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 2233 store i32 %add15, ptr %i316, align 4, !tbaa !14234 call void @llvm.lifetime.end.p0(ptr nonnull %s)235 ret void236}237 238declare void @llvm.lifetime.start.p0(ptr nocapture)239 240declare void @llvm.lifetime.end.p0(ptr nocapture)241 242; void local_alloca_simplifiable_2(void) {243; char Bytes[1024];244; for (int i = 0; i < 100; ++i)245; Bytes[i * 10] = 0;246; for (int i = 0; i < 10; ++i)247; ((float *)Bytes)[i * 10 + 1] = 0;248; for (int i = 0; i < 20; ++i)249; ((long long int *)Bytes)[i * 10 + 2] = 0;250; Bytes[1023] = 0;251; write_arg((int *)&Bytes[500], 0);252; struct S R;253; for (int i = 0; i < 1024; ++i)254; globalBytes[i] = Bytes[i];255; }256;257define void @local_alloca_simplifiable_2() {258; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn259; TUNIT-LABEL: define void @local_alloca_simplifiable_2(260; TUNIT-SAME: ) #[[ATTR3:[0-9]+]] {261; TUNIT-NEXT: [[ENTRY:.*]]:262; TUNIT-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16263; TUNIT-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 16 captures(none) dereferenceable(1024) [[BYTES]]) #[[ATTR17]]264; TUNIT-NEXT: br label %[[FOR_COND:.*]]265; TUNIT: [[FOR_COND]]:266; TUNIT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_INC:.*]] ], [ 0, %[[ENTRY]] ]267; TUNIT-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100268; TUNIT-NEXT: br i1 [[EXITCOND]], label %[[FOR_BODY:.*]], label %[[FOR_COND_CLEANUP:.*]]269; TUNIT: [[FOR_COND_CLEANUP]]:270; TUNIT-NEXT: br label %[[FOR_END:.*]]271; TUNIT: [[FOR_BODY]]:272; TUNIT-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10273; TUNIT-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[I15]]274; TUNIT-NEXT: br label %[[FOR_INC]]275; TUNIT: [[FOR_INC]]:276; TUNIT-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1277; TUNIT-NEXT: br label %[[FOR_COND]], !llvm.loop [[LOOP15:![0-9]+]]278; TUNIT: [[FOR_END]]:279; TUNIT-NEXT: br label %[[FOR_COND2:.*]]280; TUNIT: [[FOR_COND2]]:281; TUNIT-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], %[[FOR_INC9:.*]] ], [ 0, %[[FOR_END]] ]282; TUNIT-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10283; TUNIT-NEXT: br i1 [[EXITCOND6]], label %[[FOR_BODY5:.*]], label %[[FOR_COND_CLEANUP4:.*]]284; TUNIT: [[FOR_COND_CLEANUP4]]:285; TUNIT-NEXT: br label %[[FOR_END11:.*]]286; TUNIT: [[FOR_BODY5]]:287; TUNIT-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10288; TUNIT-NEXT: [[I18:%.*]] = or i64 [[I17]], 1289; TUNIT-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[BYTES]], i64 [[I18]]290; TUNIT-NEXT: br label %[[FOR_INC9]]291; TUNIT: [[FOR_INC9]]:292; TUNIT-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1293; TUNIT-NEXT: br label %[[FOR_COND2]], !llvm.loop [[LOOP17:![0-9]+]]294; TUNIT: [[FOR_END11]]:295; TUNIT-NEXT: br label %[[FOR_COND13:.*]]296; TUNIT: [[FOR_COND13]]:297; TUNIT-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], %[[FOR_INC22:.*]] ], [ 0, %[[FOR_END11]] ]298; TUNIT-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20299; TUNIT-NEXT: br i1 [[EXITCOND11]], label %[[FOR_BODY16:.*]], label %[[FOR_COND_CLEANUP15:.*]]300; TUNIT: [[FOR_COND_CLEANUP15]]:301; TUNIT-NEXT: br label %[[FOR_END24:.*]]302; TUNIT: [[FOR_BODY16]]:303; TUNIT-NEXT: [[I20:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10304; TUNIT-NEXT: [[I21:%.*]] = add nuw nsw i64 [[I20]], 2305; TUNIT-NEXT: [[ARRAYIDX21:%.*]] = getelementptr inbounds i64, ptr [[BYTES]], i64 [[I21]]306; TUNIT-NEXT: br label %[[FOR_INC22]]307; TUNIT: [[FOR_INC22]]:308; TUNIT-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1309; TUNIT-NEXT: br label %[[FOR_COND13]], !llvm.loop [[LOOP18:![0-9]+]]310; TUNIT: [[FOR_END24]]:311; TUNIT-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 1023312; TUNIT-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 500313; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(524) [[ARRAYIDX26]], i32 noundef 0) #[[ATTR18]]314; TUNIT-NEXT: br label %[[FOR_COND28:.*]]315; TUNIT: [[FOR_COND28]]:316; TUNIT-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], %[[FOR_INC36:.*]] ], [ 0, %[[FOR_END24]] ]317; TUNIT-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024318; TUNIT-NEXT: br i1 [[EXITCOND14]], label %[[FOR_BODY31:.*]], label %[[FOR_COND_CLEANUP30:.*]]319; TUNIT: [[FOR_COND_CLEANUP30]]:320; TUNIT-NEXT: br label %[[FOR_END38:.*]]321; TUNIT: [[FOR_BODY31]]:322; TUNIT-NEXT: [[ARRAYIDX35:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]323; TUNIT-NEXT: store i8 0, ptr [[ARRAYIDX35]], align 1, !tbaa [[CHAR_TBAA19:![0-9]+]]324; TUNIT-NEXT: br label %[[FOR_INC36]]325; TUNIT: [[FOR_INC36]]:326; TUNIT-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1327; TUNIT-NEXT: br label %[[FOR_COND28]], !llvm.loop [[LOOP20:![0-9]+]]328; TUNIT: [[FOR_END38]]:329; TUNIT-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 16 captures(none) dereferenceable(1024) [[BYTES]]) #[[ATTR17]]330; TUNIT-NEXT: ret void331;332; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn333; CGSCC-LABEL: define void @local_alloca_simplifiable_2(334; CGSCC-SAME: ) #[[ATTR3:[0-9]+]] {335; CGSCC-NEXT: [[ENTRY:.*]]:336; CGSCC-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 16337; CGSCC-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 16 captures(none) dereferenceable(1024) [[BYTES]]) #[[ATTR20]]338; CGSCC-NEXT: br label %[[FOR_COND:.*]]339; CGSCC: [[FOR_COND]]:340; CGSCC-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_INC:.*]] ], [ 0, %[[ENTRY]] ]341; CGSCC-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100342; CGSCC-NEXT: br i1 [[EXITCOND]], label %[[FOR_BODY:.*]], label %[[FOR_COND_CLEANUP:.*]]343; CGSCC: [[FOR_COND_CLEANUP]]:344; CGSCC-NEXT: br label %[[FOR_END:.*]]345; CGSCC: [[FOR_BODY]]:346; CGSCC-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10347; CGSCC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[I15]]348; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX]], align 2, !tbaa [[CHAR_TBAA15:![0-9]+]]349; CGSCC-NEXT: br label %[[FOR_INC]]350; CGSCC: [[FOR_INC]]:351; CGSCC-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1352; CGSCC-NEXT: br label %[[FOR_COND]], !llvm.loop [[LOOP16:![0-9]+]]353; CGSCC: [[FOR_END]]:354; CGSCC-NEXT: br label %[[FOR_COND2:.*]]355; CGSCC: [[FOR_COND2]]:356; CGSCC-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], %[[FOR_INC9:.*]] ], [ 0, %[[FOR_END]] ]357; CGSCC-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10358; CGSCC-NEXT: br i1 [[EXITCOND6]], label %[[FOR_BODY5:.*]], label %[[FOR_COND_CLEANUP4:.*]]359; CGSCC: [[FOR_COND_CLEANUP4]]:360; CGSCC-NEXT: br label %[[FOR_END11:.*]]361; CGSCC: [[FOR_BODY5]]:362; CGSCC-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10363; CGSCC-NEXT: [[I18:%.*]] = or i64 [[I17]], 1364; CGSCC-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[BYTES]], i64 [[I18]]365; CGSCC-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX8]], align 4, !tbaa [[FLOAT_TBAA18:![0-9]+]]366; CGSCC-NEXT: br label %[[FOR_INC9]]367; CGSCC: [[FOR_INC9]]:368; CGSCC-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1369; CGSCC-NEXT: br label %[[FOR_COND2]], !llvm.loop [[LOOP19:![0-9]+]]370; CGSCC: [[FOR_END11]]:371; CGSCC-NEXT: br label %[[FOR_COND13:.*]]372; CGSCC: [[FOR_COND13]]:373; CGSCC-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], %[[FOR_INC22:.*]] ], [ 0, %[[FOR_END11]] ]374; CGSCC-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20375; CGSCC-NEXT: br i1 [[EXITCOND11]], label %[[FOR_BODY16:.*]], label %[[FOR_COND_CLEANUP15:.*]]376; CGSCC: [[FOR_COND_CLEANUP15]]:377; CGSCC-NEXT: br label %[[FOR_END24:.*]]378; CGSCC: [[FOR_BODY16]]:379; CGSCC-NEXT: [[I20:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10380; CGSCC-NEXT: [[I21:%.*]] = add nuw nsw i64 [[I20]], 2381; CGSCC-NEXT: [[ARRAYIDX21:%.*]] = getelementptr inbounds i64, ptr [[BYTES]], i64 [[I21]]382; CGSCC-NEXT: store i64 0, ptr [[ARRAYIDX21]], align 16, !tbaa [[LONG_LONG_TBAA20:![0-9]+]]383; CGSCC-NEXT: br label %[[FOR_INC22]]384; CGSCC: [[FOR_INC22]]:385; CGSCC-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1386; CGSCC-NEXT: br label %[[FOR_COND13]], !llvm.loop [[LOOP22:![0-9]+]]387; CGSCC: [[FOR_END24]]:388; CGSCC-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 1023389; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX25]], align 1, !tbaa [[CHAR_TBAA15]]390; CGSCC-NEXT: [[ARRAYIDX26:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 500391; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(524) [[ARRAYIDX26]], i32 noundef 0) #[[ATTR21]]392; CGSCC-NEXT: br label %[[FOR_COND28:.*]]393; CGSCC: [[FOR_COND28]]:394; CGSCC-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], %[[FOR_INC36:.*]] ], [ 0, %[[FOR_END24]] ]395; CGSCC-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024396; CGSCC-NEXT: br i1 [[EXITCOND14]], label %[[FOR_BODY31:.*]], label %[[FOR_COND_CLEANUP30:.*]]397; CGSCC: [[FOR_COND_CLEANUP30]]:398; CGSCC-NEXT: br label %[[FOR_END38:.*]]399; CGSCC: [[FOR_BODY31]]:400; CGSCC-NEXT: [[ARRAYIDX33:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[INDVARS_IV12]]401; CGSCC-NEXT: [[I23:%.*]] = load i8, ptr [[ARRAYIDX33]], align 1, !tbaa [[CHAR_TBAA15]]402; CGSCC-NEXT: [[ARRAYIDX35:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]403; CGSCC-NEXT: store i8 [[I23]], ptr [[ARRAYIDX35]], align 1, !tbaa [[CHAR_TBAA15]]404; CGSCC-NEXT: br label %[[FOR_INC36]]405; CGSCC: [[FOR_INC36]]:406; CGSCC-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1407; CGSCC-NEXT: br label %[[FOR_COND28]], !llvm.loop [[LOOP23:![0-9]+]]408; CGSCC: [[FOR_END38]]:409; CGSCC-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 16 captures(none) dereferenceable(1024) [[BYTES]]) #[[ATTR20]]410; CGSCC-NEXT: ret void411;412entry:413 %Bytes = alloca [1024 x i8], align 16414 call void @llvm.lifetime.start.p0(ptr nonnull %Bytes)415 br label %for.cond416 417for.cond: ; preds = %for.inc, %entry418 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]419 %exitcond = icmp ne i64 %indvars.iv, 100420 br i1 %exitcond, label %for.body, label %for.cond.cleanup421 422for.cond.cleanup: ; preds = %for.cond423 br label %for.end424 425for.body: ; preds = %for.cond426 %i15 = mul nuw nsw i64 %indvars.iv, 10427 %arrayidx = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %i15428 store i8 0, ptr %arrayidx, align 2, !tbaa !15429 br label %for.inc430 431for.inc: ; preds = %for.body432 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1433 br label %for.cond, !llvm.loop !16434 435for.end: ; preds = %for.cond.cleanup436 br label %for.cond2437 438for.cond2: ; preds = %for.inc9, %for.end439 %indvars.iv2 = phi i64 [ %indvars.iv.next3, %for.inc9 ], [ 0, %for.end ]440 %exitcond6 = icmp ne i64 %indvars.iv2, 10441 br i1 %exitcond6, label %for.body5, label %for.cond.cleanup4442 443for.cond.cleanup4: ; preds = %for.cond2444 br label %for.end11445 446for.body5: ; preds = %for.cond2447 %i17 = mul nuw nsw i64 %indvars.iv2, 10448 %i18 = or i64 %i17, 1449 %arrayidx8 = getelementptr inbounds float, ptr %Bytes, i64 %i18450 store float 0.000000e+00, ptr %arrayidx8, align 4, !tbaa !18451 br label %for.inc9452 453for.inc9: ; preds = %for.body5454 %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 1455 br label %for.cond2, !llvm.loop !19456 457for.end11: ; preds = %for.cond.cleanup4458 br label %for.cond13459 460for.cond13: ; preds = %for.inc22, %for.end11461 %indvars.iv7 = phi i64 [ %indvars.iv.next8, %for.inc22 ], [ 0, %for.end11 ]462 %exitcond11 = icmp ne i64 %indvars.iv7, 20463 br i1 %exitcond11, label %for.body16, label %for.cond.cleanup15464 465for.cond.cleanup15: ; preds = %for.cond13466 br label %for.end24467 468for.body16: ; preds = %for.cond13469 %i20 = mul nuw nsw i64 %indvars.iv7, 10470 %i21 = add nuw nsw i64 %i20, 2471 %arrayidx21 = getelementptr inbounds i64, ptr %Bytes, i64 %i21472 store i64 0, ptr %arrayidx21, align 16, !tbaa !20473 br label %for.inc22474 475for.inc22: ; preds = %for.body16476 %indvars.iv.next8 = add nuw nsw i64 %indvars.iv7, 1477 br label %for.cond13, !llvm.loop !22478 479for.end24: ; preds = %for.cond.cleanup15480 %arrayidx25 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 1023481 store i8 0, ptr %arrayidx25, align 1, !tbaa !15482 %arrayidx26 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 500483 call void @write_arg(ptr nonnull %arrayidx26, i32 0)484 br label %for.cond28485 486for.cond28: ; preds = %for.inc36, %for.end24487 %indvars.iv12 = phi i64 [ %indvars.iv.next13, %for.inc36 ], [ 0, %for.end24 ]488 %exitcond14 = icmp ne i64 %indvars.iv12, 1024489 br i1 %exitcond14, label %for.body31, label %for.cond.cleanup30490 491for.cond.cleanup30: ; preds = %for.cond28492 br label %for.end38493 494for.body31: ; preds = %for.cond28495 %arrayidx33 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %indvars.iv12496 %i23 = load i8, ptr %arrayidx33, align 1, !tbaa !15497 %arrayidx35 = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 %indvars.iv12498 store i8 %i23, ptr %arrayidx35, align 1, !tbaa !15499 br label %for.inc36500 501for.inc36: ; preds = %for.body31502 %indvars.iv.next13 = add nuw nsw i64 %indvars.iv12, 1503 br label %for.cond28, !llvm.loop !23504 505for.end38: ; preds = %for.cond.cleanup30506 call void @llvm.lifetime.end.p0(ptr nonnull %Bytes)507 ret void508}509 510; int local_alloca_simplifiable_3() {511; int A = 1;512; // split513; A = 2;514; return A;515; }516;517define i32 @local_alloca_simplifiable_3() {518; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)519; CHECK-LABEL: define noundef i32 @local_alloca_simplifiable_3(520; CHECK-SAME: ) #[[ATTR4:[0-9]+]] {521; CHECK-NEXT: br label %[[SPLIT:.*]]522; CHECK: [[SPLIT]]:523; CHECK-NEXT: ret i32 2524;525 %A = alloca i32, align 4526 store i32 1, ptr %A527 br label %split528split:529 store i32 2, ptr %A530 %l = load i32, ptr %A, align 4531 ret i32 %l532}533; int local_alloca_simplifiable_4() {534; int A;535; return A;536; }537;538define i32 @local_alloca_simplifiable_4() {539; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)540; CHECK-LABEL: define i32 @local_alloca_simplifiable_4(541; CHECK-SAME: ) #[[ATTR4]] {542; CHECK-NEXT: ret i32 undef543;544 %A = alloca i32, align 4545 %l = load i32, ptr %A, align 4546 ret i32 %l547}548 549; static int GI1 __attribute__((loader_uninitialized));550; int multi_obj_simplifiable_1(int cnd) {551; int L = GI1 = 5;552; int *p = cnd ? &GI1 : &L;553; return *p;554; }555define i32 @multi_obj_simplifiable_1(i32 %cnd) {556; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn557; TUNIT-LABEL: define noundef i32 @multi_obj_simplifiable_1(558; TUNIT-SAME: i32 [[CND:%.*]]) #[[ATTR3]] {559; TUNIT-NEXT: [[ENTRY:.*:]]560; TUNIT-NEXT: [[L:%.*]] = alloca i32, align 4561; TUNIT-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[L]]) #[[ATTR17]]562; TUNIT-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0563; TUNIT-NEXT: br i1 [[TOBOOL_NOT]], label %[[COND_FALSE:.*]], label %[[COND_TRUE:.*]]564; TUNIT: [[COND_TRUE]]:565; TUNIT-NEXT: br label %[[COND_END:.*]]566; TUNIT: [[COND_FALSE]]:567; TUNIT-NEXT: br label %[[COND_END]]568; TUNIT: [[COND_END]]:569; TUNIT-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[L]]) #[[ATTR17]]570; TUNIT-NEXT: ret i32 5571;572; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn573; CGSCC-LABEL: define noundef i32 @multi_obj_simplifiable_1(574; CGSCC-SAME: i32 [[CND:%.*]]) #[[ATTR5:[0-9]+]] {575; CGSCC-NEXT: [[ENTRY:.*:]]576; CGSCC-NEXT: [[L:%.*]] = alloca i32, align 4577; CGSCC-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[L]]) #[[ATTR20]]578; CGSCC-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0579; CGSCC-NEXT: br i1 [[TOBOOL_NOT]], label %[[COND_FALSE:.*]], label %[[COND_TRUE:.*]]580; CGSCC: [[COND_TRUE]]:581; CGSCC-NEXT: br label %[[COND_END:.*]]582; CGSCC: [[COND_FALSE]]:583; CGSCC-NEXT: br label %[[COND_END]]584; CGSCC: [[COND_END]]:585; CGSCC-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[L]]) #[[ATTR20]]586; CGSCC-NEXT: ret i32 5587;588entry:589 %L = alloca i32, align 4590 call void @llvm.lifetime.start.p0(ptr nonnull %L)591 store i32 5, ptr @GI1, align 4, !tbaa !3592 store i32 5, ptr %L, align 4, !tbaa !3593 %tobool.not = icmp eq i32 %cnd, 0594 br i1 %tobool.not, label %cond.false, label %cond.true595 596cond.true: ; preds = %entry597 br label %cond.end598 599cond.false: ; preds = %entry600 br label %cond.end601 602cond.end: ; preds = %cond.false, %cond.true603 %cond = phi ptr [ @GI1, %cond.true ], [ %L, %cond.false ]604 %i1 = load i32, ptr %cond, align 4, !tbaa !3605 call void @llvm.lifetime.end.p0(ptr nonnull %L)606 ret i32 %i1607}608 609; static int GI2 __attribute__((loader_uninitialized));610; int multi_obj_simplifiable_2(int cnd) {611; int L;612; int *p = cnd ? &GI2 : &L;613; *p = 5;614; return *p;615; }616;617define i32 @multi_obj_simplifiable_2(i32 %cnd) {618; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn619; TUNIT-LABEL: define i32 @multi_obj_simplifiable_2(620; TUNIT-SAME: i32 [[CND:%.*]]) #[[ATTR3]] {621; TUNIT-NEXT: [[ENTRY:.*:]]622; TUNIT-NEXT: [[L:%.*]] = alloca i32, align 4623; TUNIT-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[L]]) #[[ATTR17]]624; TUNIT-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0625; TUNIT-NEXT: br i1 [[TOBOOL_NOT]], label %[[COND_FALSE:.*]], label %[[COND_TRUE:.*]]626; TUNIT: [[COND_TRUE]]:627; TUNIT-NEXT: br label %[[COND_END:.*]]628; TUNIT: [[COND_FALSE]]:629; TUNIT-NEXT: br label %[[COND_END]]630; TUNIT: [[COND_END]]:631; TUNIT-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[L]]) #[[ATTR17]]632; TUNIT-NEXT: ret i32 5633;634; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn635; CGSCC-LABEL: define i32 @multi_obj_simplifiable_2(636; CGSCC-SAME: i32 [[CND:%.*]]) #[[ATTR5]] {637; CGSCC-NEXT: [[ENTRY:.*:]]638; CGSCC-NEXT: [[L:%.*]] = alloca i32, align 4639; CGSCC-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[L]]) #[[ATTR20]]640; CGSCC-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 0641; CGSCC-NEXT: br i1 [[TOBOOL_NOT]], label %[[COND_FALSE:.*]], label %[[COND_TRUE:.*]]642; CGSCC: [[COND_TRUE]]:643; CGSCC-NEXT: br label %[[COND_END:.*]]644; CGSCC: [[COND_FALSE]]:645; CGSCC-NEXT: br label %[[COND_END]]646; CGSCC: [[COND_END]]:647; CGSCC-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[L]]) #[[ATTR20]]648; CGSCC-NEXT: ret i32 5649;650entry:651 %L = alloca i32, align 4652 call void @llvm.lifetime.start.p0(ptr nonnull %L)653 %tobool.not = icmp eq i32 %cnd, 0654 br i1 %tobool.not, label %cond.false, label %cond.true655 656cond.true: ; preds = %entry657 br label %cond.end658 659cond.false: ; preds = %entry660 br label %cond.end661 662cond.end: ; preds = %cond.false, %cond.true663 %cond = phi ptr [ @GI2, %cond.true ], [ %L, %cond.false ]664 store i32 5, ptr %cond, align 4, !tbaa !3665 %l = load i32, ptr %cond, align 4, !tbaa !3666 call void @llvm.lifetime.end.p0(ptr nonnull %L)667 ret i32 %l668}669 670; static struct S Gs __attribute__((loader_uninitialized));671; struct S static_global_simplifiable_1(void) {672; Gs.f1 = 1.1;673; Gs.f2 = 2.2;674; Gs.f3 = 3.3;675; write_arg(&Gs.i1, 1);676; write_arg(&Gs.i2, 2);677; write_arg(&Gs.i3, 3);678; struct S r;679; r.f1 = Gs.f1;680; r.f2 = Gs.f2 * 2;681; r.f3 = Gs.f3 + Gs.f1;682; r.i1 = Gs.i1;683; r.i2 = Gs.i2 * 2;684; r.i3 = Gs.i3 + Gs.i1;685; return r;686; }687;688define void @static_global_simplifiable_1(ptr noalias sret(%struct.S) align 4 %agg.result) {689; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)690; TUNIT-LABEL: define void @static_global_simplifiable_1(691; TUNIT-SAME: ptr noalias nofree writeonly sret([[STRUCT_S:%.*]]) align 4 captures(none) dereferenceable_or_null(24) [[AGG_RESULT:%.*]]) #[[ATTR5:[0-9]+]] {692; TUNIT-NEXT: [[ENTRY:.*:]]693; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(24) @Gs1, i32 noundef 1) #[[ATTR18]]694; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(20) getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 1), i32 noundef 2) #[[ATTR18]]695; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(16) getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 2), i32 noundef 3) #[[ATTR18]]696; TUNIT-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3697; TUNIT-NEXT: store float 0x3FF19999A0000000, ptr [[F1]], align 4, !tbaa [[FLOAT_TBAA7]]698; TUNIT-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4699; TUNIT-NEXT: store float 0x40119999A0000000, ptr [[F2]], align 4, !tbaa [[FLOAT_TBAA10]]700; TUNIT-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5701; TUNIT-NEXT: store float 0x40119999A0000000, ptr [[F3]], align 4, !tbaa [[FLOAT_TBAA11]]702; TUNIT-NEXT: store i32 1, ptr [[AGG_RESULT]], align 4, !tbaa [[INT_TBAA12]]703; TUNIT-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1704; TUNIT-NEXT: store i32 4, ptr [[I2]], align 4, !tbaa [[INT_TBAA13]]705; TUNIT-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2706; TUNIT-NEXT: store i32 4, ptr [[I3]], align 4, !tbaa [[INT_TBAA14]]707; TUNIT-NEXT: ret void708;709; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn710; CGSCC-LABEL: define void @static_global_simplifiable_1(711; CGSCC-SAME: ptr noalias nofree noundef nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 captures(none) dereferenceable(24) [[AGG_RESULT:%.*]]) #[[ATTR3]] {712; CGSCC-NEXT: [[ENTRY:.*:]]713; CGSCC-NEXT: store float 0x3FF19999A0000000, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 3), align 4, !tbaa [[FLOAT_TBAA7]]714; CGSCC-NEXT: store float 0x40019999A0000000, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 4), align 4, !tbaa [[FLOAT_TBAA10]]715; CGSCC-NEXT: store float 0x400A666660000000, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 5), align 4, !tbaa [[FLOAT_TBAA11]]716; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(24) @Gs1, i32 noundef 1) #[[ATTR21]]717; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(20) getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 1), i32 noundef 2) #[[ATTR21]]718; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(16) getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 2), i32 noundef 3) #[[ATTR21]]719; CGSCC-NEXT: [[I:%.*]] = load float, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 3), align 4, !tbaa [[FLOAT_TBAA7]]720; CGSCC-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 3721; CGSCC-NEXT: store float [[I]], ptr [[F1]], align 4, !tbaa [[FLOAT_TBAA7]]722; CGSCC-NEXT: [[I4:%.*]] = load float, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 4), align 4, !tbaa [[FLOAT_TBAA10]]723; CGSCC-NEXT: [[MUL:%.*]] = fmul float [[I4]], 2.000000e+00724; CGSCC-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 4725; CGSCC-NEXT: store float [[MUL]], ptr [[F2]], align 4, !tbaa [[FLOAT_TBAA10]]726; CGSCC-NEXT: [[I5:%.*]] = load float, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 5), align 4, !tbaa [[FLOAT_TBAA11]]727; CGSCC-NEXT: [[I6:%.*]] = load float, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 3), align 4, !tbaa [[FLOAT_TBAA7]]728; CGSCC-NEXT: [[ADD:%.*]] = fadd float [[I5]], [[I6]]729; CGSCC-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 5730; CGSCC-NEXT: store float [[ADD]], ptr [[F3]], align 4, !tbaa [[FLOAT_TBAA11]]731; CGSCC-NEXT: [[I7:%.*]] = load i32, ptr @Gs1, align 4, !tbaa [[INT_TBAA12]]732; CGSCC-NEXT: store i32 [[I7]], ptr [[AGG_RESULT]], align 4, !tbaa [[INT_TBAA12]]733; CGSCC-NEXT: [[I8:%.*]] = load i32, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 1), align 4, !tbaa [[INT_TBAA13]]734; CGSCC-NEXT: [[MUL1:%.*]] = shl nsw i32 [[I8]], 1735; CGSCC-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 1736; CGSCC-NEXT: store i32 [[MUL1]], ptr [[I2]], align 4, !tbaa [[INT_TBAA13]]737; CGSCC-NEXT: [[I9:%.*]] = load i32, ptr getelementptr inbounds ([[STRUCT_S]], ptr @Gs1, i64 0, i32 2), align 4, !tbaa [[INT_TBAA14]]738; CGSCC-NEXT: [[I10:%.*]] = load i32, ptr @Gs1, align 4, !tbaa [[INT_TBAA12]]739; CGSCC-NEXT: [[ADD2:%.*]] = add nsw i32 [[I9]], [[I10]]740; CGSCC-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 2741; CGSCC-NEXT: store i32 [[ADD2]], ptr [[I3]], align 4, !tbaa [[INT_TBAA14]]742; CGSCC-NEXT: ret void743;744entry:745 store float 0x3FF19999A0000000, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 3), align 4, !tbaa !7746 store float 0x40019999A0000000, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 4), align 4, !tbaa !10747 store float 0x400A666660000000, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 5), align 4, !tbaa !11748 call void @write_arg(ptr @Gs1, i32 1)749 call void @write_arg(ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 1), i32 2)750 call void @write_arg(ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 2), i32 3)751 %i = load float, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 3), align 4, !tbaa !7752 %f1 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 3753 store float %i, ptr %f1, align 4, !tbaa !7754 %i4 = load float, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 4), align 4, !tbaa !10755 %mul = fmul float %i4, 2.000000e+00756 %f2 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 4757 store float %mul, ptr %f2, align 4, !tbaa !10758 %i5 = load float, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 5), align 4, !tbaa !11759 %i6 = load float, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 3), align 4, !tbaa !7760 %add = fadd float %i5, %i6761 %f3 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 5762 store float %add, ptr %f3, align 4, !tbaa !11763 %i7 = load i32, ptr @Gs1, align 4, !tbaa !12764 store i32 %i7, ptr %agg.result, align 4, !tbaa !12765 %i8 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 1), align 4, !tbaa !13766 %mul1 = shl nsw i32 %i8, 1767 %i2 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 1768 store i32 %mul1, ptr %i2, align 4, !tbaa !13769 %i9 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Gs1, i64 0, i32 2), align 4, !tbaa !14770 %i10 = load i32, ptr @Gs1, align 4, !tbaa !12771 %add2 = add nsw i32 %i9, %i10772 %i3 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 2773 store i32 %add2, ptr %i3, align 4, !tbaa !14774 ret void775}776 777define i32 @test_range_merge1() {778; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)779; TUNIT-LABEL: define noundef i32 @test_range_merge1(780; TUNIT-SAME: ) #[[ATTR5]] {781; TUNIT-NEXT: ret i32 2782;783; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)784; CGSCC-LABEL: define noundef i32 @test_range_merge1(785; CGSCC-SAME: ) #[[ATTR6:[0-9]+]] {786; CGSCC-NEXT: ret i32 2787;788 store <2 x i32> <i32 1, i32 1>, ptr @Vs1789 store float 2.000000e+00, ptr getelementptr inbounds (%struct.S, ptr @Vs1, i64 0, i32 4)790 %l0 = load i32, ptr @Vs1791 %l1 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Vs1, i64 0, i32 1)792 %add = add i32 %l0, %l1793 ret i32 %add794}795 796define i32 @test_range_merge2() {797; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn798; TUNIT-LABEL: define i32 @test_range_merge2(799; TUNIT-SAME: ) #[[ATTR3]] {800; TUNIT-NEXT: store <2 x i32> <i32 3, i32 4>, ptr @Vs2, align 8801; TUNIT-NEXT: [[L0:%.*]] = load i32, ptr @Vs2, align 4802; TUNIT-NEXT: [[L1:%.*]] = load i32, ptr getelementptr inbounds ([[STRUCT_S:%.*]], ptr @Vs2, i64 0, i32 1), align 4803; TUNIT-NEXT: [[ADD:%.*]] = add i32 [[L0]], [[L1]]804; TUNIT-NEXT: ret i32 [[ADD]]805;806; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn807; CGSCC-LABEL: define i32 @test_range_merge2(808; CGSCC-SAME: ) #[[ATTR5]] {809; CGSCC-NEXT: store <2 x i32> <i32 3, i32 4>, ptr @Vs2, align 8810; CGSCC-NEXT: [[L0:%.*]] = load i32, ptr @Vs2, align 4811; CGSCC-NEXT: [[L1:%.*]] = load i32, ptr getelementptr inbounds ([[STRUCT_S:%.*]], ptr @Vs2, i64 0, i32 1), align 4812; CGSCC-NEXT: [[ADD:%.*]] = add i32 [[L0]], [[L1]]813; CGSCC-NEXT: ret i32 [[ADD]]814;815 store <2 x i32> <i32 3, i32 4>, ptr @Vs2816 store float 2.000000e+00, ptr getelementptr inbounds (%struct.S, ptr @Vs2, i64 0, i32 4)817 %l0 = load i32, ptr @Vs2818 %l1 = load i32, ptr getelementptr inbounds (%struct.S, ptr @Vs2, i64 0, i32 1)819 %add = add i32 %l0, %l1820 ret i32 %add821}822 823; static char GBytes[1024];824; void static_global_simplifiable_2(void) {825; for (int i = 0; i < 100; ++i)826; GBytes[i * 10] = 0;827; for (int i = 0; i < 10; ++i)828; ((float *)GBytes)[i * 10 + 1] = 0;829; for (int i = 0; i < 20; ++i)830; ((long long int *)GBytes)[i * 10 + 2] = 0;831; GBytes[1023] = 0;832; write_arg((int *)&GBytes[500], 0);833; struct S R;834; for (int i = 0; i < 1024; ++i)835; globalBytes[i] = GBytes[i];836; }837;838define void @static_global_simplifiable_2() {839; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)840; TUNIT-LABEL: define void @static_global_simplifiable_2(841; TUNIT-SAME: ) #[[ATTR5]] {842; TUNIT-NEXT: [[ENTRY:.*]]:843; TUNIT-NEXT: br label %[[FOR_COND:.*]]844; TUNIT: [[FOR_COND]]:845; TUNIT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_INC:.*]] ], [ 0, %[[ENTRY]] ]846; TUNIT-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100847; TUNIT-NEXT: br i1 [[EXITCOND]], label %[[FOR_BODY:.*]], label %[[FOR_COND_CLEANUP:.*]]848; TUNIT: [[FOR_COND_CLEANUP]]:849; TUNIT-NEXT: br label %[[FOR_END:.*]]850; TUNIT: [[FOR_BODY]]:851; TUNIT-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10852; TUNIT-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 [[I]]853; TUNIT-NEXT: br label %[[FOR_INC]]854; TUNIT: [[FOR_INC]]:855; TUNIT-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1856; TUNIT-NEXT: br label %[[FOR_COND]], !llvm.loop [[LOOP21:![0-9]+]]857; TUNIT: [[FOR_END]]:858; TUNIT-NEXT: br label %[[FOR_COND2:.*]]859; TUNIT: [[FOR_COND2]]:860; TUNIT-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], %[[FOR_INC9:.*]] ], [ 0, %[[FOR_END]] ]861; TUNIT-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10862; TUNIT-NEXT: br i1 [[EXITCOND6]], label %[[FOR_BODY5:.*]], label %[[FOR_COND_CLEANUP4:.*]]863; TUNIT: [[FOR_COND_CLEANUP4]]:864; TUNIT-NEXT: br label %[[FOR_END11:.*]]865; TUNIT: [[FOR_BODY5]]:866; TUNIT-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10867; TUNIT-NEXT: [[I16:%.*]] = or i64 [[I15]], 1868; TUNIT-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr @GBytes, i64 [[I16]]869; TUNIT-NEXT: br label %[[FOR_INC9]]870; TUNIT: [[FOR_INC9]]:871; TUNIT-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1872; TUNIT-NEXT: br label %[[FOR_COND2]], !llvm.loop [[LOOP22:![0-9]+]]873; TUNIT: [[FOR_END11]]:874; TUNIT-NEXT: br label %[[FOR_COND13:.*]]875; TUNIT: [[FOR_COND13]]:876; TUNIT-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], %[[FOR_INC21:.*]] ], [ 0, %[[FOR_END11]] ]877; TUNIT-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20878; TUNIT-NEXT: br i1 [[EXITCOND11]], label %[[FOR_BODY16:.*]], label %[[FOR_COND_CLEANUP15:.*]]879; TUNIT: [[FOR_COND_CLEANUP15]]:880; TUNIT-NEXT: br label %[[FOR_END23:.*]]881; TUNIT: [[FOR_BODY16]]:882; TUNIT-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10883; TUNIT-NEXT: [[I18:%.*]] = add nuw nsw i64 [[I17]], 2884; TUNIT-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, ptr @GBytes, i64 [[I18]]885; TUNIT-NEXT: br label %[[FOR_INC21]]886; TUNIT: [[FOR_INC21]]:887; TUNIT-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1888; TUNIT-NEXT: br label %[[FOR_COND13]], !llvm.loop [[LOOP23:![0-9]+]]889; TUNIT: [[FOR_END23]]:890; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(524) getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 500), i32 noundef 0) #[[ATTR18]]891; TUNIT-NEXT: br label %[[FOR_COND25:.*]]892; TUNIT: [[FOR_COND25]]:893; TUNIT-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], %[[FOR_INC33:.*]] ], [ 0, %[[FOR_END23]] ]894; TUNIT-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024895; TUNIT-NEXT: br i1 [[EXITCOND14]], label %[[FOR_BODY28:.*]], label %[[FOR_COND_CLEANUP27:.*]]896; TUNIT: [[FOR_COND_CLEANUP27]]:897; TUNIT-NEXT: br label %[[FOR_END35:.*]]898; TUNIT: [[FOR_BODY28]]:899; TUNIT-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]900; TUNIT-NEXT: store i8 0, ptr [[ARRAYIDX32]], align 1, !tbaa [[CHAR_TBAA19]]901; TUNIT-NEXT: br label %[[FOR_INC33]]902; TUNIT: [[FOR_INC33]]:903; TUNIT-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1904; TUNIT-NEXT: br label %[[FOR_COND25]], !llvm.loop [[LOOP24:![0-9]+]]905; TUNIT: [[FOR_END35]]:906; TUNIT-NEXT: ret void907;908; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn909; CGSCC-LABEL: define void @static_global_simplifiable_2(910; CGSCC-SAME: ) #[[ATTR3]] {911; CGSCC-NEXT: [[ENTRY:.*]]:912; CGSCC-NEXT: br label %[[FOR_COND:.*]]913; CGSCC: [[FOR_COND]]:914; CGSCC-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_INC:.*]] ], [ 0, %[[ENTRY]] ]915; CGSCC-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 100916; CGSCC-NEXT: br i1 [[EXITCOND]], label %[[FOR_BODY:.*]], label %[[FOR_COND_CLEANUP:.*]]917; CGSCC: [[FOR_COND_CLEANUP]]:918; CGSCC-NEXT: br label %[[FOR_END:.*]]919; CGSCC: [[FOR_BODY]]:920; CGSCC-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 10921; CGSCC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 [[I]]922; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX]], align 2, !tbaa [[CHAR_TBAA15]]923; CGSCC-NEXT: br label %[[FOR_INC]]924; CGSCC: [[FOR_INC]]:925; CGSCC-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1926; CGSCC-NEXT: br label %[[FOR_COND]], !llvm.loop [[LOOP24:![0-9]+]]927; CGSCC: [[FOR_END]]:928; CGSCC-NEXT: br label %[[FOR_COND2:.*]]929; CGSCC: [[FOR_COND2]]:930; CGSCC-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], %[[FOR_INC9:.*]] ], [ 0, %[[FOR_END]] ]931; CGSCC-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 10932; CGSCC-NEXT: br i1 [[EXITCOND6]], label %[[FOR_BODY5:.*]], label %[[FOR_COND_CLEANUP4:.*]]933; CGSCC: [[FOR_COND_CLEANUP4]]:934; CGSCC-NEXT: br label %[[FOR_END11:.*]]935; CGSCC: [[FOR_BODY5]]:936; CGSCC-NEXT: [[I15:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 10937; CGSCC-NEXT: [[I16:%.*]] = or i64 [[I15]], 1938; CGSCC-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr @GBytes, i64 [[I16]]939; CGSCC-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX8]], align 4, !tbaa [[FLOAT_TBAA18]]940; CGSCC-NEXT: br label %[[FOR_INC9]]941; CGSCC: [[FOR_INC9]]:942; CGSCC-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 1943; CGSCC-NEXT: br label %[[FOR_COND2]], !llvm.loop [[LOOP25:![0-9]+]]944; CGSCC: [[FOR_END11]]:945; CGSCC-NEXT: br label %[[FOR_COND13:.*]]946; CGSCC: [[FOR_COND13]]:947; CGSCC-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], %[[FOR_INC21:.*]] ], [ 0, %[[FOR_END11]] ]948; CGSCC-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 20949; CGSCC-NEXT: br i1 [[EXITCOND11]], label %[[FOR_BODY16:.*]], label %[[FOR_COND_CLEANUP15:.*]]950; CGSCC: [[FOR_COND_CLEANUP15]]:951; CGSCC-NEXT: br label %[[FOR_END23:.*]]952; CGSCC: [[FOR_BODY16]]:953; CGSCC-NEXT: [[I17:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 10954; CGSCC-NEXT: [[I18:%.*]] = add nuw nsw i64 [[I17]], 2955; CGSCC-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, ptr @GBytes, i64 [[I18]]956; CGSCC-NEXT: store i64 0, ptr [[ARRAYIDX20]], align 16, !tbaa [[LONG_LONG_TBAA20]]957; CGSCC-NEXT: br label %[[FOR_INC21]]958; CGSCC: [[FOR_INC21]]:959; CGSCC-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 1960; CGSCC-NEXT: br label %[[FOR_COND13]], !llvm.loop [[LOOP26:![0-9]+]]961; CGSCC: [[FOR_END23]]:962; CGSCC-NEXT: store i8 0, ptr getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 1023), align 1, !tbaa [[CHAR_TBAA15]]963; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(524) getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 500), i32 noundef 0) #[[ATTR21]]964; CGSCC-NEXT: br label %[[FOR_COND25:.*]]965; CGSCC: [[FOR_COND25]]:966; CGSCC-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], %[[FOR_INC33:.*]] ], [ 0, %[[FOR_END23]] ]967; CGSCC-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 1024968; CGSCC-NEXT: br i1 [[EXITCOND14]], label %[[FOR_BODY28:.*]], label %[[FOR_COND_CLEANUP27:.*]]969; CGSCC: [[FOR_COND_CLEANUP27]]:970; CGSCC-NEXT: br label %[[FOR_END35:.*]]971; CGSCC: [[FOR_BODY28]]:972; CGSCC-NEXT: [[ARRAYIDX30:%.*]] = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 [[INDVARS_IV12]]973; CGSCC-NEXT: [[I19:%.*]] = load i8, ptr [[ARRAYIDX30]], align 1, !tbaa [[CHAR_TBAA15]]974; CGSCC-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]975; CGSCC-NEXT: store i8 [[I19]], ptr [[ARRAYIDX32]], align 1, !tbaa [[CHAR_TBAA15]]976; CGSCC-NEXT: br label %[[FOR_INC33]]977; CGSCC: [[FOR_INC33]]:978; CGSCC-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 1979; CGSCC-NEXT: br label %[[FOR_COND25]], !llvm.loop [[LOOP27:![0-9]+]]980; CGSCC: [[FOR_END35]]:981; CGSCC-NEXT: ret void982;983entry:984 br label %for.cond985 986for.cond: ; preds = %for.inc, %entry987 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]988 %exitcond = icmp ne i64 %indvars.iv, 100989 br i1 %exitcond, label %for.body, label %for.cond.cleanup990 991for.cond.cleanup: ; preds = %for.cond992 br label %for.end993 994for.body: ; preds = %for.cond995 %i = mul nuw nsw i64 %indvars.iv, 10996 %arrayidx = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 %i997 store i8 0, ptr %arrayidx, align 2, !tbaa !15998 br label %for.inc999 1000for.inc: ; preds = %for.body1001 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 11002 br label %for.cond, !llvm.loop !241003 1004for.end: ; preds = %for.cond.cleanup1005 br label %for.cond21006 1007for.cond2: ; preds = %for.inc9, %for.end1008 %indvars.iv2 = phi i64 [ %indvars.iv.next3, %for.inc9 ], [ 0, %for.end ]1009 %exitcond6 = icmp ne i64 %indvars.iv2, 101010 br i1 %exitcond6, label %for.body5, label %for.cond.cleanup41011 1012for.cond.cleanup4: ; preds = %for.cond21013 br label %for.end111014 1015for.body5: ; preds = %for.cond21016 %i15 = mul nuw nsw i64 %indvars.iv2, 101017 %i16 = or i64 %i15, 11018 %arrayidx8 = getelementptr inbounds float, ptr @GBytes, i64 %i161019 store float 0.000000e+00, ptr %arrayidx8, align 4, !tbaa !181020 br label %for.inc91021 1022for.inc9: ; preds = %for.body51023 %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 11024 br label %for.cond2, !llvm.loop !251025 1026for.end11: ; preds = %for.cond.cleanup41027 br label %for.cond131028 1029for.cond13: ; preds = %for.inc21, %for.end111030 %indvars.iv7 = phi i64 [ %indvars.iv.next8, %for.inc21 ], [ 0, %for.end11 ]1031 %exitcond11 = icmp ne i64 %indvars.iv7, 201032 br i1 %exitcond11, label %for.body16, label %for.cond.cleanup151033 1034for.cond.cleanup15: ; preds = %for.cond131035 br label %for.end231036 1037for.body16: ; preds = %for.cond131038 %i17 = mul nuw nsw i64 %indvars.iv7, 101039 %i18 = add nuw nsw i64 %i17, 21040 %arrayidx20 = getelementptr inbounds i64, ptr @GBytes, i64 %i181041 store i64 0, ptr %arrayidx20, align 16, !tbaa !201042 br label %for.inc211043 1044for.inc21: ; preds = %for.body161045 %indvars.iv.next8 = add nuw nsw i64 %indvars.iv7, 11046 br label %for.cond13, !llvm.loop !261047 1048for.end23: ; preds = %for.cond.cleanup151049 store i8 0, ptr getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 1023), align 1, !tbaa !151050 call void @write_arg(ptr getelementptr inbounds ([1024 x i8], ptr @GBytes, i64 0, i64 500), i32 0)1051 br label %for.cond251052 1053for.cond25: ; preds = %for.inc33, %for.end231054 %indvars.iv12 = phi i64 [ %indvars.iv.next13, %for.inc33 ], [ 0, %for.end23 ]1055 %exitcond14 = icmp ne i64 %indvars.iv12, 10241056 br i1 %exitcond14, label %for.body28, label %for.cond.cleanup271057 1058for.cond.cleanup27: ; preds = %for.cond251059 br label %for.end351060 1061for.body28: ; preds = %for.cond251062 %arrayidx30 = getelementptr inbounds [1024 x i8], ptr @GBytes, i64 0, i64 %indvars.iv121063 %i19 = load i8, ptr %arrayidx30, align 1, !tbaa !151064 %arrayidx32 = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 %indvars.iv121065 store i8 %i19, ptr %arrayidx32, align 1, !tbaa !151066 br label %for.inc331067 1068for.inc33: ; preds = %for.body281069 %indvars.iv.next13 = add nuw nsw i64 %indvars.iv12, 11070 br label %for.cond25, !llvm.loop !271071 1072for.end35: ; preds = %for.cond.cleanup271073 ret void1074}1075 1076; static int Flag3;1077; int static_global_simplifiable_3() {1078; Flag3 = 1;1079; return Flag3;1080; }1081define i32 @static_global_simplifiable_3() {1082; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1083; TUNIT-LABEL: define noundef i32 @static_global_simplifiable_3(1084; TUNIT-SAME: ) #[[ATTR5]] {1085; TUNIT-NEXT: store i32 1, ptr @Flag3, align 4, !tbaa [[INT_TBAA3]]1086; TUNIT-NEXT: ret i32 11087;1088; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1089; CGSCC-LABEL: define noundef i32 @static_global_simplifiable_3(1090; CGSCC-SAME: ) #[[ATTR6]] {1091; CGSCC-NEXT: store i32 1, ptr @Flag3, align 4, !tbaa [[INT_TBAA3]]1092; CGSCC-NEXT: ret i32 11093;1094 store i32 1, ptr @Flag3, align 4, !tbaa !31095 %i = load i32, ptr @Flag3, align 4, !tbaa !31096 ret i32 %i1097}1098 1099; struct S noalias_arg_simplifiable_1(struct S s) {1100; s.f1 = 1.1;1101; s.f2 = 2.2;1102; s.f3 = 3.3;1103; write_arg(&s.i1, 1);1104; write_arg(&s.i2, 2);1105; write_arg(&s.i3, 3);1106; struct S r;1107; r.f1 = s.f1;1108; r.f2 = s.f2 * 2;1109; r.f3 = s.f3 + s.f1;1110; r.i1 = s.i1;1111; r.i2 = s.i2 * 2;1112; r.i3 = s.i3 + s.i1;1113; return r;1114; }1115;1116define void @noalias_arg_simplifiable_1(ptr noalias sret(%struct.S) align 4 %agg.result, ptr byval(%struct.S) align 8 %s) {1117; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)1118; TUNIT-LABEL: define void @noalias_arg_simplifiable_1(1119; TUNIT-SAME: ptr noalias nofree writeonly sret([[STRUCT_S:%.*]]) align 4 captures(none) dereferenceable_or_null(24) [[AGG_RESULT:%.*]], ptr noalias nofree nonnull byval([[STRUCT_S]]) align 8 captures(none) dereferenceable(24) [[S:%.*]]) #[[ATTR1]] {1120; TUNIT-NEXT: [[ENTRY:.*:]]1121; TUNIT-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 31122; TUNIT-NEXT: store float 0x3FF19999A0000000, ptr [[F1]], align 4, !tbaa [[FLOAT_TBAA7]]1123; TUNIT-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 41124; TUNIT-NEXT: store float 0x40019999A0000000, ptr [[F2]], align 8, !tbaa [[FLOAT_TBAA10]]1125; TUNIT-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 51126; TUNIT-NEXT: store float 0x400A666660000000, ptr [[F3]], align 4, !tbaa [[FLOAT_TBAA11]]1127; TUNIT-NEXT: call void @write_arg(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(24) [[S]], i32 noundef 1) #[[ATTR18]]1128; TUNIT-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 11129; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(20) [[I2]], i32 noundef 2) #[[ATTR18]]1130; TUNIT-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 21131; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(16) [[I3]], i32 noundef 3) #[[ATTR18]]1132; TUNIT-NEXT: [[F11:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 31133; TUNIT-NEXT: [[I:%.*]] = load float, ptr [[F11]], align 4, !tbaa [[FLOAT_TBAA7]]1134; TUNIT-NEXT: [[F12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 31135; TUNIT-NEXT: store float [[I]], ptr [[F12]], align 4, !tbaa [[FLOAT_TBAA7]]1136; TUNIT-NEXT: [[F23:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 41137; TUNIT-NEXT: [[I4:%.*]] = load float, ptr [[F23]], align 8, !tbaa [[FLOAT_TBAA10]]1138; TUNIT-NEXT: [[MUL:%.*]] = fmul float [[I4]], 2.000000e+001139; TUNIT-NEXT: [[F24:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 41140; TUNIT-NEXT: store float [[MUL]], ptr [[F24]], align 4, !tbaa [[FLOAT_TBAA10]]1141; TUNIT-NEXT: [[F35:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 51142; TUNIT-NEXT: [[I5:%.*]] = load float, ptr [[F35]], align 4, !tbaa [[FLOAT_TBAA11]]1143; TUNIT-NEXT: [[F16:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 31144; TUNIT-NEXT: [[I6:%.*]] = load float, ptr [[F16]], align 4, !tbaa [[FLOAT_TBAA7]]1145; TUNIT-NEXT: [[ADD:%.*]] = fadd float [[I5]], [[I6]]1146; TUNIT-NEXT: [[F37:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 51147; TUNIT-NEXT: store float [[ADD]], ptr [[F37]], align 4, !tbaa [[FLOAT_TBAA11]]1148; TUNIT-NEXT: [[I7:%.*]] = load i32, ptr [[S]], align 8, !tbaa [[INT_TBAA12]]1149; TUNIT-NEXT: store i32 [[I7]], ptr [[AGG_RESULT]], align 4, !tbaa [[INT_TBAA12]]1150; TUNIT-NEXT: [[I210:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 11151; TUNIT-NEXT: [[I8:%.*]] = load i32, ptr [[I210]], align 4, !tbaa [[INT_TBAA13]]1152; TUNIT-NEXT: [[MUL11:%.*]] = shl nsw i32 [[I8]], 11153; TUNIT-NEXT: [[I212:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 11154; TUNIT-NEXT: store i32 [[MUL11]], ptr [[I212]], align 4, !tbaa [[INT_TBAA13]]1155; TUNIT-NEXT: [[I313:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 21156; TUNIT-NEXT: [[I9:%.*]] = load i32, ptr [[I313]], align 8, !tbaa [[INT_TBAA14]]1157; TUNIT-NEXT: [[I10:%.*]] = load i32, ptr [[S]], align 8, !tbaa [[INT_TBAA12]]1158; TUNIT-NEXT: [[ADD15:%.*]] = add nsw i32 [[I9]], [[I10]]1159; TUNIT-NEXT: [[I316:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 21160; TUNIT-NEXT: store i32 [[ADD15]], ptr [[I316]], align 4, !tbaa [[INT_TBAA14]]1161; TUNIT-NEXT: ret void1162;1163; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite)1164; CGSCC-LABEL: define void @noalias_arg_simplifiable_1(1165; CGSCC-SAME: ptr noalias nofree noundef nonnull writeonly sret([[STRUCT_S:%.*]]) align 4 captures(none) dereferenceable(24) [[AGG_RESULT:%.*]], ptr noalias nofree noundef nonnull byval([[STRUCT_S]]) align 8 captures(none) dereferenceable(24) [[S:%.*]]) #[[ATTR1]] {1166; CGSCC-NEXT: [[ENTRY:.*:]]1167; CGSCC-NEXT: [[F1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 31168; CGSCC-NEXT: store float 0x3FF19999A0000000, ptr [[F1]], align 4, !tbaa [[FLOAT_TBAA7]]1169; CGSCC-NEXT: [[F2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 41170; CGSCC-NEXT: store float 0x40019999A0000000, ptr [[F2]], align 8, !tbaa [[FLOAT_TBAA10]]1171; CGSCC-NEXT: [[F3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 51172; CGSCC-NEXT: store float 0x400A666660000000, ptr [[F3]], align 4, !tbaa [[FLOAT_TBAA11]]1173; CGSCC-NEXT: call void @write_arg(ptr noalias nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(24) [[S]], i32 noundef 1) #[[ATTR21]]1174; CGSCC-NEXT: [[I2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 11175; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(20) [[I2]], i32 noundef 2) #[[ATTR21]]1176; CGSCC-NEXT: [[I3:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 21177; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(16) [[I3]], i32 noundef 3) #[[ATTR21]]1178; CGSCC-NEXT: [[F11:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 31179; CGSCC-NEXT: [[I:%.*]] = load float, ptr [[F11]], align 4, !tbaa [[FLOAT_TBAA7]]1180; CGSCC-NEXT: [[F12:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 31181; CGSCC-NEXT: store float [[I]], ptr [[F12]], align 4, !tbaa [[FLOAT_TBAA7]]1182; CGSCC-NEXT: [[F23:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 41183; CGSCC-NEXT: [[I4:%.*]] = load float, ptr [[F23]], align 8, !tbaa [[FLOAT_TBAA10]]1184; CGSCC-NEXT: [[MUL:%.*]] = fmul float [[I4]], 2.000000e+001185; CGSCC-NEXT: [[F24:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 41186; CGSCC-NEXT: store float [[MUL]], ptr [[F24]], align 4, !tbaa [[FLOAT_TBAA10]]1187; CGSCC-NEXT: [[F35:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 51188; CGSCC-NEXT: [[I5:%.*]] = load float, ptr [[F35]], align 4, !tbaa [[FLOAT_TBAA11]]1189; CGSCC-NEXT: [[F16:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 31190; CGSCC-NEXT: [[I6:%.*]] = load float, ptr [[F16]], align 4, !tbaa [[FLOAT_TBAA7]]1191; CGSCC-NEXT: [[ADD:%.*]] = fadd float [[I5]], [[I6]]1192; CGSCC-NEXT: [[F37:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 51193; CGSCC-NEXT: store float [[ADD]], ptr [[F37]], align 4, !tbaa [[FLOAT_TBAA11]]1194; CGSCC-NEXT: [[I7:%.*]] = load i32, ptr [[S]], align 8, !tbaa [[INT_TBAA12]]1195; CGSCC-NEXT: store i32 [[I7]], ptr [[AGG_RESULT]], align 4, !tbaa [[INT_TBAA12]]1196; CGSCC-NEXT: [[I210:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 11197; CGSCC-NEXT: [[I8:%.*]] = load i32, ptr [[I210]], align 4, !tbaa [[INT_TBAA13]]1198; CGSCC-NEXT: [[MUL11:%.*]] = shl nsw i32 [[I8]], 11199; CGSCC-NEXT: [[I212:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 11200; CGSCC-NEXT: store i32 [[MUL11]], ptr [[I212]], align 4, !tbaa [[INT_TBAA13]]1201; CGSCC-NEXT: [[I313:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 21202; CGSCC-NEXT: [[I9:%.*]] = load i32, ptr [[I313]], align 8, !tbaa [[INT_TBAA14]]1203; CGSCC-NEXT: [[I10:%.*]] = load i32, ptr [[S]], align 8, !tbaa [[INT_TBAA12]]1204; CGSCC-NEXT: [[ADD15:%.*]] = add nsw i32 [[I9]], [[I10]]1205; CGSCC-NEXT: [[I316:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[AGG_RESULT]], i64 0, i32 21206; CGSCC-NEXT: store i32 [[ADD15]], ptr [[I316]], align 4, !tbaa [[INT_TBAA14]]1207; CGSCC-NEXT: ret void1208;1209entry:1210 %f1 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 31211 store float 0x3FF19999A0000000, ptr %f1, align 4, !tbaa !71212 %f2 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 41213 store float 0x40019999A0000000, ptr %f2, align 8, !tbaa !101214 %f3 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 51215 store float 0x400A666660000000, ptr %f3, align 4, !tbaa !111216 call void @write_arg(ptr nonnull %s, i32 1)1217 %i2 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 11218 call void @write_arg(ptr nonnull %i2, i32 2)1219 %i3 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 21220 call void @write_arg(ptr nonnull %i3, i32 3)1221 %f11 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 31222 %i = load float, ptr %f11, align 4, !tbaa !71223 %f12 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 31224 store float %i, ptr %f12, align 4, !tbaa !71225 %f23 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 41226 %i4 = load float, ptr %f23, align 8, !tbaa !101227 %mul = fmul float %i4, 2.000000e+001228 %f24 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 41229 store float %mul, ptr %f24, align 4, !tbaa !101230 %f35 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 51231 %i5 = load float, ptr %f35, align 4, !tbaa !111232 %f16 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 31233 %i6 = load float, ptr %f16, align 4, !tbaa !71234 %add = fadd float %i5, %i61235 %f37 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 51236 store float %add, ptr %f37, align 4, !tbaa !111237 %i7 = load i32, ptr %s, align 8, !tbaa !121238 store i32 %i7, ptr %agg.result, align 4, !tbaa !121239 %i210 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 11240 %i8 = load i32, ptr %i210, align 4, !tbaa !131241 %mul11 = shl nsw i32 %i8, 11242 %i212 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 11243 store i32 %mul11, ptr %i212, align 4, !tbaa !131244 %i313 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 21245 %i9 = load i32, ptr %i313, align 8, !tbaa !141246 %i10 = load i32, ptr %s, align 8, !tbaa !121247 %add15 = add nsw i32 %i9, %i101248 %i316 = getelementptr inbounds %struct.S, ptr %agg.result, i64 0, i32 21249 store i32 %add15, ptr %i316, align 4, !tbaa !141250 ret void1251}1252 1253; void noalias_arg_simplifiable_2(char Bytes[1024]) {1254; for (int i = 0; i < 100; ++i)1255; Bytes[i * 10] = 0;1256; for (int i = 0; i < 10; ++i)1257; ((float *)Bytes)[i * 10 + 1] = 0;1258; for (int i = 0; i < 20; ++i)1259; ((long long int *)Bytes)[i * 10 + 2] = 0;1260; Bytes[1023] = 0;1261; write_arg((int *)&Bytes[500], 0);1262; struct S R;1263; for (int i = 0; i < 1024; ++i)1264; globalBytes[i] = Bytes[i];1265; }1266;1267define void @noalias_arg_simplifiable_2(ptr %Bytes) {1268; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn1269; TUNIT-LABEL: define void @noalias_arg_simplifiable_2(1270; TUNIT-SAME: ptr nofree nonnull captures(none) dereferenceable(24) [[BYTES:%.*]]) #[[ATTR3]] {1271; TUNIT-NEXT: [[ENTRY:.*]]:1272; TUNIT-NEXT: br label %[[FOR_COND:.*]]1273; TUNIT: [[FOR_COND]]:1274; TUNIT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_INC:.*]] ], [ 0, %[[ENTRY]] ]1275; TUNIT-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 1001276; TUNIT-NEXT: br i1 [[EXITCOND]], label %[[FOR_BODY:.*]], label %[[FOR_COND_CLEANUP:.*]]1277; TUNIT: [[FOR_COND_CLEANUP]]:1278; TUNIT-NEXT: br label %[[FOR_END:.*]]1279; TUNIT: [[FOR_BODY]]:1280; TUNIT-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 101281; TUNIT-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 [[I]]1282; TUNIT-NEXT: store i8 0, ptr [[ARRAYIDX]], align 1, !tbaa [[CHAR_TBAA19]]1283; TUNIT-NEXT: br label %[[FOR_INC]]1284; TUNIT: [[FOR_INC]]:1285; TUNIT-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 11286; TUNIT-NEXT: br label %[[FOR_COND]], !llvm.loop [[LOOP25:![0-9]+]]1287; TUNIT: [[FOR_END]]:1288; TUNIT-NEXT: br label %[[FOR_COND2:.*]]1289; TUNIT: [[FOR_COND2]]:1290; TUNIT-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], %[[FOR_INC9:.*]] ], [ 0, %[[FOR_END]] ]1291; TUNIT-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 101292; TUNIT-NEXT: br i1 [[EXITCOND6]], label %[[FOR_BODY5:.*]], label %[[FOR_COND_CLEANUP4:.*]]1293; TUNIT: [[FOR_COND_CLEANUP4]]:1294; TUNIT-NEXT: br label %[[FOR_END11:.*]]1295; TUNIT: [[FOR_BODY5]]:1296; TUNIT-NEXT: [[I16:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 101297; TUNIT-NEXT: [[I17:%.*]] = or i64 [[I16]], 11298; TUNIT-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[BYTES]], i64 [[I17]]1299; TUNIT-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX8]], align 4, !tbaa [[FLOAT_TBAA26:![0-9]+]]1300; TUNIT-NEXT: br label %[[FOR_INC9]]1301; TUNIT: [[FOR_INC9]]:1302; TUNIT-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 11303; TUNIT-NEXT: br label %[[FOR_COND2]], !llvm.loop [[LOOP27:![0-9]+]]1304; TUNIT: [[FOR_END11]]:1305; TUNIT-NEXT: br label %[[FOR_COND13:.*]]1306; TUNIT: [[FOR_COND13]]:1307; TUNIT-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], %[[FOR_INC21:.*]] ], [ 0, %[[FOR_END11]] ]1308; TUNIT-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 201309; TUNIT-NEXT: br i1 [[EXITCOND11]], label %[[FOR_BODY16:.*]], label %[[FOR_COND_CLEANUP15:.*]]1310; TUNIT: [[FOR_COND_CLEANUP15]]:1311; TUNIT-NEXT: br label %[[FOR_END23:.*]]1312; TUNIT: [[FOR_BODY16]]:1313; TUNIT-NEXT: [[I19:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 101314; TUNIT-NEXT: [[I20:%.*]] = add nuw nsw i64 [[I19]], 21315; TUNIT-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, ptr [[BYTES]], i64 [[I20]]1316; TUNIT-NEXT: store i64 0, ptr [[ARRAYIDX20]], align 8, !tbaa [[LONG_LONG_TBAA28:![0-9]+]]1317; TUNIT-NEXT: br label %[[FOR_INC21]]1318; TUNIT: [[FOR_INC21]]:1319; TUNIT-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 11320; TUNIT-NEXT: br label %[[FOR_COND13]], !llvm.loop [[LOOP30:![0-9]+]]1321; TUNIT: [[FOR_END23]]:1322; TUNIT-NEXT: [[ARRAYIDX24:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 10231323; TUNIT-NEXT: store i8 0, ptr [[ARRAYIDX24]], align 1, !tbaa [[CHAR_TBAA19]]1324; TUNIT-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 5001325; TUNIT-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) [[ARRAYIDX25]], i32 noundef 0) #[[ATTR18]]1326; TUNIT-NEXT: br label %[[FOR_COND27:.*]]1327; TUNIT: [[FOR_COND27]]:1328; TUNIT-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], %[[FOR_INC35:.*]] ], [ 0, %[[FOR_END23]] ]1329; TUNIT-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 10241330; TUNIT-NEXT: br i1 [[EXITCOND14]], label %[[FOR_BODY30:.*]], label %[[FOR_COND_CLEANUP29:.*]]1331; TUNIT: [[FOR_COND_CLEANUP29]]:1332; TUNIT-NEXT: br label %[[FOR_END37:.*]]1333; TUNIT: [[FOR_BODY30]]:1334; TUNIT-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 [[INDVARS_IV12]]1335; TUNIT-NEXT: [[I22:%.*]] = load i8, ptr [[ARRAYIDX32]], align 1, !tbaa [[CHAR_TBAA19]]1336; TUNIT-NEXT: [[ARRAYIDX34:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]1337; TUNIT-NEXT: store i8 [[I22]], ptr [[ARRAYIDX34]], align 1, !tbaa [[CHAR_TBAA19]]1338; TUNIT-NEXT: br label %[[FOR_INC35]]1339; TUNIT: [[FOR_INC35]]:1340; TUNIT-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 11341; TUNIT-NEXT: br label %[[FOR_COND27]], !llvm.loop [[LOOP31:![0-9]+]]1342; TUNIT: [[FOR_END37]]:1343; TUNIT-NEXT: ret void1344;1345; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1346; CGSCC-LABEL: define void @noalias_arg_simplifiable_2(1347; CGSCC-SAME: ptr nofree nonnull align 4 captures(none) dereferenceable(1024) [[BYTES:%.*]]) #[[ATTR3]] {1348; CGSCC-NEXT: [[ENTRY:.*]]:1349; CGSCC-NEXT: br label %[[FOR_COND:.*]]1350; CGSCC: [[FOR_COND]]:1351; CGSCC-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_INC:.*]] ], [ 0, %[[ENTRY]] ]1352; CGSCC-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], 1001353; CGSCC-NEXT: br i1 [[EXITCOND]], label %[[FOR_BODY:.*]], label %[[FOR_COND_CLEANUP:.*]]1354; CGSCC: [[FOR_COND_CLEANUP]]:1355; CGSCC-NEXT: br label %[[FOR_END:.*]]1356; CGSCC: [[FOR_BODY]]:1357; CGSCC-NEXT: [[I:%.*]] = mul nuw nsw i64 [[INDVARS_IV]], 101358; CGSCC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 [[I]]1359; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX]], align 1, !tbaa [[CHAR_TBAA15]]1360; CGSCC-NEXT: br label %[[FOR_INC]]1361; CGSCC: [[FOR_INC]]:1362; CGSCC-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 11363; CGSCC-NEXT: br label %[[FOR_COND]], !llvm.loop [[LOOP28:![0-9]+]]1364; CGSCC: [[FOR_END]]:1365; CGSCC-NEXT: br label %[[FOR_COND2:.*]]1366; CGSCC: [[FOR_COND2]]:1367; CGSCC-NEXT: [[INDVARS_IV2:%.*]] = phi i64 [ [[INDVARS_IV_NEXT3:%.*]], %[[FOR_INC9:.*]] ], [ 0, %[[FOR_END]] ]1368; CGSCC-NEXT: [[EXITCOND6:%.*]] = icmp ne i64 [[INDVARS_IV2]], 101369; CGSCC-NEXT: br i1 [[EXITCOND6]], label %[[FOR_BODY5:.*]], label %[[FOR_COND_CLEANUP4:.*]]1370; CGSCC: [[FOR_COND_CLEANUP4]]:1371; CGSCC-NEXT: br label %[[FOR_END11:.*]]1372; CGSCC: [[FOR_BODY5]]:1373; CGSCC-NEXT: [[I16:%.*]] = mul nuw nsw i64 [[INDVARS_IV2]], 101374; CGSCC-NEXT: [[I17:%.*]] = or i64 [[I16]], 11375; CGSCC-NEXT: [[ARRAYIDX8:%.*]] = getelementptr inbounds float, ptr [[BYTES]], i64 [[I17]]1376; CGSCC-NEXT: store float 0.000000e+00, ptr [[ARRAYIDX8]], align 4, !tbaa [[FLOAT_TBAA18]]1377; CGSCC-NEXT: br label %[[FOR_INC9]]1378; CGSCC: [[FOR_INC9]]:1379; CGSCC-NEXT: [[INDVARS_IV_NEXT3]] = add nuw nsw i64 [[INDVARS_IV2]], 11380; CGSCC-NEXT: br label %[[FOR_COND2]], !llvm.loop [[LOOP29:![0-9]+]]1381; CGSCC: [[FOR_END11]]:1382; CGSCC-NEXT: br label %[[FOR_COND13:.*]]1383; CGSCC: [[FOR_COND13]]:1384; CGSCC-NEXT: [[INDVARS_IV7:%.*]] = phi i64 [ [[INDVARS_IV_NEXT8:%.*]], %[[FOR_INC21:.*]] ], [ 0, %[[FOR_END11]] ]1385; CGSCC-NEXT: [[EXITCOND11:%.*]] = icmp ne i64 [[INDVARS_IV7]], 201386; CGSCC-NEXT: br i1 [[EXITCOND11]], label %[[FOR_BODY16:.*]], label %[[FOR_COND_CLEANUP15:.*]]1387; CGSCC: [[FOR_COND_CLEANUP15]]:1388; CGSCC-NEXT: br label %[[FOR_END23:.*]]1389; CGSCC: [[FOR_BODY16]]:1390; CGSCC-NEXT: [[I19:%.*]] = mul nuw nsw i64 [[INDVARS_IV7]], 101391; CGSCC-NEXT: [[I20:%.*]] = add nuw nsw i64 [[I19]], 21392; CGSCC-NEXT: [[ARRAYIDX20:%.*]] = getelementptr inbounds i64, ptr [[BYTES]], i64 [[I20]]1393; CGSCC-NEXT: store i64 0, ptr [[ARRAYIDX20]], align 8, !tbaa [[LONG_LONG_TBAA20]]1394; CGSCC-NEXT: br label %[[FOR_INC21]]1395; CGSCC: [[FOR_INC21]]:1396; CGSCC-NEXT: [[INDVARS_IV_NEXT8]] = add nuw nsw i64 [[INDVARS_IV7]], 11397; CGSCC-NEXT: br label %[[FOR_COND13]], !llvm.loop [[LOOP30:![0-9]+]]1398; CGSCC: [[FOR_END23]]:1399; CGSCC-NEXT: [[ARRAYIDX24:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 10231400; CGSCC-NEXT: store i8 0, ptr [[ARRAYIDX24]], align 1, !tbaa [[CHAR_TBAA15]]1401; CGSCC-NEXT: [[ARRAYIDX25:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 5001402; CGSCC-NEXT: call void @write_arg(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(524) [[ARRAYIDX25]], i32 noundef 0) #[[ATTR21]]1403; CGSCC-NEXT: br label %[[FOR_COND27:.*]]1404; CGSCC: [[FOR_COND27]]:1405; CGSCC-NEXT: [[INDVARS_IV12:%.*]] = phi i64 [ [[INDVARS_IV_NEXT13:%.*]], %[[FOR_INC35:.*]] ], [ 0, %[[FOR_END23]] ]1406; CGSCC-NEXT: [[EXITCOND14:%.*]] = icmp ne i64 [[INDVARS_IV12]], 10241407; CGSCC-NEXT: br i1 [[EXITCOND14]], label %[[FOR_BODY30:.*]], label %[[FOR_COND_CLEANUP29:.*]]1408; CGSCC: [[FOR_COND_CLEANUP29]]:1409; CGSCC-NEXT: br label %[[FOR_END37:.*]]1410; CGSCC: [[FOR_BODY30]]:1411; CGSCC-NEXT: [[ARRAYIDX32:%.*]] = getelementptr inbounds i8, ptr [[BYTES]], i64 [[INDVARS_IV12]]1412; CGSCC-NEXT: [[I22:%.*]] = load i8, ptr [[ARRAYIDX32]], align 1, !tbaa [[CHAR_TBAA15]]1413; CGSCC-NEXT: [[ARRAYIDX34:%.*]] = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 [[INDVARS_IV12]]1414; CGSCC-NEXT: store i8 [[I22]], ptr [[ARRAYIDX34]], align 1, !tbaa [[CHAR_TBAA15]]1415; CGSCC-NEXT: br label %[[FOR_INC35]]1416; CGSCC: [[FOR_INC35]]:1417; CGSCC-NEXT: [[INDVARS_IV_NEXT13]] = add nuw nsw i64 [[INDVARS_IV12]], 11418; CGSCC-NEXT: br label %[[FOR_COND27]], !llvm.loop [[LOOP31:![0-9]+]]1419; CGSCC: [[FOR_END37]]:1420; CGSCC-NEXT: ret void1421;1422entry:1423 br label %for.cond1424 1425for.cond: ; preds = %for.inc, %entry1426 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]1427 %exitcond = icmp ne i64 %indvars.iv, 1001428 br i1 %exitcond, label %for.body, label %for.cond.cleanup1429 1430for.cond.cleanup: ; preds = %for.cond1431 br label %for.end1432 1433for.body: ; preds = %for.cond1434 %i = mul nuw nsw i64 %indvars.iv, 101435 %arrayidx = getelementptr inbounds i8, ptr %Bytes, i64 %i1436 store i8 0, ptr %arrayidx, align 1, !tbaa !151437 br label %for.inc1438 1439for.inc: ; preds = %for.body1440 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 11441 br label %for.cond, !llvm.loop !281442 1443for.end: ; preds = %for.cond.cleanup1444 br label %for.cond21445 1446for.cond2: ; preds = %for.inc9, %for.end1447 %indvars.iv2 = phi i64 [ %indvars.iv.next3, %for.inc9 ], [ 0, %for.end ]1448 %exitcond6 = icmp ne i64 %indvars.iv2, 101449 br i1 %exitcond6, label %for.body5, label %for.cond.cleanup41450 1451for.cond.cleanup4: ; preds = %for.cond21452 br label %for.end111453 1454for.body5: ; preds = %for.cond21455 %i16 = mul nuw nsw i64 %indvars.iv2, 101456 %i17 = or i64 %i16, 11457 %arrayidx8 = getelementptr inbounds float, ptr %Bytes, i64 %i171458 store float 0.000000e+00, ptr %arrayidx8, align 4, !tbaa !181459 br label %for.inc91460 1461for.inc9: ; preds = %for.body51462 %indvars.iv.next3 = add nuw nsw i64 %indvars.iv2, 11463 br label %for.cond2, !llvm.loop !291464 1465for.end11: ; preds = %for.cond.cleanup41466 br label %for.cond131467 1468for.cond13: ; preds = %for.inc21, %for.end111469 %indvars.iv7 = phi i64 [ %indvars.iv.next8, %for.inc21 ], [ 0, %for.end11 ]1470 %exitcond11 = icmp ne i64 %indvars.iv7, 201471 br i1 %exitcond11, label %for.body16, label %for.cond.cleanup151472 1473for.cond.cleanup15: ; preds = %for.cond131474 br label %for.end231475 1476for.body16: ; preds = %for.cond131477 %i19 = mul nuw nsw i64 %indvars.iv7, 101478 %i20 = add nuw nsw i64 %i19, 21479 %arrayidx20 = getelementptr inbounds i64, ptr %Bytes, i64 %i201480 store i64 0, ptr %arrayidx20, align 8, !tbaa !201481 br label %for.inc211482 1483for.inc21: ; preds = %for.body161484 %indvars.iv.next8 = add nuw nsw i64 %indvars.iv7, 11485 br label %for.cond13, !llvm.loop !301486 1487for.end23: ; preds = %for.cond.cleanup151488 %arrayidx24 = getelementptr inbounds i8, ptr %Bytes, i64 10231489 store i8 0, ptr %arrayidx24, align 1, !tbaa !151490 %arrayidx25 = getelementptr inbounds i8, ptr %Bytes, i64 5001491 call void @write_arg(ptr nonnull %arrayidx25, i32 0)1492 br label %for.cond271493 1494for.cond27: ; preds = %for.inc35, %for.end231495 %indvars.iv12 = phi i64 [ %indvars.iv.next13, %for.inc35 ], [ 0, %for.end23 ]1496 %exitcond14 = icmp ne i64 %indvars.iv12, 10241497 br i1 %exitcond14, label %for.body30, label %for.cond.cleanup291498 1499for.cond.cleanup29: ; preds = %for.cond271500 br label %for.end371501 1502for.body30: ; preds = %for.cond271503 %arrayidx32 = getelementptr inbounds i8, ptr %Bytes, i64 %indvars.iv121504 %i22 = load i8, ptr %arrayidx32, align 1, !tbaa !151505 %arrayidx34 = getelementptr inbounds [1024 x i8], ptr @globalBytes, i64 0, i64 %indvars.iv121506 store i8 %i22, ptr %arrayidx34, align 1, !tbaa !151507 br label %for.inc351508 1509for.inc35: ; preds = %for.body301510 %indvars.iv.next13 = add nuw nsw i64 %indvars.iv12, 11511 br label %for.cond27, !llvm.loop !311512 1513for.end37: ; preds = %for.cond.cleanup291514 ret void1515}1516 1517; int local_alloca_not_simplifiable_1() {1518; int X, Y, Z;1519; X = Y = 1;1520; escape(&X);1521; write_random(&Y);1522; Z = X ? 1 : 2;1523; return X + Y + Z;1524; }1525;1526define i32 @local_alloca_not_simplifiable_1() {1527; TUNIT-LABEL: define i32 @local_alloca_not_simplifiable_1() {1528; TUNIT-NEXT: [[ENTRY:.*:]]1529; TUNIT-NEXT: [[X:%.*]] = alloca i32, align 41530; TUNIT-NEXT: [[Y:%.*]] = alloca i32, align 41531; TUNIT-NEXT: call void @llvm.lifetime.start.p0(ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[X]]) #[[ATTR17]]1532; TUNIT-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[Y]]) #[[ATTR17]]1533; TUNIT-NEXT: store i32 1, ptr [[Y]], align 4, !tbaa [[INT_TBAA3]]1534; TUNIT-NEXT: store i32 1, ptr [[X]], align 4, !tbaa [[INT_TBAA3]]1535; TUNIT-NEXT: call void @escape(ptr noundef nonnull align 4 dereferenceable(4) [[X]])1536; TUNIT-NEXT: call void @write_random(ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[Y]])1537; TUNIT-NEXT: [[I3:%.*]] = load i32, ptr [[X]], align 4, !tbaa [[INT_TBAA3]]1538; TUNIT-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[I3]], 01539; TUNIT-NEXT: [[COND:%.*]] = select i1 [[TOBOOL_NOT]], i32 2, i32 11540; TUNIT-NEXT: [[I4:%.*]] = load i32, ptr [[Y]], align 4, !tbaa [[INT_TBAA3]]1541; TUNIT-NEXT: [[ADD:%.*]] = add nsw i32 [[I3]], [[I4]]1542; TUNIT-NEXT: [[ADD1:%.*]] = add nsw i32 [[ADD]], [[COND]]1543; TUNIT-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[Y]])1544; TUNIT-NEXT: call void @llvm.lifetime.end.p0(ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[X]])1545; TUNIT-NEXT: ret i32 [[ADD1]]1546;1547; CGSCC-LABEL: define i32 @local_alloca_not_simplifiable_1() {1548; CGSCC-NEXT: [[ENTRY:.*:]]1549; CGSCC-NEXT: [[X:%.*]] = alloca i32, align 41550; CGSCC-NEXT: [[Y:%.*]] = alloca i32, align 41551; CGSCC-NEXT: call void @llvm.lifetime.start.p0(ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[X]]) #[[ATTR20]]1552; CGSCC-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[Y]]) #[[ATTR20]]1553; CGSCC-NEXT: store i32 1, ptr [[Y]], align 4, !tbaa [[INT_TBAA3]]1554; CGSCC-NEXT: store i32 1, ptr [[X]], align 4, !tbaa [[INT_TBAA3]]1555; CGSCC-NEXT: call void @escape(ptr noundef nonnull align 4 dereferenceable(4) [[X]])1556; CGSCC-NEXT: call void @write_random(ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[Y]])1557; CGSCC-NEXT: [[I3:%.*]] = load i32, ptr [[X]], align 4, !tbaa [[INT_TBAA3]]1558; CGSCC-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[I3]], 01559; CGSCC-NEXT: [[COND:%.*]] = select i1 [[TOBOOL_NOT]], i32 2, i32 11560; CGSCC-NEXT: [[I4:%.*]] = load i32, ptr [[Y]], align 4, !tbaa [[INT_TBAA3]]1561; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[I3]], [[I4]]1562; CGSCC-NEXT: [[ADD1:%.*]] = add nsw i32 [[ADD]], [[COND]]1563; CGSCC-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[Y]])1564; CGSCC-NEXT: call void @llvm.lifetime.end.p0(ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[X]])1565; CGSCC-NEXT: ret i32 [[ADD1]]1566;1567entry:1568 %X = alloca i32, align 41569 %Y = alloca i32, align 41570 call void @llvm.lifetime.start.p0(ptr nonnull %X)1571 call void @llvm.lifetime.start.p0(ptr nonnull %Y)1572 store i32 1, ptr %Y, align 4, !tbaa !31573 store i32 1, ptr %X, align 4, !tbaa !31574 call void @escape(ptr nonnull %X)1575 call void @write_random(ptr nonnull %Y)1576 %i3 = load i32, ptr %X, align 4, !tbaa !31577 %tobool.not = icmp eq i32 %i3, 01578 %cond = select i1 %tobool.not, i32 2, i32 11579 %i4 = load i32, ptr %Y, align 4, !tbaa !31580 %add = add nsw i32 %i3, %i41581 %add1 = add nsw i32 %add, %cond1582 call void @llvm.lifetime.end.p0(ptr nonnull %Y)1583 call void @llvm.lifetime.end.p0(ptr nonnull %X)1584 ret i32 %add11585}1586 1587define i8 @local_alloca_not_simplifiable_2(i64 %index1, i64 %index2, i1 %cnd) {1588; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)1589; CHECK-LABEL: define i8 @local_alloca_not_simplifiable_2(1590; CHECK-SAME: i64 [[INDEX1:%.*]], i64 [[INDEX2:%.*]], i1 noundef [[CND:%.*]]) #[[ATTR4]] {1591; CHECK-NEXT: [[ENTRY:.*:]]1592; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 161593; CHECK-NEXT: store i8 7, ptr [[BYTES]], align 161594; CHECK-NEXT: br i1 [[CND]], label %[[LEFT:.*]], label %[[RIGHT:.*]]1595; CHECK: [[LEFT]]:1596; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[INDEX1]]1597; CHECK-NEXT: br label %[[JOIN:.*]]1598; CHECK: [[RIGHT]]:1599; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 [[INDEX2]]1600; CHECK-NEXT: br label %[[JOIN]]1601; CHECK: [[JOIN]]:1602; CHECK-NEXT: [[GEP_JOIN:%.*]] = phi ptr [ [[GEP1]], %[[LEFT]] ], [ [[GEP2]], %[[RIGHT]] ]1603; CHECK-NEXT: store i8 9, ptr [[GEP_JOIN]], align 41604; CHECK-NEXT: [[I:%.*]] = load i8, ptr [[BYTES]], align 161605; CHECK-NEXT: ret i8 [[I]]1606;1607entry:1608 %Bytes = alloca [1024 x i8], align 161609 store i8 7, ptr %Bytes, align 41610 br i1 %cnd, label %left, label %right1611 1612left: ; preds = %entry1613 %gep1 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %index11614 br label %join1615 1616right: ; preds = %entry1617 %gep2 = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %index21618 br label %join1619 1620join: ; preds = %right, %left1621 %gep.join = phi ptr [ %gep1, %left ], [ %gep2, %right ]1622 store i8 9, ptr %gep.join, align 41623 1624 ; This load cannot be replaced by the value 7 from %entry, since the previous1625 ; store interferes due to its unknown offset.1626 %i = load i8, ptr %Bytes, align 41627 ret i8 %i1628}1629 1630; We could simplify these if we separate accessed bins wrt. alignment (here mod 4).1631define i32 @unknown_access_mixed_simplifiable(i32 %arg1, i32 %arg2) {1632; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)1633; CHECK-LABEL: define i32 @unknown_access_mixed_simplifiable(1634; CHECK-SAME: i32 [[ARG1:%.*]], i32 [[ARG2:%.*]]) #[[ATTR4]] {1635; CHECK-NEXT: [[ENTRY:.*:]]1636; CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 41637; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 21638; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, ptr [[S]], i32 [[ARG1]]1639; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, ptr [[S]], i32 [[ARG2]]1640; CHECK-NEXT: store i32 7, ptr [[GEP1]], align 41641; CHECK-NEXT: store i32 7, ptr [[GEP2]], align 41642; CHECK-NEXT: store i32 7, ptr [[GEP3]], align 41643; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[GEP1]], align 41644; CHECK-NEXT: [[L2:%.*]] = load i32, ptr [[GEP2]], align 41645; CHECK-NEXT: [[L3:%.*]] = load i32, ptr [[GEP3]], align 41646; CHECK-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]]1647; CHECK-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]]1648; CHECK-NEXT: ret i32 [[ADD2]]1649;1650entry:1651 %s = alloca %struct.S, align 41652 %gep1 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 21653 %gep2 = getelementptr inbounds i32, ptr %s, i32 %arg11654 %gep3 = getelementptr inbounds i32, ptr %s, i32 %arg21655 store i32 7, ptr %gep11656 store i32 7, ptr %gep21657 store i32 7, ptr %gep31658 %l1 = load i32, ptr %gep11659 %l2 = load i32, ptr %gep21660 %l3 = load i32, ptr %gep31661 %add1 = add i32 %l1, %l21662 %add2 = add i32 %add1, %l31663 ret i32 %add21664}1665 1666; The access to bc4b could go anywhere, nothing is simplifiable.1667define i32 @unknown_access_mixed_not_simplifiable(i32 %arg1, i32 %arg2, i32 %arg3) {1668; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)1669; CHECK-LABEL: define i32 @unknown_access_mixed_not_simplifiable(1670; CHECK-SAME: i32 [[ARG1:%.*]], i32 [[ARG2:%.*]], i32 [[ARG3:%.*]]) #[[ATTR4]] {1671; CHECK-NEXT: [[ENTRY:.*:]]1672; CHECK-NEXT: [[S:%.*]] = alloca [[STRUCT_S:%.*]], align 41673; CHECK-NEXT: [[GEP1:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[S]], i64 0, i32 21674; CHECK-NEXT: [[GEP2:%.*]] = getelementptr inbounds i32, ptr [[S]], i32 [[ARG1]]1675; CHECK-NEXT: [[GEP3:%.*]] = getelementptr inbounds i32, ptr [[S]], i32 [[ARG2]]1676; CHECK-NEXT: [[GEP4:%.*]] = getelementptr inbounds i8, ptr [[S]], i32 [[ARG3]]1677; CHECK-NEXT: store i32 7, ptr [[GEP1]], align 41678; CHECK-NEXT: store i32 7, ptr [[GEP2]], align 41679; CHECK-NEXT: store i32 7, ptr [[GEP3]], align 41680; CHECK-NEXT: store i32 7, ptr [[GEP4]], align 41681; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[GEP1]], align 41682; CHECK-NEXT: [[L2:%.*]] = load i32, ptr [[GEP2]], align 41683; CHECK-NEXT: [[L3:%.*]] = load i32, ptr [[GEP3]], align 41684; CHECK-NEXT: [[L4:%.*]] = load i32, ptr [[GEP4]], align 41685; CHECK-NEXT: [[ADD1:%.*]] = add i32 [[L1]], [[L2]]1686; CHECK-NEXT: [[ADD2:%.*]] = add i32 [[ADD1]], [[L3]]1687; CHECK-NEXT: [[ADD3:%.*]] = add i32 [[ADD2]], [[L4]]1688; CHECK-NEXT: ret i32 [[ADD3]]1689;1690entry:1691 %s = alloca %struct.S, align 41692 %gep1 = getelementptr inbounds %struct.S, ptr %s, i64 0, i32 21693 %gep2 = getelementptr inbounds i32, ptr %s, i32 %arg11694 %gep3 = getelementptr inbounds i32, ptr %s, i32 %arg21695 %gep4 = getelementptr inbounds i8, ptr %s, i32 %arg31696 store i32 7, ptr %gep11697 store i32 7, ptr %gep21698 store i32 7, ptr %gep31699 store i32 7, ptr %gep41700 %l1 = load i32, ptr %gep11701 %l2 = load i32, ptr %gep21702 %l3 = load i32, ptr %gep31703 %l4 = load i32, ptr %gep41704 %add1 = add i32 %l1, %l21705 %add2 = add i32 %add1, %l31706 %add3 = add i32 %add2, %l41707 ret i32 %add31708}1709 1710declare void @escape(ptr)1711 1712; int Flag0 = 0;1713; int global_not_simplifiable_1(int cnd) {1714; return Flag0;1715; }1716;1717define i32 @global_not_simplifiable_1(i32 %cnd) {1718; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)1719; TUNIT-LABEL: define i32 @global_not_simplifiable_1(1720; TUNIT-SAME: i32 [[CND:%.*]]) #[[ATTR6:[0-9]+]] {1721; TUNIT-NEXT: [[ENTRY:.*:]]1722; TUNIT-NEXT: [[I:%.*]] = load i32, ptr @Flag0, align 4, !tbaa [[INT_TBAA3]]1723; TUNIT-NEXT: ret i32 [[I]]1724;1725; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)1726; CGSCC-LABEL: define i32 @global_not_simplifiable_1(1727; CGSCC-SAME: i32 [[CND:%.*]]) #[[ATTR7:[0-9]+]] {1728; CGSCC-NEXT: [[ENTRY:.*:]]1729; CGSCC-NEXT: [[I:%.*]] = load i32, ptr @Flag0, align 4, !tbaa [[INT_TBAA3]]1730; CGSCC-NEXT: ret i32 [[I]]1731;1732entry:1733 %i = load i32, ptr @Flag0, align 4, !tbaa !31734 ret i32 %i1735}1736 1737; static int Flag1 __attribute__((loader_uninitialized));1738; int static_global_not_simplifiable_1(int cnd) {1739; int v = Flag1;1740; sync();1741; if (cnd)1742; Flag1 = 1;1743; return v;1744; }1745;1746define i32 @static_global_not_simplifiable_1(i32 %cnd) {1747; CHECK-LABEL: define i32 @static_global_not_simplifiable_1(1748; CHECK-SAME: i32 [[CND:%.*]]) {1749; CHECK-NEXT: [[ENTRY:.*:]]1750; CHECK-NEXT: call void @sync()1751; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp eq i32 [[CND]], 01752; CHECK-NEXT: br i1 [[TOBOOL_NOT]], label %[[IF_END:.*]], label %[[IF_THEN:.*]]1753; CHECK: [[IF_THEN]]:1754; CHECK-NEXT: br label %[[IF_END]]1755; CHECK: [[IF_END]]:1756; CHECK-NEXT: ret i32 11757;1758entry:1759 %i = load i32, ptr @Flag1, align 4, !tbaa !31760 call void @sync()1761 %tobool.not = icmp eq i32 %cnd, 01762 br i1 %tobool.not, label %if.end, label %if.then1763 1764if.then: ; preds = %entry1765 store i32 1, ptr @Flag1, align 4, !tbaa !31766 br label %if.end1767 1768if.end: ; preds = %if.then, %entry1769 ret i32 %i1770}1771 1772declare void @sync()1773 1774; static int Flag2 __attribute__((loader_uninitialized));1775; int static_global_simplifiable_4(int cnd) {1776; Flag2 = 1;1777; sync();1778; int v = Flag2;1779; Flag2 = 2;1780; return v;1781; }1782define i32 @static_global_simplifiable_4(i32 %cnd) {1783; CHECK-LABEL: define noundef i32 @static_global_simplifiable_4(1784; CHECK-SAME: i32 [[CND:%.*]]) {1785; CHECK-NEXT: [[ENTRY:.*:]]1786; CHECK-NEXT: store i32 1, ptr @Flag2, align 4, !tbaa [[INT_TBAA3]]1787; CHECK-NEXT: call void @sync()1788; CHECK-NEXT: [[I:%.*]] = load i32, ptr @Flag2, align 4, !tbaa [[INT_TBAA3]]1789; CHECK-NEXT: store i32 2, ptr @Flag2, align 4, !tbaa [[INT_TBAA3]]1790; CHECK-NEXT: ret i32 [[I]]1791;1792entry:1793 store i32 1, ptr @Flag2, align 4, !tbaa !31794 call void @sync()1795 %i = load i32, ptr @Flag2, align 4, !tbaa !31796 store i32 2, ptr @Flag2, align 4, !tbaa !31797 ret i32 %i1798}1799 1800; static int Flag2 __attribute__((loader_uninitialized));1801; int static_global_not_simplifiable_2(int cnd) {1802; Flag2 = 1;1803; sync();1804; int v = Flag2;1805; Flag2 = 2;1806; return v;1807; }1808define i32 @static_global_not_simplifiable_2(i32 %cnd) {1809; TUNIT-LABEL: define noundef i32 @static_global_not_simplifiable_2(1810; TUNIT-SAME: i32 [[CND:%.*]]) {1811; TUNIT-NEXT: [[ENTRY:.*:]]1812; TUNIT-NEXT: store i32 1, ptr @Flag4, align 4, !tbaa [[INT_TBAA3]]1813; TUNIT-NEXT: call void @sync() #[[ATTR19:[0-9]+]]1814; TUNIT-NEXT: [[I:%.*]] = load i32, ptr @Flag4, align 4, !tbaa [[INT_TBAA3]]1815; TUNIT-NEXT: store i32 2, ptr @Flag4, align 4, !tbaa [[INT_TBAA3]]1816; TUNIT-NEXT: ret i32 [[I]]1817;1818; CGSCC-LABEL: define noundef i32 @static_global_not_simplifiable_2(1819; CGSCC-SAME: i32 [[CND:%.*]]) {1820; CGSCC-NEXT: [[ENTRY:.*:]]1821; CGSCC-NEXT: store i32 1, ptr @Flag4, align 4, !tbaa [[INT_TBAA3]]1822; CGSCC-NEXT: call void @sync() #[[ATTR22:[0-9]+]]1823; CGSCC-NEXT: [[I:%.*]] = load i32, ptr @Flag4, align 4, !tbaa [[INT_TBAA3]]1824; CGSCC-NEXT: store i32 2, ptr @Flag4, align 4, !tbaa [[INT_TBAA3]]1825; CGSCC-NEXT: ret i32 [[I]]1826;1827entry:1828 store i32 1, ptr @Flag4, align 4, !tbaa !31829 call void @sync() nocallback1830 %i = load i32, ptr @Flag4, align 4, !tbaa !31831 store i32 2, ptr @Flag4, align 4, !tbaa !31832 ret i32 %i1833}1834define void @static_global_not_simplifiable_2_helper() {1835; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1836; TUNIT-LABEL: define void @static_global_not_simplifiable_2_helper(1837; TUNIT-SAME: ) #[[ATTR5]] {1838; TUNIT-NEXT: store i32 2, ptr @Flag4, align 4, !tbaa [[INT_TBAA3]]1839; TUNIT-NEXT: ret void1840;1841; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1842; CGSCC-LABEL: define void @static_global_not_simplifiable_2_helper(1843; CGSCC-SAME: ) #[[ATTR6]] {1844; CGSCC-NEXT: store i32 2, ptr @Flag4, align 4, !tbaa [[INT_TBAA3]]1845; CGSCC-NEXT: ret void1846;1847 store i32 2, ptr @Flag4, align 4, !tbaa !31848 ret void1849}1850 1851; Similiar to static_global_simplifiable_3 but with a may-store.1852define i32 @static_global_not_simplifiable_3(i1 %c, ptr %p) {1853; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn1854; TUNIT-LABEL: define noundef i32 @static_global_not_simplifiable_3(1855; TUNIT-SAME: i1 [[C:%.*]], ptr nofree writeonly captures(none) [[P:%.*]]) #[[ATTR3]] {1856; TUNIT-NEXT: [[SEL:%.*]] = select i1 [[C]], ptr @Flag3, ptr [[P]]1857; TUNIT-NEXT: store i32 1, ptr [[SEL]], align 4, !tbaa [[INT_TBAA3]]1858; TUNIT-NEXT: [[I:%.*]] = load i32, ptr @Flag3, align 4, !tbaa [[INT_TBAA3]]1859; TUNIT-NEXT: ret i32 [[I]]1860;1861; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn1862; CGSCC-LABEL: define noundef i32 @static_global_not_simplifiable_3(1863; CGSCC-SAME: i1 [[C:%.*]], ptr nofree writeonly captures(none) [[P:%.*]]) #[[ATTR5]] {1864; CGSCC-NEXT: [[SEL:%.*]] = select i1 [[C]], ptr @Flag3, ptr [[P]]1865; CGSCC-NEXT: store i32 1, ptr [[SEL]], align 4, !tbaa [[INT_TBAA3]]1866; CGSCC-NEXT: [[I:%.*]] = load i32, ptr @Flag3, align 4, !tbaa [[INT_TBAA3]]1867; CGSCC-NEXT: ret i32 [[I]]1868;1869 %sel = select i1 %c, ptr @Flag3, ptr %p1870 store i32 1, ptr %sel, align 4, !tbaa !31871 %i = load i32, ptr @Flag3, align 4, !tbaa !31872 ret i32 %i1873}1874 1875 1876; int write_read{,_static,_static_undef}_global(void) {1877; Gint{,static,_static_undef}1 = 7;1878; return Gint1;1879; }1880; void write{,_static,_static_undef}_global(void) {1881; Gint{,static,_static_undef}2 = 7;1882; }1883; int read{,_static,_static_undef}_global(void) {1884; return Gint{,static,_static_undef}2;1885; }1886;1887; FIXME: We could replace these loads.1888define i32 @write_read_global() {1889; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn1890; TUNIT-LABEL: define i32 @write_read_global(1891; TUNIT-SAME: ) #[[ATTR3]] {1892; TUNIT-NEXT: store i32 7, ptr @Gint1, align 41893; TUNIT-NEXT: [[L:%.*]] = load i32, ptr @Gint1, align 41894; TUNIT-NEXT: ret i32 [[L]]1895;1896; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn1897; CGSCC-LABEL: define i32 @write_read_global(1898; CGSCC-SAME: ) #[[ATTR5]] {1899; CGSCC-NEXT: store i32 7, ptr @Gint1, align 41900; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @Gint1, align 41901; CGSCC-NEXT: ret i32 [[L]]1902;1903 store i32 7, ptr @Gint11904 %l = load i32, ptr @Gint11905 ret i32 %l1906}1907define void @write_global() {1908; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1909; TUNIT-LABEL: define void @write_global(1910; TUNIT-SAME: ) #[[ATTR5]] {1911; TUNIT-NEXT: store i32 7, ptr @Gint2, align 41912; TUNIT-NEXT: ret void1913;1914; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1915; CGSCC-LABEL: define void @write_global(1916; CGSCC-SAME: ) #[[ATTR6]] {1917; CGSCC-NEXT: store i32 7, ptr @Gint2, align 41918; CGSCC-NEXT: ret void1919;1920 store i32 7, ptr @Gint21921 ret void1922}1923define i32 @read_global() {1924; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)1925; TUNIT-LABEL: define i32 @read_global(1926; TUNIT-SAME: ) #[[ATTR6]] {1927; TUNIT-NEXT: [[L:%.*]] = load i32, ptr @Gint2, align 41928; TUNIT-NEXT: ret i32 [[L]]1929;1930; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)1931; CGSCC-LABEL: define i32 @read_global(1932; CGSCC-SAME: ) #[[ATTR7]] {1933; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @Gint2, align 41934; CGSCC-NEXT: ret i32 [[L]]1935;1936 %l = load i32, ptr @Gint21937 ret i32 %l1938}1939define i32 @write_read_static_global() {1940; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1941; TUNIT-LABEL: define noundef i32 @write_read_static_global(1942; TUNIT-SAME: ) #[[ATTR5]] {1943; TUNIT-NEXT: ret i32 71944;1945; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1946; CGSCC-LABEL: define noundef i32 @write_read_static_global(1947; CGSCC-SAME: ) #[[ATTR6]] {1948; CGSCC-NEXT: ret i32 71949;1950 store i32 7, ptr @Gstatic_int11951 %l = load i32, ptr @Gstatic_int11952 ret i32 %l1953}1954define void @write_static_global() {1955; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1956; TUNIT-LABEL: define void @write_static_global(1957; TUNIT-SAME: ) #[[ATTR5]] {1958; TUNIT-NEXT: store i32 7, ptr @Gstatic_int2, align 41959; TUNIT-NEXT: ret void1960;1961; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1962; CGSCC-LABEL: define void @write_static_global(1963; CGSCC-SAME: ) #[[ATTR6]] {1964; CGSCC-NEXT: store i32 7, ptr @Gstatic_int2, align 41965; CGSCC-NEXT: ret void1966;1967 store i32 7, ptr @Gstatic_int21968 ret void1969}1970define i32 @read_static_global() {1971; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)1972; TUNIT-LABEL: define noundef i32 @read_static_global(1973; TUNIT-SAME: ) #[[ATTR6]] {1974; TUNIT-NEXT: [[L:%.*]] = load i32, ptr @Gstatic_int2, align 41975; TUNIT-NEXT: ret i32 [[L]]1976;1977; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)1978; CGSCC-LABEL: define noundef i32 @read_static_global(1979; CGSCC-SAME: ) #[[ATTR7]] {1980; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @Gstatic_int2, align 41981; CGSCC-NEXT: ret i32 [[L]]1982;1983 %l = load i32, ptr @Gstatic_int21984 ret i32 %l1985}1986define i32 @write_read_static_undef_global() {1987; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1988; TUNIT-LABEL: define noundef i32 @write_read_static_undef_global(1989; TUNIT-SAME: ) #[[ATTR5]] {1990; TUNIT-NEXT: ret i32 71991;1992; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)1993; CGSCC-LABEL: define noundef i32 @write_read_static_undef_global(1994; CGSCC-SAME: ) #[[ATTR6]] {1995; CGSCC-NEXT: ret i32 71996;1997 store i32 7, ptr @Gstatic_undef_int11998 %l = load i32, ptr @Gstatic_undef_int11999 ret i32 %l2000}2001define void @write_static_undef_global() {2002; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)2003; TUNIT-LABEL: define void @write_static_undef_global(2004; TUNIT-SAME: ) #[[ATTR5]] {2005; TUNIT-NEXT: ret void2006;2007; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)2008; CGSCC-LABEL: define void @write_static_undef_global(2009; CGSCC-SAME: ) #[[ATTR6]] {2010; CGSCC-NEXT: store i32 7, ptr @Gstatic_undef_int2, align 42011; CGSCC-NEXT: ret void2012;2013 store i32 7, ptr @Gstatic_undef_int22014 ret void2015}2016define i32 @read_static_undef_global() {2017; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2018; CHECK-LABEL: define i32 @read_static_undef_global(2019; CHECK-SAME: ) #[[ATTR4]] {2020; CHECK-NEXT: ret i32 72021;2022 %l = load i32, ptr @Gstatic_undef_int22023 ret i32 %l2024}2025 2026define i32 @single_read_of_static_global() {2027; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2028; CHECK-LABEL: define noundef i32 @single_read_of_static_global(2029; CHECK-SAME: ) #[[ATTR4]] {2030; CHECK-NEXT: ret i32 02031;2032 %l = load i32, ptr @Gstatic_int32033 ret i32 %l2034}2035 2036define i8 @phi_store() {2037; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2038; CHECK-LABEL: define i8 @phi_store(2039; CHECK-SAME: ) #[[ATTR4]] {2040; CHECK-NEXT: [[ENTRY:.*]]:2041; CHECK-NEXT: [[A:%.*]] = alloca i16, align 22042; CHECK-NEXT: br label %[[LOOP:.*]]2043; CHECK: [[LOOP]]:2044; CHECK-NEXT: [[P:%.*]] = phi ptr [ [[A]], %[[ENTRY]] ], [ [[G:%.*]], %[[LOOP]] ]2045; CHECK-NEXT: [[I:%.*]] = phi i8 [ 0, %[[ENTRY]] ], [ [[O:%.*]], %[[LOOP]] ]2046; CHECK-NEXT: store i8 1, ptr [[P]], align 12047; CHECK-NEXT: [[G]] = getelementptr i8, ptr [[P]], i64 12048; CHECK-NEXT: [[O]] = add nsw i8 [[I]], 12049; CHECK-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 22050; CHECK-NEXT: br i1 [[C]], label %[[END:.*]], label %[[LOOP]]2051; CHECK: [[END]]:2052; CHECK-NEXT: [[S:%.*]] = getelementptr i8, ptr [[A]], i64 12053; CHECK-NEXT: [[L:%.*]] = load i8, ptr [[S]], align 12054; CHECK-NEXT: ret i8 [[L]]2055;2056entry:2057 %a = alloca i162058 br label %loop2059loop:2060 %p = phi ptr [%a, %entry], [%g, %loop]2061 %i = phi i8 [0, %entry], [%o, %loop]2062 store i8 1, ptr %p2063 %g = getelementptr i8, ptr %p, i64 12064 %o = add nsw i8 %i, 12065 %c = icmp eq i8 %o, 22066 br i1 %c, label %end, label %loop2067end:2068 %s = getelementptr i8, ptr %a, i64 12069 %l = load i8, ptr %s2070 ret i8 %l2071}2072 2073; FIXME: This function returns 1.2074define i8 @phi_no_store_1() {2075;2076; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2077; TUNIT-LABEL: define i8 @phi_no_store_1(2078; TUNIT-SAME: ) #[[ATTR3]] {2079; TUNIT-NEXT: [[ENTRY:.*]]:2080; TUNIT-NEXT: br label %[[LOOP:.*]]2081; TUNIT: [[LOOP]]:2082; TUNIT-NEXT: [[P:%.*]] = phi ptr [ @a1, %[[ENTRY]] ], [ [[G:%.*]], %[[LOOP]] ]2083; TUNIT-NEXT: [[I:%.*]] = phi i8 [ 0, %[[ENTRY]] ], [ [[O:%.*]], %[[LOOP]] ]2084; TUNIT-NEXT: store i8 1, ptr [[P]], align 12085; TUNIT-NEXT: [[G]] = getelementptr i8, ptr [[P]], i64 12086; TUNIT-NEXT: [[O]] = add nsw i8 [[I]], 12087; TUNIT-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 32088; TUNIT-NEXT: br i1 [[C]], label %[[END:.*]], label %[[LOOP]]2089; TUNIT: [[END]]:2090; TUNIT-NEXT: [[S11:%.*]] = getelementptr i8, ptr @a1, i64 22091; TUNIT-NEXT: [[L11:%.*]] = load i8, ptr [[S11]], align 22092; TUNIT-NEXT: [[S12:%.*]] = getelementptr i8, ptr @a1, i64 32093; TUNIT-NEXT: [[L12:%.*]] = load i8, ptr [[S12]], align 12094; TUNIT-NEXT: [[ADD:%.*]] = add i8 [[L11]], [[L12]]2095; TUNIT-NEXT: ret i8 [[ADD]]2096;2097; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2098; CGSCC-LABEL: define i8 @phi_no_store_1(2099; CGSCC-SAME: ) #[[ATTR5]] {2100; CGSCC-NEXT: [[ENTRY:.*]]:2101; CGSCC-NEXT: br label %[[LOOP:.*]]2102; CGSCC: [[LOOP]]:2103; CGSCC-NEXT: [[P:%.*]] = phi ptr [ @a1, %[[ENTRY]] ], [ [[G:%.*]], %[[LOOP]] ]2104; CGSCC-NEXT: [[I:%.*]] = phi i8 [ 0, %[[ENTRY]] ], [ [[O:%.*]], %[[LOOP]] ]2105; CGSCC-NEXT: store i8 1, ptr [[P]], align 12106; CGSCC-NEXT: [[G]] = getelementptr i8, ptr [[P]], i64 12107; CGSCC-NEXT: [[O]] = add nsw i8 [[I]], 12108; CGSCC-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 32109; CGSCC-NEXT: br i1 [[C]], label %[[END:.*]], label %[[LOOP]]2110; CGSCC: [[END]]:2111; CGSCC-NEXT: [[S11:%.*]] = getelementptr i8, ptr @a1, i64 22112; CGSCC-NEXT: [[L11:%.*]] = load i8, ptr [[S11]], align 22113; CGSCC-NEXT: [[S12:%.*]] = getelementptr i8, ptr @a1, i64 32114; CGSCC-NEXT: [[L12:%.*]] = load i8, ptr [[S12]], align 12115; CGSCC-NEXT: [[ADD:%.*]] = add i8 [[L11]], [[L12]]2116; CGSCC-NEXT: ret i8 [[ADD]]2117;2118entry:2119 br label %loop2120loop:2121 %p = phi ptr [@a1, %entry], [%g, %loop]2122 %i = phi i8 [0, %entry], [%o, %loop]2123 store i8 1, ptr %p2124 %g = getelementptr i8, ptr %p, i64 12125 %o = add nsw i8 %i, 12126 %c = icmp eq i8 %o, 32127 br i1 %c, label %end, label %loop2128end:2129 %s11 = getelementptr i8, ptr @a1, i64 22130 %l11 = load i8, ptr %s112131 %s12 = getelementptr i8, ptr @a1, i64 32132 %l12 = load i8, ptr %s122133 %add = add i8 %l11, %l122134 ret i8 %add2135}2136 2137; FIXME: This function returns 1.2138define i8 @phi_no_store_2() {2139;2140; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2141; TUNIT-LABEL: define i8 @phi_no_store_2(2142; TUNIT-SAME: ) #[[ATTR3]] {2143; TUNIT-NEXT: [[ENTRY:.*]]:2144; TUNIT-NEXT: br label %[[LOOP:.*]]2145; TUNIT: [[LOOP]]:2146; TUNIT-NEXT: [[P:%.*]] = phi ptr [ @a2, %[[ENTRY]] ], [ [[G:%.*]], %[[LOOP]] ]2147; TUNIT-NEXT: [[I:%.*]] = phi i8 [ 0, %[[ENTRY]] ], [ [[O:%.*]], %[[LOOP]] ]2148; TUNIT-NEXT: store i8 1, ptr [[P]], align 12149; TUNIT-NEXT: [[G]] = getelementptr i8, ptr @a2, i64 22150; TUNIT-NEXT: [[O]] = add nsw i8 [[I]], 12151; TUNIT-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 72152; TUNIT-NEXT: br i1 [[C]], label %[[END:.*]], label %[[LOOP]]2153; TUNIT: [[END]]:2154; TUNIT-NEXT: [[S21:%.*]] = getelementptr i8, ptr @a2, i64 22155; TUNIT-NEXT: [[L21:%.*]] = load i8, ptr [[S21]], align 22156; TUNIT-NEXT: [[S22:%.*]] = getelementptr i8, ptr @a2, i64 32157; TUNIT-NEXT: [[L22:%.*]] = load i8, ptr [[S22]], align 12158; TUNIT-NEXT: [[ADD:%.*]] = add i8 [[L21]], [[L22]]2159; TUNIT-NEXT: ret i8 [[ADD]]2160;2161; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2162; CGSCC-LABEL: define i8 @phi_no_store_2(2163; CGSCC-SAME: ) #[[ATTR5]] {2164; CGSCC-NEXT: [[ENTRY:.*]]:2165; CGSCC-NEXT: br label %[[LOOP:.*]]2166; CGSCC: [[LOOP]]:2167; CGSCC-NEXT: [[P:%.*]] = phi ptr [ @a2, %[[ENTRY]] ], [ [[G:%.*]], %[[LOOP]] ]2168; CGSCC-NEXT: [[I:%.*]] = phi i8 [ 0, %[[ENTRY]] ], [ [[O:%.*]], %[[LOOP]] ]2169; CGSCC-NEXT: store i8 1, ptr [[P]], align 12170; CGSCC-NEXT: [[G]] = getelementptr i8, ptr @a2, i64 22171; CGSCC-NEXT: [[O]] = add nsw i8 [[I]], 12172; CGSCC-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 72173; CGSCC-NEXT: br i1 [[C]], label %[[END:.*]], label %[[LOOP]]2174; CGSCC: [[END]]:2175; CGSCC-NEXT: [[S21:%.*]] = getelementptr i8, ptr @a2, i64 22176; CGSCC-NEXT: [[L21:%.*]] = load i8, ptr [[S21]], align 22177; CGSCC-NEXT: [[S22:%.*]] = getelementptr i8, ptr @a2, i64 32178; CGSCC-NEXT: [[L22:%.*]] = load i8, ptr [[S22]], align 12179; CGSCC-NEXT: [[ADD:%.*]] = add i8 [[L21]], [[L22]]2180; CGSCC-NEXT: ret i8 [[ADD]]2181;2182entry:2183 br label %loop2184loop:2185 %p = phi ptr [@a2, %entry], [%g, %loop]2186 %i = phi i8 [0, %entry], [%o, %loop]2187 store i8 1, ptr %p2188 %g = getelementptr i8, ptr @a2, i64 22189 %o = add nsw i8 %i, 12190 %c = icmp eq i8 %o, 72191 br i1 %c, label %end, label %loop2192end:2193 %s21 = getelementptr i8, ptr @a2, i64 22194 %l21 = load i8, ptr %s212195 %s22 = getelementptr i8, ptr @a2, i64 32196 %l22 = load i8, ptr %s222197 %add = add i8 %l21, %l222198 ret i8 %add2199}2200 2201define i8 @phi_no_store_3() {2202; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2203; TUNIT-LABEL: define i8 @phi_no_store_3(2204; TUNIT-SAME: ) #[[ATTR3]] {2205; TUNIT-NEXT: [[ENTRY:.*]]:2206; TUNIT-NEXT: [[S30:%.*]] = getelementptr i8, ptr @a3, i64 32207; TUNIT-NEXT: store i8 0, ptr [[S30]], align 12208; TUNIT-NEXT: br label %[[LOOP:.*]]2209; TUNIT: [[LOOP]]:2210; TUNIT-NEXT: [[P:%.*]] = phi ptr [ @a3, %[[ENTRY]] ], [ [[G:%.*]], %[[LOOP]] ]2211; TUNIT-NEXT: [[I:%.*]] = phi i8 [ 0, %[[ENTRY]] ], [ [[O:%.*]], %[[LOOP]] ]2212; TUNIT-NEXT: store i8 1, ptr [[P]], align 12213; TUNIT-NEXT: [[G]] = getelementptr i8, ptr @a3, i64 22214; TUNIT-NEXT: [[O]] = add nsw i8 [[I]], 12215; TUNIT-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 72216; TUNIT-NEXT: br i1 [[C]], label %[[END:.*]], label %[[LOOP]]2217; TUNIT: [[END]]:2218; TUNIT-NEXT: [[S31:%.*]] = getelementptr i8, ptr @a3, i64 22219; TUNIT-NEXT: [[L31:%.*]] = load i8, ptr [[S31]], align 22220; TUNIT-NEXT: [[S32:%.*]] = getelementptr i8, ptr @a3, i64 32221; TUNIT-NEXT: [[L32:%.*]] = load i8, ptr [[S32]], align 12222; TUNIT-NEXT: [[ADD:%.*]] = add i8 [[L31]], [[L32]]2223; TUNIT-NEXT: [[S34:%.*]] = getelementptr i8, ptr @a3, i64 42224; TUNIT-NEXT: [[L34:%.*]] = load i8, ptr [[S34]], align 42225; TUNIT-NEXT: [[ADD2:%.*]] = add i8 [[ADD]], [[L34]]2226; TUNIT-NEXT: ret i8 [[ADD2]]2227;2228; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2229; CGSCC-LABEL: define i8 @phi_no_store_3(2230; CGSCC-SAME: ) #[[ATTR5]] {2231; CGSCC-NEXT: [[ENTRY:.*]]:2232; CGSCC-NEXT: [[S30:%.*]] = getelementptr i8, ptr @a3, i64 32233; CGSCC-NEXT: store i8 0, ptr [[S30]], align 12234; CGSCC-NEXT: br label %[[LOOP:.*]]2235; CGSCC: [[LOOP]]:2236; CGSCC-NEXT: [[P:%.*]] = phi ptr [ @a3, %[[ENTRY]] ], [ [[G:%.*]], %[[LOOP]] ]2237; CGSCC-NEXT: [[I:%.*]] = phi i8 [ 0, %[[ENTRY]] ], [ [[O:%.*]], %[[LOOP]] ]2238; CGSCC-NEXT: store i8 1, ptr [[P]], align 12239; CGSCC-NEXT: [[G]] = getelementptr i8, ptr @a3, i64 22240; CGSCC-NEXT: [[O]] = add nsw i8 [[I]], 12241; CGSCC-NEXT: [[C:%.*]] = icmp eq i8 [[O]], 72242; CGSCC-NEXT: br i1 [[C]], label %[[END:.*]], label %[[LOOP]]2243; CGSCC: [[END]]:2244; CGSCC-NEXT: [[S31:%.*]] = getelementptr i8, ptr @a3, i64 22245; CGSCC-NEXT: [[L31:%.*]] = load i8, ptr [[S31]], align 22246; CGSCC-NEXT: [[S32:%.*]] = getelementptr i8, ptr @a3, i64 32247; CGSCC-NEXT: [[L32:%.*]] = load i8, ptr [[S32]], align 12248; CGSCC-NEXT: [[ADD:%.*]] = add i8 [[L31]], [[L32]]2249; CGSCC-NEXT: [[S34:%.*]] = getelementptr i8, ptr @a3, i64 42250; CGSCC-NEXT: [[L34:%.*]] = load i8, ptr [[S34]], align 42251; CGSCC-NEXT: [[ADD2:%.*]] = add i8 [[ADD]], [[L34]]2252; CGSCC-NEXT: ret i8 [[ADD2]]2253;2254entry:2255 %s30 = getelementptr i8, ptr @a3, i64 32256 store i8 0, ptr %s302257 br label %loop2258loop:2259 %p = phi ptr [@a3, %entry], [%g, %loop]2260 %i = phi i8 [0, %entry], [%o, %loop]2261 store i8 1, ptr %p2262 %g = getelementptr i8, ptr @a3, i64 22263 %o = add nsw i8 %i, 12264 %c = icmp eq i8 %o, 72265 br i1 %c, label %end, label %loop2266end:2267 %s31 = getelementptr i8, ptr @a3, i64 22268 %l31 = load i8, ptr %s312269 %s32 = getelementptr i8, ptr @a3, i64 32270 %l32 = load i8, ptr %s322271 %add = add i8 %l31, %l322272 %s34 = getelementptr i8, ptr @a3, i64 42273 %l34 = load i8, ptr %s342274 %add2 = add i8 %add, %l342275 ret i8 %add22276}2277 2278define i8 @cast_and_load_1() {2279; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2280; TUNIT-LABEL: define i8 @cast_and_load_1(2281; TUNIT-SAME: ) #[[ATTR3]] {2282; TUNIT-NEXT: store i32 42, ptr @bytes1, align 42283; TUNIT-NEXT: [[L:%.*]] = load i8, ptr @bytes1, align 42284; TUNIT-NEXT: ret i8 [[L]]2285;2286; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2287; CGSCC-LABEL: define i8 @cast_and_load_1(2288; CGSCC-SAME: ) #[[ATTR5]] {2289; CGSCC-NEXT: store i32 42, ptr @bytes1, align 42290; CGSCC-NEXT: [[L:%.*]] = load i8, ptr @bytes1, align 42291; CGSCC-NEXT: ret i8 [[L]]2292;2293 store i32 42, ptr @bytes12294 %l = load i8, ptr @bytes12295 ret i8 %l2296}2297 2298define i64 @cast_and_load_2() {2299; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2300; TUNIT-LABEL: define i64 @cast_and_load_2(2301; TUNIT-SAME: ) #[[ATTR3]] {2302; TUNIT-NEXT: store i32 42, ptr @bytes2, align 42303; TUNIT-NEXT: [[L:%.*]] = load i64, ptr @bytes2, align 42304; TUNIT-NEXT: ret i64 [[L]]2305;2306; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn2307; CGSCC-LABEL: define i64 @cast_and_load_2(2308; CGSCC-SAME: ) #[[ATTR5]] {2309; CGSCC-NEXT: store i32 42, ptr @bytes2, align 42310; CGSCC-NEXT: [[L:%.*]] = load i64, ptr @bytes2, align 42311; CGSCC-NEXT: ret i64 [[L]]2312;2313 store i32 42, ptr @bytes22314 %l = load i64, ptr @bytes22315 ret i64 %l2316}2317 2318define void @recursive_load_store(i64 %N, i32 %v) {2319;2320; TUNIT: Function Attrs: nofree norecurse nosync nounwind memory(write)2321; TUNIT-LABEL: define void @recursive_load_store(2322; TUNIT-SAME: i64 [[N:%.*]], i32 [[V:%.*]]) #[[ATTR7:[0-9]+]] {2323; TUNIT-NEXT: [[ENTRY:.*]]:2324; TUNIT-NEXT: br label %[[FOR_COND:.*]]2325; TUNIT: [[FOR_COND]]:2326; TUNIT-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY:.*]] ], [ 0, %[[ENTRY]] ]2327; TUNIT-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], [[N]]2328; TUNIT-NEXT: br i1 [[EXITCOND]], label %[[FOR_BODY]], label %[[FOR_END:.*]]2329; TUNIT: [[FOR_BODY]]:2330; TUNIT-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 12331; TUNIT-NEXT: br label %[[FOR_COND]]2332; TUNIT: [[FOR_END]]:2333; TUNIT-NEXT: ret void2334;2335; CGSCC: Function Attrs: nofree norecurse nosync nounwind memory(write)2336; CGSCC-LABEL: define void @recursive_load_store(2337; CGSCC-SAME: i64 [[N:%.*]], i32 [[V:%.*]]) #[[ATTR8:[0-9]+]] {2338; CGSCC-NEXT: [[ENTRY:.*]]:2339; CGSCC-NEXT: br label %[[FOR_COND:.*]]2340; CGSCC: [[FOR_COND]]:2341; CGSCC-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], %[[FOR_BODY:.*]] ], [ 0, %[[ENTRY]] ]2342; CGSCC-NEXT: [[EXITCOND:%.*]] = icmp ne i64 [[INDVARS_IV]], [[N]]2343; CGSCC-NEXT: br i1 [[EXITCOND]], label %[[FOR_BODY]], label %[[FOR_END:.*]]2344; CGSCC: [[FOR_BODY]]:2345; CGSCC-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 12346; CGSCC-NEXT: br label %[[FOR_COND]]2347; CGSCC: [[FOR_END]]:2348; CGSCC-NEXT: ret void2349;2350entry:2351 store i32 %v, ptr @rec_storage2352 br label %for.cond2353 2354for.cond:2355 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]2356 %exitcond = icmp ne i64 %indvars.iv, %N2357 br i1 %exitcond, label %for.body, label %for.end2358 2359for.body:2360 %ll = load i32, ptr @rec_storage2361 store i32 %ll, ptr @rec_storage2362 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 12363 br label %for.cond2364 2365for.end:2366 %lr = load i32, ptr @rec_storage2367 store i32 %lr, ptr @rec_storage2368 ret void2369}2370 2371define dso_local i32 @round_trip_malloc(i32 %x) {2372; CHECK-LABEL: define dso_local i32 @round_trip_malloc(2373; CHECK-SAME: i32 returned [[X:%.*]]) {2374; CHECK-NEXT: [[ENTRY:.*:]]2375; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 12376; CHECK-NEXT: store i32 [[X]], ptr [[CALL_H2S]], align 42377; CHECK-NEXT: ret i32 [[X]]2378;2379entry:2380 %call = call noalias ptr @malloc(i64 4) norecurse2381 store i32 %x, ptr %call, align 42382 %0 = load i32, ptr %call, align 42383 call void @free(ptr %call) norecurse2384 ret i32 %02385}2386 2387define dso_local i32 @round_trip_malloc_constant() {2388; CHECK-LABEL: define dso_local noundef i32 @round_trip_malloc_constant() {2389; CHECK-NEXT: [[ENTRY:.*:]]2390; CHECK-NEXT: ret i32 72391;2392entry:2393 %call = call noalias ptr @malloc(i64 4) norecurse2394 store i32 7, ptr %call, align 42395 %0 = load i32, ptr %call, align 42396 call void @free(ptr %call) norecurse2397 ret i32 %02398}2399 2400declare noalias ptr @malloc(i64) allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc"2401 2402declare void @free(ptr) allockind("free") "alloc-family"="malloc"2403 2404define dso_local i32 @conditional_malloc(i32 %x) {2405; CHECK-LABEL: define dso_local i32 @conditional_malloc(2406; CHECK-SAME: i32 returned [[X:%.*]]) {2407; CHECK-NEXT: [[ENTRY:.*:]]2408; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 12409; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 02410; CHECK-NEXT: br i1 [[TOBOOL]], label %[[IF_THEN:.*]], label %[[IF_END:.*]]2411; CHECK: [[IF_THEN]]:2412; CHECK-NEXT: store i32 [[X]], ptr [[CALL_H2S]], align 42413; CHECK-NEXT: br label %[[IF_END]]2414; CHECK: [[IF_END]]:2415; CHECK-NEXT: ret i32 [[X]]2416;2417entry:2418 %call = call noalias ptr @malloc(i64 4) norecurse2419 %tobool = icmp ne i32 %x, 02420 br i1 %tobool, label %if.then, label %if.end2421 2422if.then: ; preds = %entry2423 store i32 %x, ptr %call, align 42424 br label %if.end2425 2426if.end: ; preds = %if.then, %entry2427 %0 = load i32, ptr %call, align 42428 ret i32 %02429}2430 2431define dso_local i32 @round_trip_calloc(i32 %x) {2432; CHECK-LABEL: define dso_local i32 @round_trip_calloc(2433; CHECK-SAME: i32 returned [[X:%.*]]) {2434; CHECK-NEXT: [[ENTRY:.*:]]2435; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 12436; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[CALL_H2S]], i8 0, i64 4, i1 false)2437; CHECK-NEXT: store i32 [[X]], ptr [[CALL_H2S]], align 42438; CHECK-NEXT: ret i32 [[X]]2439;2440entry:2441 %call = call noalias ptr @calloc(i64 4, i64 1) norecurse2442 store i32 %x, ptr %call, align 42443 %0 = load i32, ptr %call, align 42444 ret i32 %02445}2446 2447define dso_local i32 @round_trip_calloc_constant() {2448; CHECK-LABEL: define dso_local noundef i32 @round_trip_calloc_constant() {2449; CHECK-NEXT: [[ENTRY:.*:]]2450; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 12451; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[CALL_H2S]], i8 0, i64 4, i1 false)2452; CHECK-NEXT: ret i32 112453;2454entry:2455 %call = call noalias ptr @calloc(i64 4, i64 1) norecurse2456 store i32 11, ptr %call, align 42457 %0 = load i32, ptr %call, align 42458 ret i32 %02459}2460 2461declare noalias ptr @calloc(i64, i64) allockind("alloc,zeroed") allocsize(0, 1) "alloc-family"="malloc"2462 2463define dso_local i32 @conditional_calloc(i32 %x) {2464; CHECK-LABEL: define dso_local i32 @conditional_calloc(2465; CHECK-SAME: i32 [[X:%.*]]) {2466; CHECK-NEXT: [[ENTRY:.*:]]2467; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 12468; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[CALL_H2S]], i8 0, i64 4, i1 false)2469; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 02470; CHECK-NEXT: br i1 [[TOBOOL]], label %[[IF_END:.*]], label %[[IF_THEN:.*]]2471; CHECK: [[IF_THEN]]:2472; CHECK-NEXT: store i32 [[X]], ptr [[CALL_H2S]], align 42473; CHECK-NEXT: br label %[[IF_END]]2474; CHECK: [[IF_END]]:2475; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL_H2S]], align 42476; CHECK-NEXT: ret i32 [[TMP0]]2477;2478entry:2479 %call = call noalias ptr @calloc(i64 1, i64 4) norecurse2480 %tobool = icmp ne i32 %x, 02481 br i1 %tobool, label %if.end, label %if.then2482 2483if.then: ; preds = %entry2484 store i32 %x, ptr %call, align 42485 br label %if.end2486 2487if.end: ; preds = %if.then, %entry2488 %0 = load i32, ptr %call, align 42489 call void @free(ptr %call) norecurse2490 ret i32 %02491}2492 2493define dso_local i32 @conditional_calloc_zero(i1 %c) {2494; CHECK-LABEL: define dso_local noundef i32 @conditional_calloc_zero(2495; CHECK-SAME: i1 [[C:%.*]]) {2496; CHECK-NEXT: [[ENTRY:.*:]]2497; CHECK-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 4, align 12498; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr [[CALL_H2S]], i8 0, i64 4, i1 false)2499; CHECK-NEXT: br i1 [[C]], label %[[IF_END:.*]], label %[[IF_THEN:.*]]2500; CHECK: [[IF_THEN]]:2501; CHECK-NEXT: br label %[[IF_END]]2502; CHECK: [[IF_END]]:2503; CHECK-NEXT: ret i32 02504;2505entry:2506 %call = call noalias ptr @calloc(i64 1, i64 4) norecurse2507 br i1 %c, label %if.end, label %if.then2508 2509if.then: ; preds = %entry2510 store i32 0, ptr %call, align 42511 br label %if.end2512 2513if.end: ; preds = %if.then, %entry2514 %0 = load i32, ptr %call, align 42515 call void @free(ptr %call) norecurse2516 ret i32 %02517}2518 2519define dso_local ptr @malloc_like(i32 %s) {2520; TUNIT-LABEL: define dso_local noalias ptr @malloc_like(2521; TUNIT-SAME: i32 [[S:%.*]]) {2522; TUNIT-NEXT: [[ENTRY:.*:]]2523; TUNIT-NEXT: [[CONV:%.*]] = sext i32 [[S]] to i642524; TUNIT-NEXT: [[CALL:%.*]] = call noalias ptr @malloc(i64 [[CONV]]) #[[ATTR20:[0-9]+]]2525; TUNIT-NEXT: ret ptr [[CALL]]2526;2527; CGSCC-LABEL: define dso_local noalias ptr @malloc_like(2528; CGSCC-SAME: i32 [[S:%.*]]) {2529; CGSCC-NEXT: [[ENTRY:.*:]]2530; CGSCC-NEXT: [[CONV:%.*]] = sext i32 [[S]] to i642531; CGSCC-NEXT: [[CALL:%.*]] = call noalias ptr @malloc(i64 [[CONV]]) #[[ATTR23:[0-9]+]]2532; CGSCC-NEXT: ret ptr [[CALL]]2533;2534entry:2535 %conv = sext i32 %s to i642536 %call = call noalias ptr @malloc(i64 %conv) norecurse2537 ret ptr %call2538}2539 2540define dso_local i32 @round_trip_malloc_like(i32 %x) {2541; TUNIT-LABEL: define dso_local i32 @round_trip_malloc_like(2542; TUNIT-SAME: i32 [[X:%.*]]) {2543; TUNIT-NEXT: [[ENTRY:.*:]]2544; TUNIT-NEXT: [[CALL:%.*]] = call noalias ptr @malloc_like(i32 noundef 4) #[[ATTR20]]2545; TUNIT-NEXT: store i32 [[X]], ptr [[CALL]], align 42546; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 42547; TUNIT-NEXT: call void @free(ptr noundef nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR20]]2548; TUNIT-NEXT: ret i32 [[TMP0]]2549;2550; CGSCC-LABEL: define dso_local i32 @round_trip_malloc_like(2551; CGSCC-SAME: i32 [[X:%.*]]) {2552; CGSCC-NEXT: [[ENTRY:.*:]]2553; CGSCC-NEXT: [[CALL:%.*]] = call noalias ptr @malloc_like(i32 noundef 4) #[[ATTR23]]2554; CGSCC-NEXT: store i32 [[X]], ptr [[CALL]], align 42555; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 42556; CGSCC-NEXT: call void @free(ptr noundef nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR23]]2557; CGSCC-NEXT: ret i32 [[TMP0]]2558;2559entry:2560 %call = call ptr @malloc_like(i32 4) norecurse2561 store i32 %x, ptr %call, align 42562 %0 = load i32, ptr %call, align 42563 call void @free(ptr %call) norecurse2564 ret i32 %02565}2566 2567define dso_local i32 @round_trip_unknown_alloc(i32 %x) {2568; TUNIT-LABEL: define dso_local i32 @round_trip_unknown_alloc(2569; TUNIT-SAME: i32 [[X:%.*]]) {2570; TUNIT-NEXT: [[ENTRY:.*:]]2571; TUNIT-NEXT: [[CALL:%.*]] = call noalias ptr @unknown_alloc(i32 noundef 4) #[[ATTR20]]2572; TUNIT-NEXT: store i32 [[X]], ptr [[CALL]], align 42573; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 42574; TUNIT-NEXT: call void @free(ptr noundef nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR20]]2575; TUNIT-NEXT: ret i32 [[TMP0]]2576;2577; CGSCC-LABEL: define dso_local i32 @round_trip_unknown_alloc(2578; CGSCC-SAME: i32 [[X:%.*]]) {2579; CGSCC-NEXT: [[ENTRY:.*:]]2580; CGSCC-NEXT: [[CALL:%.*]] = call noalias ptr @unknown_alloc(i32 noundef 4) #[[ATTR23]]2581; CGSCC-NEXT: store i32 [[X]], ptr [[CALL]], align 42582; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 42583; CGSCC-NEXT: call void @free(ptr noundef nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR23]]2584; CGSCC-NEXT: ret i32 [[TMP0]]2585;2586entry:2587 %call = call ptr @unknown_alloc(i32 4) norecurse2588 store i32 %x, ptr %call, align 42589 %0 = load i32, ptr %call, align 42590 call void @free(ptr %call) norecurse2591 ret i32 %02592}2593 2594declare noalias ptr @unknown_alloc(i32)2595 2596define dso_local i32 @conditional_unknown_alloc(i32 %x) {2597; TUNIT-LABEL: define dso_local i32 @conditional_unknown_alloc(2598; TUNIT-SAME: i32 [[X:%.*]]) {2599; TUNIT-NEXT: [[ENTRY:.*:]]2600; TUNIT-NEXT: [[CALL:%.*]] = call noalias ptr @unknown_alloc(i32 noundef 4) #[[ATTR20]]2601; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 02602; TUNIT-NEXT: br i1 [[TOBOOL]], label %[[IF_END:.*]], label %[[IF_THEN:.*]]2603; TUNIT: [[IF_THEN]]:2604; TUNIT-NEXT: store i32 [[X]], ptr [[CALL]], align 42605; TUNIT-NEXT: br label %[[IF_END]]2606; TUNIT: [[IF_END]]:2607; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 42608; TUNIT-NEXT: call void @free(ptr nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR20]]2609; TUNIT-NEXT: ret i32 [[TMP0]]2610;2611; CGSCC-LABEL: define dso_local i32 @conditional_unknown_alloc(2612; CGSCC-SAME: i32 [[X:%.*]]) {2613; CGSCC-NEXT: [[ENTRY:.*:]]2614; CGSCC-NEXT: [[CALL:%.*]] = call noalias ptr @unknown_alloc(i32 noundef 4) #[[ATTR23]]2615; CGSCC-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 02616; CGSCC-NEXT: br i1 [[TOBOOL]], label %[[IF_END:.*]], label %[[IF_THEN:.*]]2617; CGSCC: [[IF_THEN]]:2618; CGSCC-NEXT: store i32 [[X]], ptr [[CALL]], align 42619; CGSCC-NEXT: br label %[[IF_END]]2620; CGSCC: [[IF_END]]:2621; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[CALL]], align 42622; CGSCC-NEXT: call void @free(ptr nonnull align 4 dereferenceable(4) [[CALL]]) #[[ATTR23]]2623; CGSCC-NEXT: ret i32 [[TMP0]]2624;2625entry:2626 %call = call noalias ptr @unknown_alloc(i32 4) norecurse2627 %tobool = icmp ne i32 %x, 02628 br i1 %tobool, label %if.end, label %if.then2629 2630if.then: ; preds = %entry2631 store i32 %x, ptr %call, align 42632 br label %if.end2633 2634if.end: ; preds = %if.then, %entry2635 %0 = load i32, ptr %call, align 42636 call void @free(ptr %call) norecurse2637 ret i32 %02638}2639 2640%struct.STy = type { ptr, ptr, ptr }2641 2642@global = internal global %struct.STy zeroinitializer, align 82643 2644; We mark %dst as writeonly and %src as readonly, that is (for now) all we can expect.2645define dso_local void @test_nested_memory(ptr %dst, ptr %src) {2646; TUNIT-LABEL: define dso_local void @test_nested_memory(2647; TUNIT-SAME: ptr nofree writeonly captures(none) [[DST:%.*]], ptr nofree readonly captures(none) [[SRC:%.*]]) {2648; TUNIT-NEXT: [[ENTRY:.*:]]2649; TUNIT-NEXT: [[CALL_H2S:%.*]] = alloca i8, i64 24, align 12650; TUNIT-NEXT: [[LOCAL:%.*]] = alloca [[STRUCT_STY:%.*]], align 82651; TUNIT-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[LOCAL]], i64 0, i32 22652; TUNIT-NEXT: store ptr @global, ptr [[INNER]], align 82653; TUNIT-NEXT: store ptr [[DST]], ptr [[CALL_H2S]], align 82654; TUNIT-NEXT: [[SRC2:%.*]] = getelementptr inbounds i8, ptr [[CALL_H2S]], i64 82655; TUNIT-NEXT: store ptr [[SRC]], ptr [[SRC2]], align 82656; TUNIT-NEXT: store ptr [[CALL_H2S]], ptr getelementptr inbounds ([[STRUCT_STY]], ptr @global, i64 0, i32 2), align 82657; TUNIT-NEXT: [[TMP0:%.*]] = load ptr, ptr [[LOCAL]], align 82658; TUNIT-NEXT: [[LOCAL_B8:%.*]] = getelementptr i8, ptr [[LOCAL]], i64 82659; TUNIT-NEXT: [[TMP1:%.*]] = load ptr, ptr [[LOCAL_B8]], align 82660; TUNIT-NEXT: [[LOCAL_B16:%.*]] = getelementptr i8, ptr [[LOCAL]], i64 162661; TUNIT-NEXT: [[TMP2:%.*]] = load ptr, ptr [[LOCAL_B16]], align 82662; TUNIT-NEXT: call fastcc void @nested_memory_callee(ptr [[TMP0]], ptr [[TMP1]], ptr [[TMP2]]) #[[ATTR21:[0-9]+]]2663; TUNIT-NEXT: ret void2664;2665; CGSCC-LABEL: define dso_local void @test_nested_memory(2666; CGSCC-SAME: ptr nofree [[DST:%.*]], ptr nofree [[SRC:%.*]]) {2667; CGSCC-NEXT: [[ENTRY:.*:]]2668; CGSCC-NEXT: [[LOCAL:%.*]] = alloca [[STRUCT_STY:%.*]], align 82669; CGSCC-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[LOCAL]], i64 0, i32 22670; CGSCC-NEXT: [[CALL:%.*]] = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24)2671; CGSCC-NEXT: store ptr [[DST]], ptr [[CALL]], align 82672; CGSCC-NEXT: [[SRC2:%.*]] = getelementptr inbounds i8, ptr [[CALL]], i64 82673; CGSCC-NEXT: store ptr [[SRC]], ptr [[SRC2]], align 82674; CGSCC-NEXT: store ptr [[CALL]], ptr getelementptr inbounds ([[STRUCT_STY]], ptr @global, i64 0, i32 2), align 82675; CGSCC-NEXT: call fastcc void @nested_memory_callee(ptr nofree align 4294967296 undef, ptr nofree align 4294967296 undef, ptr nofree noundef nonnull align 8 dereferenceable(24) @global) #[[ATTR24:[0-9]+]]2676; CGSCC-NEXT: ret void2677;2678entry:2679 %local = alloca %struct.STy, align 82680 %inner = getelementptr inbounds %struct.STy, ptr %local, i64 0, i32 22681 store ptr @global, ptr %inner, align 82682 %call = call noalias dereferenceable_or_null(24) ptr @malloc(i64 24) #42683 store ptr %dst, ptr %call, align 82684 %src2 = getelementptr inbounds i8, ptr %call, i64 82685 store ptr %src, ptr %src2, align 82686 store ptr %call, ptr getelementptr inbounds (%struct.STy, ptr @global, i64 0, i32 2), align 82687 call fastcc void @nested_memory_callee(ptr nonnull %local)2688 ret void2689}2690 2691define internal fastcc void @nested_memory_callee(ptr nocapture readonly %S) nofree norecurse nounwind uwtable {2692; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn uwtable2693; TUNIT-LABEL: define internal fastcc void @nested_memory_callee(2694; TUNIT-SAME: ptr [[TMP0:%.*]], ptr [[TMP1:%.*]], ptr [[TMP2:%.*]]) #[[ATTR11:[0-9]+]] {2695; TUNIT-NEXT: [[ENTRY:.*:]]2696; TUNIT-NEXT: [[S_PRIV:%.*]] = alloca [[STRUCT_STY:%.*]], align 82697; TUNIT-NEXT: store ptr [[TMP0]], ptr [[S_PRIV]], align 82698; TUNIT-NEXT: [[S_PRIV_B8:%.*]] = getelementptr i8, ptr [[S_PRIV]], i64 82699; TUNIT-NEXT: store ptr [[TMP1]], ptr [[S_PRIV_B8]], align 82700; TUNIT-NEXT: [[S_PRIV_B16:%.*]] = getelementptr i8, ptr [[S_PRIV]], i64 162701; TUNIT-NEXT: store ptr [[TMP2]], ptr [[S_PRIV_B16]], align 82702; TUNIT-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[S_PRIV]], i64 0, i32 22703; TUNIT-NEXT: [[TMP3:%.*]] = load ptr, ptr [[INNER]], align 8, !invariant.load [[META32:![0-9]+]]2704; TUNIT-NEXT: [[INNER1:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[TMP3]], i64 0, i32 22705; TUNIT-NEXT: [[TMP4:%.*]] = load ptr, ptr [[INNER1]], align 8, !invariant.load [[META32]]2706; TUNIT-NEXT: [[SRC:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[TMP4]], i64 0, i32 12707; TUNIT-NEXT: [[TMP5:%.*]] = load ptr, ptr [[SRC]], align 8, !invariant.load [[META32]]2708; TUNIT-NEXT: [[TMP6:%.*]] = load double, ptr [[TMP5]], align 8, !invariant.load [[META32]]2709; TUNIT-NEXT: [[CONV:%.*]] = fptrunc double [[TMP6]] to float2710; TUNIT-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP4]], align 8, !invariant.load [[META32]]2711; TUNIT-NEXT: store float [[CONV]], ptr [[TMP7]], align 42712; TUNIT-NEXT: ret void2713;2714; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn uwtable2715; CGSCC-LABEL: define internal fastcc void @nested_memory_callee(2716; CGSCC-SAME: ptr nofree [[TMP0:%.*]], ptr nofree [[TMP1:%.*]], ptr nofree [[TMP2:%.*]]) #[[ATTR12:[0-9]+]] {2717; CGSCC-NEXT: [[ENTRY:.*:]]2718; CGSCC-NEXT: [[S_PRIV:%.*]] = alloca [[STRUCT_STY:%.*]], align 82719; CGSCC-NEXT: store ptr [[TMP0]], ptr [[S_PRIV]], align 82720; CGSCC-NEXT: [[S_PRIV_B8:%.*]] = getelementptr i8, ptr [[S_PRIV]], i64 82721; CGSCC-NEXT: store ptr [[TMP1]], ptr [[S_PRIV_B8]], align 82722; CGSCC-NEXT: [[S_PRIV_B16:%.*]] = getelementptr i8, ptr [[S_PRIV]], i64 162723; CGSCC-NEXT: store ptr [[TMP2]], ptr [[S_PRIV_B16]], align 82724; CGSCC-NEXT: [[INNER:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[S_PRIV]], i64 0, i32 22725; CGSCC-NEXT: [[TMP3:%.*]] = load ptr, ptr [[INNER]], align 8, !invariant.load [[META32:![0-9]+]]2726; CGSCC-NEXT: [[INNER1:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[TMP3]], i64 0, i32 22727; CGSCC-NEXT: [[TMP4:%.*]] = load ptr, ptr [[INNER1]], align 8, !invariant.load [[META32]]2728; CGSCC-NEXT: [[SRC:%.*]] = getelementptr inbounds [[STRUCT_STY]], ptr [[TMP4]], i64 0, i32 12729; CGSCC-NEXT: [[TMP5:%.*]] = load ptr, ptr [[SRC]], align 8, !invariant.load [[META32]]2730; CGSCC-NEXT: [[TMP6:%.*]] = load double, ptr [[TMP5]], align 8, !invariant.load [[META32]]2731; CGSCC-NEXT: [[CONV:%.*]] = fptrunc double [[TMP6]] to float2732; CGSCC-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP4]], align 8, !invariant.load [[META32]]2733; CGSCC-NEXT: store float [[CONV]], ptr [[TMP7]], align 42734; CGSCC-NEXT: ret void2735;2736entry:2737 %inner = getelementptr inbounds %struct.STy, ptr %S, i64 0, i32 22738 %0 = load ptr, ptr %inner, align 82739 %inner1 = getelementptr inbounds %struct.STy, ptr %0, i64 0, i32 22740 %1 = load ptr, ptr %inner1, align 82741 %src = getelementptr inbounds %struct.STy, ptr %1, i64 0, i32 12742 %2 = load ptr, ptr %src, align 82743 %3 = load double, ptr %2, align 82744 %conv = fptrunc double %3 to float2745 %4 = load ptr, ptr %1, align 82746 store float %conv, ptr %4, align 42747 ret void2748}2749 2750; Make sure the access %1 is not forwarded to the loads %2 and %3 as the indices are2751; varying and the accesses thus not "exact". This used to simplify %cmp12 to true.2752define hidden void @no_propagation_of_unknown_index_access(ptr %in, ptr %out, i32 %idx) #0 {2753; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)2754; TUNIT-LABEL: define hidden void @no_propagation_of_unknown_index_access(2755; TUNIT-SAME: ptr nofree readonly captures(none) [[IN:%.*]], ptr nofree writeonly captures(none) [[OUT:%.*]], i32 [[IDX:%.*]]) #[[ATTR1]] {2756; TUNIT-NEXT: [[ENTRY:.*]]:2757; TUNIT-NEXT: [[BUF:%.*]] = alloca [128 x i32], align 162758; TUNIT-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 16 captures(none) dereferenceable(512) [[BUF]]) #[[ATTR17]]2759; TUNIT-NEXT: br label %[[FOR_COND:.*]]2760; TUNIT: [[FOR_COND]]:2761; TUNIT-NEXT: [[I_0:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ [[INC:%.*]], %[[FOR_BODY:.*]] ]2762; TUNIT-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 1282763; TUNIT-NEXT: br i1 [[CMP]], label %[[FOR_BODY]], label %[[FOR_COND_CLEANUP:.*]]2764; TUNIT: [[FOR_COND_CLEANUP]]:2765; TUNIT-NEXT: br label %[[FOR_COND4:.*]]2766; TUNIT: [[FOR_BODY]]:2767; TUNIT-NEXT: [[IDXPROM:%.*]] = sext i32 [[I_0]] to i642768; TUNIT-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[IN]], i64 [[IDXPROM]]2769; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !invariant.load [[META32]]2770; TUNIT-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM]]2771; TUNIT-NEXT: store i32 [[TMP0]], ptr [[ARRAYIDX2]], align 42772; TUNIT-NEXT: [[INC]] = add nsw i32 [[I_0]], 12773; TUNIT-NEXT: br label %[[FOR_COND]], !llvm.loop [[FLOAT_TBAA10]]2774; TUNIT: [[FOR_COND4]]:2775; TUNIT-NEXT: [[I3_0:%.*]] = phi i32 [ 0, %[[FOR_COND_CLEANUP]] ], [ [[INC16:%.*]], %[[FOR_BODY7:.*]] ]2776; TUNIT-NEXT: [[CMP5:%.*]] = icmp slt i32 [[I3_0]], 1282777; TUNIT-NEXT: br i1 [[CMP5]], label %[[FOR_BODY7]], label %[[FOR_COND_CLEANUP6:.*]]2778; TUNIT: [[FOR_COND_CLEANUP6]]:2779; TUNIT-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 16 captures(none) dereferenceable(512) [[BUF]]) #[[ATTR17]]2780; TUNIT-NEXT: ret void2781; TUNIT: [[FOR_BODY7]]:2782; TUNIT-NEXT: [[IDXPROM8:%.*]] = sext i32 [[I3_0]] to i642783; TUNIT-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM8]]2784; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX9]], align 42785; TUNIT-NEXT: [[IDXPROM10:%.*]] = sext i32 [[IDX]] to i642786; TUNIT-NEXT: [[ARRAYIDX11:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM10]]2787; TUNIT-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARRAYIDX11]], align 42788; TUNIT-NEXT: [[CMP12:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]2789; TUNIT-NEXT: [[CONV:%.*]] = zext i1 [[CMP12]] to i322790; TUNIT-NEXT: [[ARRAYIDX14:%.*]] = getelementptr inbounds i32, ptr [[OUT]], i64 [[IDXPROM8]]2791; TUNIT-NEXT: store i32 [[CONV]], ptr [[ARRAYIDX14]], align 42792; TUNIT-NEXT: [[INC16]] = add nsw i32 [[I3_0]], 12793; TUNIT-NEXT: br label %[[FOR_COND4]], !llvm.loop [[INT_TBAA12]]2794;2795; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)2796; CGSCC-LABEL: define hidden void @no_propagation_of_unknown_index_access(2797; CGSCC-SAME: ptr nofree readonly captures(none) [[IN:%.*]], ptr nofree writeonly captures(none) [[OUT:%.*]], i32 [[IDX:%.*]]) #[[ATTR13:[0-9]+]] {2798; CGSCC-NEXT: [[ENTRY:.*]]:2799; CGSCC-NEXT: [[BUF:%.*]] = alloca [128 x i32], align 162800; CGSCC-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull align 16 captures(none) dereferenceable(512) [[BUF]]) #[[ATTR20]]2801; CGSCC-NEXT: br label %[[FOR_COND:.*]]2802; CGSCC: [[FOR_COND]]:2803; CGSCC-NEXT: [[I_0:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ [[INC:%.*]], %[[FOR_BODY:.*]] ]2804; CGSCC-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 1282805; CGSCC-NEXT: br i1 [[CMP]], label %[[FOR_BODY]], label %[[FOR_COND_CLEANUP:.*]]2806; CGSCC: [[FOR_COND_CLEANUP]]:2807; CGSCC-NEXT: br label %[[FOR_COND4:.*]]2808; CGSCC: [[FOR_BODY]]:2809; CGSCC-NEXT: [[IDXPROM:%.*]] = sext i32 [[I_0]] to i642810; CGSCC-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[IN]], i64 [[IDXPROM]]2811; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4, !invariant.load [[META32]]2812; CGSCC-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM]]2813; CGSCC-NEXT: store i32 [[TMP0]], ptr [[ARRAYIDX2]], align 42814; CGSCC-NEXT: [[INC]] = add nsw i32 [[I_0]], 12815; CGSCC-NEXT: br label %[[FOR_COND]], !llvm.loop [[FLOAT_TBAA10]]2816; CGSCC: [[FOR_COND4]]:2817; CGSCC-NEXT: [[I3_0:%.*]] = phi i32 [ 0, %[[FOR_COND_CLEANUP]] ], [ [[INC16:%.*]], %[[FOR_BODY7:.*]] ]2818; CGSCC-NEXT: [[CMP5:%.*]] = icmp slt i32 [[I3_0]], 1282819; CGSCC-NEXT: br i1 [[CMP5]], label %[[FOR_BODY7]], label %[[FOR_COND_CLEANUP6:.*]]2820; CGSCC: [[FOR_COND_CLEANUP6]]:2821; CGSCC-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull align 16 captures(none) dereferenceable(512) [[BUF]]) #[[ATTR20]]2822; CGSCC-NEXT: ret void2823; CGSCC: [[FOR_BODY7]]:2824; CGSCC-NEXT: [[IDXPROM8:%.*]] = sext i32 [[I3_0]] to i642825; CGSCC-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM8]]2826; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr [[ARRAYIDX9]], align 42827; CGSCC-NEXT: [[IDXPROM10:%.*]] = sext i32 [[IDX]] to i642828; CGSCC-NEXT: [[ARRAYIDX11:%.*]] = getelementptr inbounds [128 x i32], ptr [[BUF]], i64 0, i64 [[IDXPROM10]]2829; CGSCC-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARRAYIDX11]], align 42830; CGSCC-NEXT: [[CMP12:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]2831; CGSCC-NEXT: [[CONV:%.*]] = zext i1 [[CMP12]] to i322832; CGSCC-NEXT: [[ARRAYIDX14:%.*]] = getelementptr inbounds i32, ptr [[OUT]], i64 [[IDXPROM8]]2833; CGSCC-NEXT: store i32 [[CONV]], ptr [[ARRAYIDX14]], align 42834; CGSCC-NEXT: [[INC16]] = add nsw i32 [[I3_0]], 12835; CGSCC-NEXT: br label %[[FOR_COND4]], !llvm.loop [[INT_TBAA12]]2836;2837entry:2838 %buf = alloca [128 x i32], align 162839 call void @llvm.lifetime.start.p0(ptr %buf) #22840 br label %for.cond2841 2842for.cond: ; preds = %for.body, %entry2843 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]2844 %cmp = icmp slt i32 %i.0, 1282845 br i1 %cmp, label %for.body, label %for.cond.cleanup2846 2847for.cond.cleanup: ; preds = %for.cond2848 br label %for.cond42849 2850for.body: ; preds = %for.cond2851 %idxprom = sext i32 %i.0 to i642852 %arrayidx = getelementptr inbounds i32, ptr %in, i64 %idxprom2853 %0 = load i32, ptr %arrayidx, align 42854 %arrayidx2 = getelementptr inbounds [128 x i32], ptr %buf, i64 0, i64 %idxprom2855 store i32 %0, ptr %arrayidx2, align 42856 %inc = add nsw i32 %i.0, 12857 br label %for.cond, !llvm.loop !102858 2859for.cond4: ; preds = %for.body7, %for.cond.cleanup2860 %i3.0 = phi i32 [ 0, %for.cond.cleanup ], [ %inc16, %for.body7 ]2861 %cmp5 = icmp slt i32 %i3.0, 1282862 br i1 %cmp5, label %for.body7, label %for.cond.cleanup62863 2864for.cond.cleanup6: ; preds = %for.cond42865 call void @llvm.lifetime.end.p0(ptr %buf) #22866 ret void2867 2868for.body7: ; preds = %for.cond42869 %idxprom8 = sext i32 %i3.0 to i642870 %arrayidx9 = getelementptr inbounds [128 x i32], ptr %buf, i64 0, i64 %idxprom82871 %1 = load i32, ptr %arrayidx9, align 42872 %idxprom10 = sext i32 %idx to i642873 %arrayidx11 = getelementptr inbounds [128 x i32], ptr %buf, i64 0, i64 %idxprom102874 %2 = load i32, ptr %arrayidx11, align 42875 %cmp12 = icmp sle i32 %1, %22876 %conv = zext i1 %cmp12 to i322877 %arrayidx14 = getelementptr inbounds i32, ptr %out, i64 %idxprom82878 store i32 %conv, ptr %arrayidx14, align 42879 %inc16 = add nsw i32 %i3.0, 12880 br label %for.cond4, !llvm.loop !122881}2882 2883; Ensure we do not return true.2884define internal i1 @alloca_non_unique(ptr %p, i32 %in, i1 %c) {2885; TUNIT: Function Attrs: nofree nosync nounwind memory(argmem: readwrite)2886; TUNIT-LABEL: define internal i1 @alloca_non_unique(2887; TUNIT-SAME: ptr noalias nofree readonly align 4 captures(none) [[P:%.*]], i32 [[IN:%.*]], i1 noundef [[C:%.*]]) #[[ATTR12:[0-9]+]] {2888; TUNIT-NEXT: [[A:%.*]] = alloca i32, align 42889; TUNIT-NEXT: store i32 [[IN]], ptr [[A]], align 42890; TUNIT-NEXT: br i1 [[C]], label %[[T:.*]], label %[[F:.*]]2891; TUNIT: [[T]]:2892; TUNIT-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]], i32 noundef 42, i1 noundef false) #[[ATTR14:[0-9]+]]2893; TUNIT-NEXT: ret i1 [[R]]2894; TUNIT: [[F]]:2895; TUNIT-NEXT: [[L:%.*]] = load i32, ptr [[P]], align 4, !invariant.load [[META32]]2896; TUNIT-NEXT: [[CMP:%.*]] = icmp eq i32 [[IN]], [[L]]2897; TUNIT-NEXT: ret i1 [[CMP]]2898;2899; CGSCC: Function Attrs: nofree nosync nounwind memory(argmem: readwrite)2900; CGSCC-LABEL: define internal i1 @alloca_non_unique(2901; CGSCC-SAME: ptr noalias nofree readonly align 4 captures(none) [[P:%.*]], i32 [[IN:%.*]], i1 noundef [[C:%.*]]) #[[ATTR14:[0-9]+]] {2902; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 42903; CGSCC-NEXT: store i32 [[IN]], ptr [[A]], align 42904; CGSCC-NEXT: br i1 [[C]], label %[[T:.*]], label %[[F:.*]]2905; CGSCC: [[T]]:2906; CGSCC-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]], i32 noundef 42, i1 noundef false) #[[ATTR17:[0-9]+]]2907; CGSCC-NEXT: ret i1 [[R]]2908; CGSCC: [[F]]:2909; CGSCC-NEXT: [[L:%.*]] = load i32, ptr [[P]], align 4, !invariant.load [[META32]]2910; CGSCC-NEXT: [[CMP:%.*]] = icmp eq i32 [[IN]], [[L]]2911; CGSCC-NEXT: ret i1 [[CMP]]2912;2913 %a = alloca i322914 store i32 %in, ptr %a2915 br i1 %c, label %t, label %f2916t:2917 %r = call i1 @alloca_non_unique(ptr %a, i32 42, i1 false)2918 ret i1 %r2919f:2920 %l = load i32, ptr %p2921 %cmp = icmp eq i32 %in, %l2922 ret i1 %cmp2923}2924 2925; Ensure we do not return true.2926define i1 @alloca_non_unique_caller(i32 %in, i1 %c) {2927; TUNIT: Function Attrs: nofree norecurse nosync nounwind memory(none)2928; TUNIT-LABEL: define i1 @alloca_non_unique_caller(2929; TUNIT-SAME: i32 [[IN:%.*]], i1 [[C:%.*]]) #[[ATTR13:[0-9]+]] {2930; TUNIT-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(ptr undef, i32 [[IN]], i1 noundef [[C]]) #[[ATTR14]]2931; TUNIT-NEXT: ret i1 [[R]]2932;2933; CGSCC: Function Attrs: nofree nosync nounwind memory(none)2934; CGSCC-LABEL: define i1 @alloca_non_unique_caller(2935; CGSCC-SAME: i32 [[IN:%.*]], i1 noundef [[C:%.*]]) #[[ATTR15:[0-9]+]] {2936; CGSCC-NEXT: [[R:%.*]] = call i1 @alloca_non_unique(ptr nofree undef, i32 [[IN]], i1 noundef [[C]]) #[[ATTR25:[0-9]+]]2937; CGSCC-NEXT: ret i1 [[R]]2938;2939 %r = call i1 @alloca_non_unique(ptr undef, i32 %in, i1 %c)2940 ret i1 %r2941}2942 2943; Ensure we do not return %bad or %l, but %sel2944define i32 @scope_value_traversal(i32 %bad, i1 %c, i1 %c2) {2945; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2946; TUNIT-LABEL: define i32 @scope_value_traversal(2947; TUNIT-SAME: i32 [[BAD:%.*]], i1 [[C:%.*]], i1 [[C2:%.*]]) #[[ATTR4]] {2948; TUNIT-NEXT: [[A:%.*]] = alloca i32, align 42949; TUNIT-NEXT: store i32 [[BAD]], ptr [[A]], align 42950; TUNIT-NEXT: call void @scope_value_traversal_helper(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[A]], i1 [[C2]]) #[[ATTR22:[0-9]+]]2951; TUNIT-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 42952; TUNIT-NEXT: [[SEL:%.*]] = select i1 [[C]], i32 [[BAD]], i32 [[L]]2953; TUNIT-NEXT: ret i32 [[SEL]]2954;2955; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)2956; CGSCC-LABEL: define i32 @scope_value_traversal(2957; CGSCC-SAME: i32 [[BAD:%.*]], i1 [[C:%.*]], i1 [[C2:%.*]]) #[[ATTR16:[0-9]+]] {2958; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 42959; CGSCC-NEXT: store i32 [[BAD]], ptr [[A]], align 42960; CGSCC-NEXT: call void @scope_value_traversal_helper(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[A]], i1 [[C2]]) #[[ATTR26:[0-9]+]]2961; CGSCC-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 42962; CGSCC-NEXT: [[SEL:%.*]] = select i1 [[C]], i32 [[BAD]], i32 [[L]]2963; CGSCC-NEXT: ret i32 [[SEL]]2964;2965 %a = alloca i322966 store i32 %bad, ptr %a2967 call void @scope_value_traversal_helper(ptr %a, i1 %c2)2968 %l = load i32, ptr %a2969 %sel = select i1 %c, i32 %bad, i32 %l2970 ret i32 %sel2971}2972 2973define void @scope_value_traversal_helper(ptr %a, i1 %c) {2974; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)2975; TUNIT-LABEL: define void @scope_value_traversal_helper(2976; TUNIT-SAME: ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[A:%.*]], i1 [[C:%.*]]) #[[ATTR1]] {2977; TUNIT-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 42978; TUNIT-NEXT: [[SEL:%.*]] = select i1 [[C]], i32 [[L]], i32 422979; TUNIT-NEXT: store i32 [[SEL]], ptr [[A]], align 42980; TUNIT-NEXT: ret void2981;2982; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite)2983; CGSCC-LABEL: define void @scope_value_traversal_helper(2984; CGSCC-SAME: ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[A:%.*]], i1 [[C:%.*]]) #[[ATTR13]] {2985; CGSCC-NEXT: [[L:%.*]] = load i32, ptr [[A]], align 42986; CGSCC-NEXT: [[SEL:%.*]] = select i1 [[C]], i32 [[L]], i32 422987; CGSCC-NEXT: store i32 [[SEL]], ptr [[A]], align 42988; CGSCC-NEXT: ret void2989;2990 %l = load i32, ptr %a2991 %sel = select i1 %c, i32 %l, i32 422992 store i32 %sel, ptr %a2993 ret void2994}2995 2996define i8 @gep_index_from_binary_operator(i1 %cnd1, i1 %cnd2) {2997; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2998; CHECK-LABEL: define noundef i8 @gep_index_from_binary_operator(2999; CHECK-SAME: i1 [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR4]] {3000; CHECK-NEXT: [[ENTRY:.*:]]3001; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 163002; CHECK-NEXT: [[GEP_FIXED:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 123003; CHECK-NEXT: ret i8 1003004;3005entry:3006 %Bytes = alloca [1024 x i8], align 163007 %offset = add i64 5, 73008 %gep.fixed = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 123009 %gep.sum = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %offset3010 store i8 100, ptr %gep.fixed, align 43011 %i = load i8, ptr %gep.sum, align 43012 ret i8 %i3013}3014 3015define i8 @gep_index_from_memory(i1 %cnd1, i1 %cnd2) {3016; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3017; CHECK-LABEL: define i8 @gep_index_from_memory(3018; CHECK-SAME: i1 [[CND1:%.*]], i1 [[CND2:%.*]]) #[[ATTR4]] {3019; CHECK-NEXT: [[ENTRY:.*:]]3020; CHECK-NEXT: [[BYTES:%.*]] = alloca [1024 x i8], align 163021; CHECK-NEXT: [[GEP_LOADED:%.*]] = getelementptr inbounds [1024 x i8], ptr [[BYTES]], i64 0, i64 123022; CHECK-NEXT: ret i8 1003023;3024entry:3025 %Bytes = alloca [1024 x i8], align 163026 %addr = alloca i64, align 163027 store i64 12, ptr %addr, align 83028 %offset = load i64, ptr %addr, align 83029 %gep.fixed = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 123030 3031 %gep.loaded = getelementptr inbounds [1024 x i8], ptr %Bytes, i64 0, i64 %offset3032 store i8 100, ptr %gep.loaded, align 43033 3034 %i = load i8, ptr %gep.fixed, align 43035 ret i8 %i3036}3037 3038@G = internal global i32 0, align 43039 3040; Ensure this is not flattened to return 33041define i32 @a(i1 %c) {3042; TUNIT: Function Attrs: nofree nosync nounwind3043; TUNIT-LABEL: define noundef i32 @a(3044; TUNIT-SAME: i1 noundef [[C:%.*]]) #[[ATTR14]] {3045; TUNIT-NEXT: store i32 3, ptr @G, align 43046; TUNIT-NEXT: br i1 [[C]], label %[[T:.*]], label %[[F:.*]]3047; TUNIT: [[T]]:3048; TUNIT-NEXT: [[REC:%.*]] = call i32 @a(i1 noundef false) #[[ATTR14]]3049; TUNIT-NEXT: br label %[[F]]3050; TUNIT: [[F]]:3051; TUNIT-NEXT: [[R:%.*]] = load i32, ptr @G, align 43052; TUNIT-NEXT: store i32 5, ptr @G, align 43053; TUNIT-NEXT: ret i32 [[R]]3054;3055; CGSCC: Function Attrs: nofree nosync nounwind3056; CGSCC-LABEL: define noundef i32 @a(3057; CGSCC-SAME: i1 noundef [[C:%.*]]) #[[ATTR17]] {3058; CGSCC-NEXT: store i32 3, ptr @G, align 43059; CGSCC-NEXT: br i1 [[C]], label %[[T:.*]], label %[[F:.*]]3060; CGSCC: [[T]]:3061; CGSCC-NEXT: [[REC:%.*]] = call i32 @a(i1 noundef false) #[[ATTR17]]3062; CGSCC-NEXT: br label %[[F]]3063; CGSCC: [[F]]:3064; CGSCC-NEXT: [[R:%.*]] = load i32, ptr @G, align 43065; CGSCC-NEXT: store i32 5, ptr @G, align 43066; CGSCC-NEXT: ret i32 [[R]]3067;3068 store i32 3, ptr @G3069 br i1 %c, label %t, label %f3070 3071t:3072 %rec = call i32 @a(i1 false)3073 br label %f3074 3075f:3076 %r = load i32, ptr @G3077 store i32 5, ptr @G3078 ret i32 %r3079}3080 3081@GC = internal global i32 undef, align 43082define void @atomicrmw(ptr %p, i32 %i, i1 %cnd) {3083; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn3084; TUNIT-LABEL: define void @atomicrmw(3085; TUNIT-SAME: ptr nofree [[P:%.*]], i32 [[I:%.*]], i1 noundef [[CND:%.*]]) #[[ATTR3]] {3086; TUNIT-NEXT: br i1 [[CND]], label %[[T:.*]], label %[[M:.*]]3087; TUNIT: [[T]]:3088; TUNIT-NEXT: br label %[[M]]3089; TUNIT: [[M]]:3090; TUNIT-NEXT: [[ARMW:%.*]] = atomicrmw add ptr @GC, i32 [[I]] monotonic, align 43091; TUNIT-NEXT: ret void3092;3093; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn3094; CGSCC-LABEL: define void @atomicrmw(3095; CGSCC-SAME: ptr nofree [[P:%.*]], i32 [[I:%.*]], i1 noundef [[CND:%.*]]) #[[ATTR5]] {3096; CGSCC-NEXT: br i1 [[CND]], label %[[T:.*]], label %[[M:.*]]3097; CGSCC: [[T]]:3098; CGSCC-NEXT: br label %[[M]]3099; CGSCC: [[M]]:3100; CGSCC-NEXT: [[ARMW:%.*]] = atomicrmw add ptr @GC, i32 [[I]] monotonic, align 43101; CGSCC-NEXT: ret void3102;3103 %alloca = alloca <2 x ptr>3104 %gep1 = getelementptr ptr, ptr %alloca, i32 03105 %gep2 = getelementptr ptr, ptr %alloca, i32 13106 store <2 x ptr> <ptr @GC, ptr @GC>, ptr %alloca3107 br i1 %cnd, label %t, label %m3108t:3109 store ptr null, ptr %gep23110 br label %m3111m:3112 %l1 = load ptr, ptr %gep13113 %l2 = load ptr, ptr %gep23114 %c1 = icmp eq ptr %l2, %p3115 call void @llvm.assume(i1 %c1)3116 %s = select i1 true, ptr %l1, ptr %l23117 %armw = atomicrmw add ptr %s, i32 %i monotonic3118 ret void3119}3120 3121@GRS = internal thread_local global i32 undef3122@GRS2 = global i32 undef3123 3124define i32 @recSimplify(i32 %v, i1 %cond) {3125; TUNIT: Function Attrs: nofree nosync nounwind3126; TUNIT-LABEL: define i32 @recSimplify(3127; TUNIT-SAME: i32 [[V:%.*]], i1 noundef [[COND:%.*]]) #[[ATTR14]] {3128; TUNIT-NEXT: br i1 [[COND]], label %[[REC:.*]], label %[[COMP:.*]]3129; TUNIT: [[REC]]:3130; TUNIT-NEXT: [[RV:%.*]] = call i32 @recSimplify(i32 undef, i1 noundef false) #[[ATTR14]]3131; TUNIT-NEXT: ret i32 13132; TUNIT: [[COMP]]:3133; TUNIT-NEXT: store i32 1, ptr @GRS2, align 43134; TUNIT-NEXT: ret i32 13135;3136; CGSCC: Function Attrs: nofree nosync nounwind3137; CGSCC-LABEL: define i32 @recSimplify(3138; CGSCC-SAME: i32 [[V:%.*]], i1 noundef [[COND:%.*]]) #[[ATTR17]] {3139; CGSCC-NEXT: br i1 [[COND]], label %[[REC:.*]], label %[[COMP:.*]]3140; CGSCC: [[REC]]:3141; CGSCC-NEXT: [[RV:%.*]] = call i32 @recSimplify(i32 [[V]], i1 noundef false) #[[ATTR17]]3142; CGSCC-NEXT: ret i32 [[RV]]3143; CGSCC: [[COMP]]:3144; CGSCC-NEXT: store i32 [[V]], ptr @GRS, align 43145; CGSCC-NEXT: store i32 1, ptr @GRS2, align 43146; CGSCC-NEXT: [[L:%.*]] = load i32, ptr @GRS, align 43147; CGSCC-NEXT: [[C:%.*]] = icmp eq i32 [[L]], 13148; CGSCC-NEXT: call void @llvm.assume(i1 noundef [[C]]) #[[ATTR27:[0-9]+]]3149; CGSCC-NEXT: [[R:%.*]] = call i32 @recSimplify2() #[[ATTR27]]3150; CGSCC-NEXT: ret i32 [[R]]3151;3152 br i1 %cond, label %rec, label %comp3153rec:3154 %rv = call i32 @recSimplify(i32 %v, i1 false)3155 ret i32 %rv3156comp:3157 store i32 %v, ptr @GRS3158 %s1 = select i1 %cond, i32 1, i32 13159 %s2 = select i1 %cond, i32 1, i32 %s13160 store i32 %s2, ptr @GRS23161 %l = load i32, ptr @GRS3162 %c = icmp eq i32 %l, %s23163 call void @llvm.assume(i1 %c)3164 %r = call i32 @recSimplify2()3165 ret i32 %r3166}3167 3168define internal i32 @recSimplify2() {3169; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)3170; CGSCC-LABEL: define internal i32 @recSimplify2(3171; CGSCC-SAME: ) #[[ATTR7]] {3172; CGSCC-NEXT: [[R:%.*]] = load i32, ptr @GRS, align 43173; CGSCC-NEXT: ret i32 [[R]]3174;3175 %r = load i32, ptr @GRS3176 ret i32 %r3177}3178 3179; Verify we do not return 10.3180define i32 @may_access_after_return(i32 noundef %N, i32 noundef %M) {3181; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3182; TUNIT-LABEL: define noundef i32 @may_access_after_return(3183; TUNIT-SAME: i32 noundef [[N:%.*]], i32 noundef [[M:%.*]]) #[[ATTR4]] {3184; TUNIT-NEXT: [[ENTRY:.*:]]3185; TUNIT-NEXT: [[A:%.*]] = alloca i32, align 43186; TUNIT-NEXT: [[B:%.*]] = alloca i32, align 43187; TUNIT-NEXT: call void @write_both(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[A]], ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR18]]3188; TUNIT-NEXT: ret i32 83189;3190; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)3191; CGSCC-LABEL: define i32 @may_access_after_return(3192; CGSCC-SAME: i32 noundef [[N:%.*]], i32 noundef [[M:%.*]]) #[[ATTR16]] {3193; CGSCC-NEXT: [[ENTRY:.*:]]3194; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 43195; CGSCC-NEXT: [[B:%.*]] = alloca i32, align 43196; CGSCC-NEXT: call void @write_both(ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR21]]3197; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[A]], align 43198; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr [[B]], align 43199; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]3200; CGSCC-NEXT: ret i32 [[ADD]]3201;3202entry:3203 %A = alloca i32, align 43204 %B = alloca i32, align 43205 %call = call ptr @passthrough(ptr noundef %A)3206 %call1 = call ptr @passthrough(ptr noundef %B)3207 call void @write_both(ptr noundef %call, ptr noundef %call1)3208 %0 = load i32, ptr %A, align 43209 %1 = load i32, ptr %B, align 43210 %add = add nsw i32 %0, %13211 ret i32 %add3212}3213 3214define internal void @write_both(ptr noundef %Q, ptr noundef %R) {3215; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)3216; CHECK-LABEL: define internal void @write_both(3217; CHECK-SAME: ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[Q:%.*]], ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[R:%.*]]) #[[ATTR0]] {3218; CHECK-NEXT: [[ENTRY:.*:]]3219; CHECK-NEXT: store i32 3, ptr [[Q]], align 43220; CHECK-NEXT: store i32 5, ptr [[R]], align 43221; CHECK-NEXT: ret void3222;3223entry:3224 store i32 3, ptr %Q, align 43225 store i32 5, ptr %R, align 43226 ret void3227}3228 3229define internal ptr @passthrough(ptr noundef %P) {3230; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3231; CGSCC-LABEL: define internal noundef nonnull align 4 dereferenceable(4) ptr @passthrough(3232; CGSCC-SAME: ptr noalias nofree noundef nonnull readnone returned align 4 dereferenceable(4) "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR4]] {3233; CGSCC-NEXT: [[ENTRY:.*:]]3234; CGSCC-NEXT: ret ptr [[P]]3235;3236entry:3237 ret ptr %P3238}3239 3240; Verify we do not return 10.3241define i32 @may_access_after_return_choice(i32 noundef %N, i32 noundef %M, i1 %c) {3242; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3243; TUNIT-LABEL: define noundef i32 @may_access_after_return_choice(3244; TUNIT-SAME: i32 noundef [[N:%.*]], i32 noundef [[M:%.*]], i1 [[C:%.*]]) #[[ATTR4]] {3245; TUNIT-NEXT: [[ENTRY:.*:]]3246; TUNIT-NEXT: [[A:%.*]] = alloca i32, align 43247; TUNIT-NEXT: [[B:%.*]] = alloca i32, align 43248; TUNIT-NEXT: [[CALL:%.*]] = call nonnull align 4 dereferenceable(4) ptr @passthrough_choice(i1 [[C]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) "no-capture-maybe-returned" [[A]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) "no-capture-maybe-returned" [[B]]) #[[ATTR23:[0-9]+]]3249; TUNIT-NEXT: [[CALL1:%.*]] = call nonnull align 4 dereferenceable(4) ptr @passthrough_choice(i1 [[C]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) "no-capture-maybe-returned" [[B]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) "no-capture-maybe-returned" [[A]]) #[[ATTR23]]3250; TUNIT-NEXT: call void @write_both(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[CALL]], ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[CALL1]]) #[[ATTR18]]3251; TUNIT-NEXT: [[TMP0:%.*]] = load i32, ptr [[A]], align 43252; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr [[B]], align 43253; TUNIT-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]3254; TUNIT-NEXT: ret i32 [[ADD]]3255;3256; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn3257; CGSCC-LABEL: define i32 @may_access_after_return_choice(3258; CGSCC-SAME: i32 noundef [[N:%.*]], i32 noundef [[M:%.*]], i1 [[C:%.*]]) #[[ATTR3]] {3259; CGSCC-NEXT: [[ENTRY:.*:]]3260; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 43261; CGSCC-NEXT: [[B:%.*]] = alloca i32, align 43262; CGSCC-NEXT: [[CALL:%.*]] = call nonnull align 4 dereferenceable(4) ptr @passthrough_choice(i1 [[C]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) [[B]]) #[[ATTR28:[0-9]+]]3263; CGSCC-NEXT: [[CALL1:%.*]] = call nonnull align 4 dereferenceable(4) ptr @passthrough_choice(i1 [[C]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) [[B]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) [[A]]) #[[ATTR28]]3264; CGSCC-NEXT: call void @write_both(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[CALL]], ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[CALL1]]) #[[ATTR21]]3265; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[A]], align 43266; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr [[B]], align 43267; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]3268; CGSCC-NEXT: ret i32 [[ADD]]3269;3270entry:3271 %A = alloca i32, align 43272 %B = alloca i32, align 43273 %call = call ptr @passthrough_choice(i1 %c, ptr noundef %A, ptr noundef %B)3274 %call1 = call ptr @passthrough_choice(i1 %c, ptr noundef %B, ptr noundef %A)3275 call void @write_both(ptr noundef %call, ptr noundef %call1)3276 %0 = load i32, ptr %A, align 43277 %1 = load i32, ptr %B, align 43278 %add = add nsw i32 %0, %13279 ret i32 %add3280}3281 3282define internal ptr @passthrough_choice(i1 %c, ptr noundef %P, ptr noundef %Q) {3283; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3284; CHECK-LABEL: define internal noundef nonnull align 4 dereferenceable(4) ptr @passthrough_choice(3285; CHECK-SAME: i1 [[C:%.*]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) "no-capture-maybe-returned" [[P:%.*]], ptr noalias nofree noundef nonnull readnone align 4 dereferenceable(4) "no-capture-maybe-returned" [[Q:%.*]]) #[[ATTR4]] {3286; CHECK-NEXT: [[ENTRY:.*:]]3287; CHECK-NEXT: [[R:%.*]] = select i1 [[C]], ptr [[P]], ptr [[Q]]3288; CHECK-NEXT: ret ptr [[R]]3289;3290entry:3291 %R = select i1 %c, ptr %P, ptr %Q3292 ret ptr %R3293}3294 3295; Verify we do not return 10.3296define i32 @may_access_after_return_no_choice1(i32 noundef %N, i32 noundef %M) {3297; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3298; TUNIT-LABEL: define noundef i32 @may_access_after_return_no_choice1(3299; TUNIT-SAME: i32 noundef [[N:%.*]], i32 noundef [[M:%.*]]) #[[ATTR4]] {3300; TUNIT-NEXT: [[ENTRY:.*:]]3301; TUNIT-NEXT: [[A:%.*]] = alloca i32, align 43302; TUNIT-NEXT: [[B:%.*]] = alloca i32, align 43303; TUNIT-NEXT: call void @write_both(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[A]], ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR18]]3304; TUNIT-NEXT: ret i32 83305;3306; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)3307; CGSCC-LABEL: define i32 @may_access_after_return_no_choice1(3308; CGSCC-SAME: i32 noundef [[N:%.*]], i32 noundef [[M:%.*]]) #[[ATTR16]] {3309; CGSCC-NEXT: [[ENTRY:.*:]]3310; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 43311; CGSCC-NEXT: [[B:%.*]] = alloca i32, align 43312; CGSCC-NEXT: call void @write_both(ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR21]]3313; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[A]], align 43314; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr [[B]], align 43315; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]3316; CGSCC-NEXT: ret i32 [[ADD]]3317;3318entry:3319 %A = alloca i32, align 43320 %B = alloca i32, align 43321 %call = call ptr @passthrough_no_choice_true(i1 true, ptr noundef %A, ptr noundef %B)3322 %call1 = call ptr @passthrough_no_choice_true(i1 true, ptr noundef %B, ptr noundef %A)3323 call void @write_both(ptr noundef %call, ptr noundef %call1)3324 %0 = load i32, ptr %A, align 43325 %1 = load i32, ptr %B, align 43326 %add = add nsw i32 %0, %13327 ret i32 %add3328}3329 3330; Verify we do not return 10.3331define i32 @may_access_after_return_no_choice2(i32 noundef %N, i32 noundef %M) {3332; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3333; TUNIT-LABEL: define noundef i32 @may_access_after_return_no_choice2(3334; TUNIT-SAME: i32 noundef [[N:%.*]], i32 noundef [[M:%.*]]) #[[ATTR4]] {3335; TUNIT-NEXT: [[ENTRY:.*:]]3336; TUNIT-NEXT: [[A:%.*]] = alloca i32, align 43337; TUNIT-NEXT: [[B:%.*]] = alloca i32, align 43338; TUNIT-NEXT: call void @write_both(ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[B]], ptr nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[A]]) #[[ATTR18]]3339; TUNIT-NEXT: ret i32 83340;3341; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)3342; CGSCC-LABEL: define i32 @may_access_after_return_no_choice2(3343; CGSCC-SAME: i32 noundef [[N:%.*]], i32 noundef [[M:%.*]]) #[[ATTR16]] {3344; CGSCC-NEXT: [[ENTRY:.*:]]3345; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 43346; CGSCC-NEXT: [[B:%.*]] = alloca i32, align 43347; CGSCC-NEXT: call void @write_both(ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[B]], ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[A]]) #[[ATTR21]]3348; CGSCC-NEXT: [[TMP0:%.*]] = load i32, ptr [[A]], align 43349; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr [[B]], align 43350; CGSCC-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]3351; CGSCC-NEXT: ret i32 [[ADD]]3352;3353entry:3354 %A = alloca i32, align 43355 %B = alloca i32, align 43356 %call = call ptr @passthrough_no_choice_false(i1 false, ptr noundef %A, ptr noundef %B)3357 %call1 = call ptr @passthrough_no_choice_false(i1 false, ptr noundef %B, ptr noundef %A)3358 call void @write_both(ptr noundef %call, ptr noundef %call1)3359 %0 = load i32, ptr %A, align 43360 %1 = load i32, ptr %B, align 43361 %add = add nsw i32 %0, %13362 ret i32 %add3363}3364 3365define internal ptr @passthrough_no_choice_true(i1 %c, ptr noundef %P, ptr noundef %Q) {3366; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3367; CGSCC-LABEL: define internal noundef nonnull align 4 dereferenceable(4) ptr @passthrough_no_choice_true(3368; CGSCC-SAME: ptr noalias nofree noundef nonnull readnone returned align 4 dereferenceable(4) "no-capture-maybe-returned" [[P:%.*]], i32 [[TMP0:%.*]]) #[[ATTR4]] {3369; CGSCC-NEXT: [[ENTRY:.*:]]3370; CGSCC-NEXT: [[Q_PRIV:%.*]] = alloca i32, align 43371; CGSCC-NEXT: store i32 [[TMP0]], ptr [[Q_PRIV]], align 43372; CGSCC-NEXT: ret ptr [[P]]3373;3374entry:3375 %R = select i1 %c, ptr %P, ptr %Q3376 ret ptr %R3377}3378define internal ptr @passthrough_no_choice_false(i1 %c, ptr noundef %P, ptr noundef %Q) {3379; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3380; CGSCC-LABEL: define internal noundef nonnull align 4 dereferenceable(4) ptr @passthrough_no_choice_false(3381; CGSCC-SAME: i32 [[TMP0:%.*]], ptr noalias nofree noundef nonnull readnone returned align 4 dereferenceable(4) "no-capture-maybe-returned" [[Q:%.*]]) #[[ATTR4]] {3382; CGSCC-NEXT: [[ENTRY:.*:]]3383; CGSCC-NEXT: [[P_PRIV:%.*]] = alloca i32, align 43384; CGSCC-NEXT: store i32 [[TMP0]], ptr [[P_PRIV]], align 43385; CGSCC-NEXT: ret ptr [[Q]]3386;3387entry:3388 %R = select i1 %c, ptr %P, ptr %Q3389 ret ptr %R3390}3391 3392define ptr @move2(ptr %p) {3393; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3394; CHECK-LABEL: define ptr @move2(3395; CHECK-SAME: ptr nofree readnone "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR4]] {3396; CHECK-NEXT: [[G:%.*]] = getelementptr i8, ptr [[P]], i32 23397; CHECK-NEXT: ret ptr [[G]]3398;3399 %g = getelementptr i8, ptr %p, i32 23400 ret ptr %g3401}3402define internal ptr @move4(ptr %p) {3403; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3404; CHECK-LABEL: define internal ptr @move4(3405; CHECK-SAME: ptr noalias nofree readnone "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR4]] {3406; CHECK-NEXT: [[G:%.*]] = getelementptr i8, ptr [[P]], i32 43407; CHECK-NEXT: ret ptr [[G]]3408;3409 %g = getelementptr i8, ptr %p, i32 43410 ret ptr %g3411}3412 3413define ptr @move246(i32 %i, ptr %p) {3414; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)3415; CHECK-LABEL: define ptr @move246(3416; CHECK-SAME: i32 [[I:%.*]], ptr nofree readnone "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR4]] {3417; CHECK-NEXT: [[C0:%.*]] = icmp eq i32 [[I]], 03418; CHECK-NEXT: br i1 [[C0]], label %[[BG2:.*]], label %[[BG46:.*]]3419; CHECK: [[BG2]]:3420; CHECK-NEXT: [[G2:%.*]] = getelementptr i8, ptr [[P]], i32 23421; CHECK-NEXT: ret ptr [[G2]]3422; CHECK: [[BG46]]:3423; CHECK-NEXT: [[C1:%.*]] = icmp eq i32 [[I]], 13424; CHECK-NEXT: br i1 [[C1]], label %[[BG4:.*]], label %[[BG6:.*]]3425; CHECK: [[BG4]]:3426; CHECK-NEXT: [[G4:%.*]] = getelementptr i8, ptr [[P]], i32 43427; CHECK-NEXT: ret ptr [[G4]]3428; CHECK: [[BG6]]:3429; CHECK-NEXT: [[G6:%.*]] = getelementptr i8, ptr [[P]], i32 63430; CHECK-NEXT: ret ptr [[G6]]3431;3432 %c0 = icmp eq i32 %i, 03433 br i1 %c0, label %bg2, label %bg463434bg2:3435 %g2 = getelementptr i8, ptr %p, i32 23436 ret ptr %g23437bg46:3438 %c1 = icmp eq i32 %i, 13439 br i1 %c1, label %bg4, label %bg63440bg4:3441 %g4 = getelementptr i8, ptr %p, i32 43442 ret ptr %g43443bg6:3444 %g6 = getelementptr i8, ptr %p, i32 63445 ret ptr %g63446}3447 3448declare void @use3i8(i8, i8, i8)3449 3450define void @returnedPtrAccesses() {3451; TUNIT-LABEL: define void @returnedPtrAccesses() {3452; TUNIT-NEXT: [[A:%.*]] = alloca i64, align 83453; TUNIT-NEXT: [[A2:%.*]] = call ptr @move2(ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) "no-capture-maybe-returned" [[A]]) #[[ATTR23]]3454; TUNIT-NEXT: [[A4:%.*]] = call ptr @move4(ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) "no-capture-maybe-returned" [[A]]) #[[ATTR23]]3455; TUNIT-NEXT: [[A6:%.*]] = call ptr @move4(ptr noalias nofree readnone "no-capture-maybe-returned" [[A2]]) #[[ATTR23]]3456; TUNIT-NEXT: store i8 2, ptr [[A2]], align 13457; TUNIT-NEXT: store i8 4, ptr [[A4]], align 13458; TUNIT-NEXT: store i8 6, ptr [[A6]], align 13459; TUNIT-NEXT: call void @use3i8(i8 2, i8 4, i8 6)3460; TUNIT-NEXT: ret void3461;3462; CGSCC-LABEL: define void @returnedPtrAccesses() {3463; CGSCC-NEXT: [[A:%.*]] = alloca i64, align 83464; CGSCC-NEXT: [[A2:%.*]] = call nonnull dereferenceable(1) ptr @move2(ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) [[A]]) #[[ATTR20]]3465; CGSCC-NEXT: [[A4:%.*]] = call ptr @move4(ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) [[A]]) #[[ATTR20]]3466; CGSCC-NEXT: [[A6:%.*]] = call ptr @move4(ptr noalias nofree noundef nonnull readnone dereferenceable(1) [[A2]]) #[[ATTR20]]3467; CGSCC-NEXT: [[G2:%.*]] = getelementptr i8, ptr [[A]], i32 23468; CGSCC-NEXT: [[G4:%.*]] = getelementptr i8, ptr [[A]], i32 43469; CGSCC-NEXT: [[G6:%.*]] = getelementptr i8, ptr [[A]], i32 63470; CGSCC-NEXT: store i8 2, ptr [[A2]], align 13471; CGSCC-NEXT: store i8 4, ptr [[A4]], align 13472; CGSCC-NEXT: store i8 6, ptr [[A6]], align 13473; CGSCC-NEXT: [[L2:%.*]] = load i8, ptr [[G2]], align 23474; CGSCC-NEXT: [[L4:%.*]] = load i8, ptr [[G4]], align 43475; CGSCC-NEXT: [[L6:%.*]] = load i8, ptr [[G6]], align 23476; CGSCC-NEXT: call void @use3i8(i8 [[L2]], i8 [[L4]], i8 [[L6]])3477; CGSCC-NEXT: ret void3478;3479 %a = alloca i643480 %a2 = call ptr @move2(ptr %a)3481 %a4 = call ptr @move4(ptr %a)3482 %a6 = call ptr @move4(ptr %a2)3483 %g2 = getelementptr i8, ptr %a, i32 23484 %g4 = getelementptr i8, ptr %a, i32 43485 %g6 = getelementptr i8, ptr %a, i32 63486 store i8 2, ptr %a23487 store i8 4, ptr %a43488 store i8 6, ptr %a63489 %l2 = load i8, ptr %g23490 %l4 = load i8, ptr %g43491 %l6 = load i8, ptr %g63492 call void @use3i8(i8 %l2, i8 %l4, i8 %l6)3493 ret void3494}3495 3496define void @returnedPtrAccessesMultiple(i32 %i) {3497; TUNIT-LABEL: define void @returnedPtrAccessesMultiple(3498; TUNIT-SAME: i32 [[I:%.*]]) {3499; TUNIT-NEXT: [[A:%.*]] = alloca i64, align 83500; TUNIT-NEXT: [[AP:%.*]] = call ptr @move246(i32 [[I]], ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) "no-capture-maybe-returned" [[A]]) #[[ATTR23]]3501; TUNIT-NEXT: store i8 2, ptr [[AP]], align 13502; TUNIT-NEXT: call void @use3i8(i8 2, i8 2, i8 2)3503; TUNIT-NEXT: ret void3504;3505; CGSCC-LABEL: define void @returnedPtrAccessesMultiple(3506; CGSCC-SAME: i32 [[I:%.*]]) {3507; CGSCC-NEXT: [[A:%.*]] = alloca i64, align 83508; CGSCC-NEXT: [[AP:%.*]] = call ptr @move246(i32 [[I]], ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) [[A]]) #[[ATTR20]]3509; CGSCC-NEXT: [[G2:%.*]] = getelementptr i8, ptr [[A]], i32 23510; CGSCC-NEXT: [[G4:%.*]] = getelementptr i8, ptr [[A]], i32 43511; CGSCC-NEXT: [[G6:%.*]] = getelementptr i8, ptr [[A]], i32 63512; CGSCC-NEXT: store i8 2, ptr [[AP]], align 13513; CGSCC-NEXT: [[L2:%.*]] = load i8, ptr [[G2]], align 23514; CGSCC-NEXT: [[L4:%.*]] = load i8, ptr [[G4]], align 43515; CGSCC-NEXT: [[L6:%.*]] = load i8, ptr [[G6]], align 23516; CGSCC-NEXT: call void @use3i8(i8 [[L2]], i8 [[L4]], i8 [[L6]])3517; CGSCC-NEXT: ret void3518;3519 %a = alloca i643520 %ap = call ptr @move246(i32 %i, ptr %a)3521 %g2 = getelementptr i8, ptr %a, i32 23522 %g4 = getelementptr i8, ptr %a, i32 43523 %g6 = getelementptr i8, ptr %a, i32 63524 store i8 2, ptr %ap3525 %l2 = load i8, ptr %g23526 %l4 = load i8, ptr %g43527 %l6 = load i8, ptr %g63528 call void @use3i8(i8 %l2, i8 %l4, i8 %l6)3529 ret void3530}3531 3532define void @returnedPtrAccessesMultiple2(i32 %i) {3533; TUNIT-LABEL: define void @returnedPtrAccessesMultiple2(3534; TUNIT-SAME: i32 [[I:%.*]]) {3535; TUNIT-NEXT: [[A:%.*]] = alloca i64, align 83536; TUNIT-NEXT: [[G2:%.*]] = getelementptr i8, ptr [[A]], i32 23537; TUNIT-NEXT: [[G4:%.*]] = getelementptr i8, ptr [[A]], i32 43538; TUNIT-NEXT: [[G6:%.*]] = getelementptr i8, ptr [[A]], i32 63539; TUNIT-NEXT: store i8 0, ptr [[G2]], align 23540; TUNIT-NEXT: store i8 0, ptr [[G4]], align 43541; TUNIT-NEXT: store i8 0, ptr [[G6]], align 23542; TUNIT-NEXT: [[AP:%.*]] = call ptr @move246(i32 [[I]], ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) "no-capture-maybe-returned" [[A]]) #[[ATTR23]]3543; TUNIT-NEXT: store i8 2, ptr [[AP]], align 13544; TUNIT-NEXT: [[L2:%.*]] = load i8, ptr [[G2]], align 23545; TUNIT-NEXT: [[L4:%.*]] = load i8, ptr [[G4]], align 43546; TUNIT-NEXT: [[L6:%.*]] = load i8, ptr [[G6]], align 23547; TUNIT-NEXT: call void @use3i8(i8 noundef [[L2]], i8 noundef [[L4]], i8 noundef [[L6]])3548; TUNIT-NEXT: ret void3549;3550; CGSCC-LABEL: define void @returnedPtrAccessesMultiple2(3551; CGSCC-SAME: i32 [[I:%.*]]) {3552; CGSCC-NEXT: [[A:%.*]] = alloca i64, align 83553; CGSCC-NEXT: [[G2:%.*]] = getelementptr i8, ptr [[A]], i32 23554; CGSCC-NEXT: [[G4:%.*]] = getelementptr i8, ptr [[A]], i32 43555; CGSCC-NEXT: [[G6:%.*]] = getelementptr i8, ptr [[A]], i32 63556; CGSCC-NEXT: store i8 0, ptr [[G2]], align 23557; CGSCC-NEXT: store i8 0, ptr [[G4]], align 43558; CGSCC-NEXT: store i8 0, ptr [[G6]], align 23559; CGSCC-NEXT: [[AP:%.*]] = call ptr @move246(i32 [[I]], ptr noalias nofree noundef nonnull readnone align 8 dereferenceable(8) [[A]]) #[[ATTR20]]3560; CGSCC-NEXT: store i8 2, ptr [[AP]], align 13561; CGSCC-NEXT: [[L2:%.*]] = load i8, ptr [[G2]], align 23562; CGSCC-NEXT: [[L4:%.*]] = load i8, ptr [[G4]], align 43563; CGSCC-NEXT: [[L6:%.*]] = load i8, ptr [[G6]], align 23564; CGSCC-NEXT: call void @use3i8(i8 [[L2]], i8 [[L4]], i8 [[L6]])3565; CGSCC-NEXT: ret void3566;3567 %a = alloca i643568 %g2 = getelementptr i8, ptr %a, i32 23569 %g4 = getelementptr i8, ptr %a, i32 43570 %g6 = getelementptr i8, ptr %a, i32 63571 store i8 0, ptr %g23572 store i8 0, ptr %g43573 store i8 0, ptr %g63574 %ap = call ptr @move246(i32 %i, ptr %a)3575 store i8 2, ptr %ap3576 %l2 = load i8, ptr %g23577 %l4 = load i8, ptr %g43578 %l6 = load i8, ptr %g63579 call void @use3i8(i8 %l2, i8 %l4, i8 %l6)3580 ret void3581}3582 3583declare void @llvm.assume(i1 noundef)3584 3585 3586!llvm.module.flags = !{!0, !1}3587!llvm.ident = !{!2}3588 3589!0 = !{i32 1, !"wchar_size", i32 4}3590!1 = !{i32 7, !"uwtable", i32 1}3591!2 = !{!"clang version 13.0.0"}3592!3 = !{!4, !4, i64 0}3593!4 = !{!"int", !5, i64 0}3594!5 = !{!"omnipotent char", !6, i64 0}3595!6 = !{!"Simple C/C++ TBAA"}3596!7 = !{!8, !9, i64 12}3597!8 = !{!"S", !4, i64 0, !4, i64 4, !4, i64 8, !9, i64 12, !9, i64 16, !9, i64 20}3598!9 = !{!"float", !5, i64 0}3599!10 = !{!8, !9, i64 16}3600!11 = !{!8, !9, i64 20}3601!12 = !{!8, !4, i64 0}3602!13 = !{!8, !4, i64 4}3603!14 = !{!8, !4, i64 8}3604!15 = !{!5, !5, i64 0}3605!16 = distinct !{!16, !17}3606!17 = !{!"llvm.loop.mustprogress"}3607!18 = !{!9, !9, i64 0}3608!19 = distinct !{!19, !17}3609!20 = !{!21, !21, i64 0}3610!21 = !{!"long long", !5, i64 0}3611!22 = distinct !{!22, !17}3612!23 = distinct !{!23, !17}3613!24 = distinct !{!24, !17}3614!25 = distinct !{!25, !17}3615!26 = distinct !{!26, !17}3616!27 = distinct !{!27, !17}3617!28 = distinct !{!28, !17}3618!29 = distinct !{!29, !17}3619!30 = distinct !{!30, !17}3620!31 = distinct !{!31, !17}3621;.3622; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }3623; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }3624; TUNIT: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }3625; TUNIT: attributes #[[ATTR3]] = { mustprogress nofree norecurse nosync nounwind willreturn }3626; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }3627; TUNIT: attributes #[[ATTR5]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }3628; TUNIT: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }3629; TUNIT: attributes #[[ATTR7]] = { nofree norecurse nosync nounwind memory(write) }3630; TUNIT: attributes #[[ATTR8:[0-9]+]] = { allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" }3631; TUNIT: attributes #[[ATTR9:[0-9]+]] = { allockind("free") "alloc-family"="malloc" }3632; TUNIT: attributes #[[ATTR10:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" }3633; TUNIT: attributes #[[ATTR11]] = { mustprogress nofree norecurse nosync nounwind willreturn uwtable }3634; TUNIT: attributes #[[ATTR12]] = { nofree nosync nounwind memory(argmem: readwrite) }3635; TUNIT: attributes #[[ATTR13]] = { nofree norecurse nosync nounwind memory(none) }3636; TUNIT: attributes #[[ATTR14]] = { nofree nosync nounwind }3637; TUNIT: attributes #[[ATTR15:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }3638; TUNIT: attributes #[[ATTR16:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }3639; TUNIT: attributes #[[ATTR17]] = { nofree willreturn }3640; TUNIT: attributes #[[ATTR18]] = { nofree nosync nounwind willreturn memory(write) }3641; TUNIT: attributes #[[ATTR19]] = { nocallback }3642; TUNIT: attributes #[[ATTR20]] = { norecurse }3643; TUNIT: attributes #[[ATTR21]] = { nounwind }3644; TUNIT: attributes #[[ATTR22]] = { nofree nosync nounwind willreturn }3645; TUNIT: attributes #[[ATTR23]] = { nofree nosync nounwind willreturn memory(none) }3646;.3647; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }3648; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: readwrite) }3649; CGSCC: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }3650; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree nosync nounwind willreturn }3651; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }3652; CGSCC: attributes #[[ATTR5]] = { mustprogress nofree norecurse nosync nounwind willreturn }3653; CGSCC: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }3654; CGSCC: attributes #[[ATTR7]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }3655; CGSCC: attributes #[[ATTR8]] = { nofree norecurse nosync nounwind memory(write) }3656; CGSCC: attributes #[[ATTR9:[0-9]+]] = { allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc" }3657; CGSCC: attributes #[[ATTR10:[0-9]+]] = { allockind("free") "alloc-family"="malloc" }3658; CGSCC: attributes #[[ATTR11:[0-9]+]] = { allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc" }3659; CGSCC: attributes #[[ATTR12]] = { mustprogress nofree norecurse nosync nounwind willreturn uwtable }3660; CGSCC: attributes #[[ATTR13]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) }3661; CGSCC: attributes #[[ATTR14]] = { nofree nosync nounwind memory(argmem: readwrite) }3662; CGSCC: attributes #[[ATTR15]] = { nofree nosync nounwind memory(none) }3663; CGSCC: attributes #[[ATTR16]] = { mustprogress nofree nosync nounwind willreturn memory(none) }3664; CGSCC: attributes #[[ATTR17]] = { nofree nosync nounwind }3665; CGSCC: attributes #[[ATTR18:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }3666; CGSCC: attributes #[[ATTR19:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: write) }3667; CGSCC: attributes #[[ATTR20]] = { nofree willreturn }3668; CGSCC: attributes #[[ATTR21]] = { nofree nounwind willreturn memory(write) }3669; CGSCC: attributes #[[ATTR22]] = { nocallback }3670; CGSCC: attributes #[[ATTR23]] = { norecurse }3671; CGSCC: attributes #[[ATTR24]] = { nounwind }3672; CGSCC: attributes #[[ATTR25]] = { nofree nounwind }3673; CGSCC: attributes #[[ATTR26]] = { nofree nounwind willreturn }3674; CGSCC: attributes #[[ATTR27]] = { nofree }3675; CGSCC: attributes #[[ATTR28]] = { nofree nosync willreturn }3676;.3677; TUNIT: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}3678; TUNIT: [[META1:![0-9]+]] = !{i32 7, !"uwtable", i32 1}3679; TUNIT: [[META2:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}3680; TUNIT: [[INT_TBAA3]] = !{[[META4:![0-9]+]], [[META4]], i64 0}3681; TUNIT: [[META4]] = !{!"int", [[META5:![0-9]+]], i64 0}3682; TUNIT: [[META5]] = !{!"omnipotent char", [[META6:![0-9]+]], i64 0}3683; TUNIT: [[META6]] = !{!"Simple C/C++ TBAA"}3684; TUNIT: [[FLOAT_TBAA7]] = !{[[META8:![0-9]+]], [[META9:![0-9]+]], i64 12}3685; TUNIT: [[META8]] = !{!"S", [[META4]], i64 0, [[META4]], i64 4, [[META4]], i64 8, [[META9]], i64 12, [[META9]], i64 16, [[META9]], i64 20}3686; TUNIT: [[META9]] = !{!"float", [[META5]], i64 0}3687; TUNIT: [[FLOAT_TBAA10]] = !{[[META8]], [[META9]], i64 16}3688; TUNIT: [[FLOAT_TBAA11]] = !{[[META8]], [[META9]], i64 20}3689; TUNIT: [[INT_TBAA12]] = !{[[META8]], [[META4]], i64 0}3690; TUNIT: [[INT_TBAA13]] = !{[[META8]], [[META4]], i64 4}3691; TUNIT: [[INT_TBAA14]] = !{[[META8]], [[META4]], i64 8}3692; TUNIT: [[LOOP15]] = distinct !{[[LOOP15]], [[META16:![0-9]+]]}3693; TUNIT: [[META16]] = !{!"llvm.loop.mustprogress"}3694; TUNIT: [[LOOP17]] = distinct !{[[LOOP17]], [[META16]]}3695; TUNIT: [[LOOP18]] = distinct !{[[LOOP18]], [[META16]]}3696; TUNIT: [[CHAR_TBAA19]] = !{[[META5]], [[META5]], i64 0}3697; TUNIT: [[LOOP20]] = distinct !{[[LOOP20]], [[META16]]}3698; TUNIT: [[LOOP21]] = distinct !{[[LOOP21]], [[META16]]}3699; TUNIT: [[LOOP22]] = distinct !{[[LOOP22]], [[META16]]}3700; TUNIT: [[LOOP23]] = distinct !{[[LOOP23]], [[META16]]}3701; TUNIT: [[LOOP24]] = distinct !{[[LOOP24]], [[META16]]}3702; TUNIT: [[LOOP25]] = distinct !{[[LOOP25]], [[META16]]}3703; TUNIT: [[FLOAT_TBAA26]] = !{[[META9]], [[META9]], i64 0}3704; TUNIT: [[LOOP27]] = distinct !{[[LOOP27]], [[META16]]}3705; TUNIT: [[LONG_LONG_TBAA28]] = !{[[META29:![0-9]+]], [[META29]], i64 0}3706; TUNIT: [[META29]] = !{!"long long", [[META5]], i64 0}3707; TUNIT: [[LOOP30]] = distinct !{[[LOOP30]], [[META16]]}3708; TUNIT: [[LOOP31]] = distinct !{[[LOOP31]], [[META16]]}3709; TUNIT: [[META32]] = !{}3710;.3711; CGSCC: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}3712; CGSCC: [[META1:![0-9]+]] = !{i32 7, !"uwtable", i32 1}3713; CGSCC: [[META2:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}3714; CGSCC: [[INT_TBAA3]] = !{[[META4:![0-9]+]], [[META4]], i64 0}3715; CGSCC: [[META4]] = !{!"int", [[META5:![0-9]+]], i64 0}3716; CGSCC: [[META5]] = !{!"omnipotent char", [[META6:![0-9]+]], i64 0}3717; CGSCC: [[META6]] = !{!"Simple C/C++ TBAA"}3718; CGSCC: [[FLOAT_TBAA7]] = !{[[META8:![0-9]+]], [[META9:![0-9]+]], i64 12}3719; CGSCC: [[META8]] = !{!"S", [[META4]], i64 0, [[META4]], i64 4, [[META4]], i64 8, [[META9]], i64 12, [[META9]], i64 16, [[META9]], i64 20}3720; CGSCC: [[META9]] = !{!"float", [[META5]], i64 0}3721; CGSCC: [[FLOAT_TBAA10]] = !{[[META8]], [[META9]], i64 16}3722; CGSCC: [[FLOAT_TBAA11]] = !{[[META8]], [[META9]], i64 20}3723; CGSCC: [[INT_TBAA12]] = !{[[META8]], [[META4]], i64 0}3724; CGSCC: [[INT_TBAA13]] = !{[[META8]], [[META4]], i64 4}3725; CGSCC: [[INT_TBAA14]] = !{[[META8]], [[META4]], i64 8}3726; CGSCC: [[CHAR_TBAA15]] = !{[[META5]], [[META5]], i64 0}3727; CGSCC: [[LOOP16]] = distinct !{[[LOOP16]], [[META17:![0-9]+]]}3728; CGSCC: [[META17]] = !{!"llvm.loop.mustprogress"}3729; CGSCC: [[FLOAT_TBAA18]] = !{[[META9]], [[META9]], i64 0}3730; CGSCC: [[LOOP19]] = distinct !{[[LOOP19]], [[META17]]}3731; CGSCC: [[LONG_LONG_TBAA20]] = !{[[META21:![0-9]+]], [[META21]], i64 0}3732; CGSCC: [[META21]] = !{!"long long", [[META5]], i64 0}3733; CGSCC: [[LOOP22]] = distinct !{[[LOOP22]], [[META17]]}3734; CGSCC: [[LOOP23]] = distinct !{[[LOOP23]], [[META17]]}3735; CGSCC: [[LOOP24]] = distinct !{[[LOOP24]], [[META17]]}3736; CGSCC: [[LOOP25]] = distinct !{[[LOOP25]], [[META17]]}3737; CGSCC: [[LOOP26]] = distinct !{[[LOOP26]], [[META17]]}3738; CGSCC: [[LOOP27]] = distinct !{[[LOOP27]], [[META17]]}3739; CGSCC: [[LOOP28]] = distinct !{[[LOOP28]], [[META17]]}3740; CGSCC: [[LOOP29]] = distinct !{[[LOOP29]], [[META17]]}3741; CGSCC: [[LOOP30]] = distinct !{[[LOOP30]], [[META17]]}3742; CGSCC: [[LOOP31]] = distinct !{[[LOOP31]], [[META17]]}3743; CGSCC: [[META32]] = !{}3744;.3745