1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals 2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM 3; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM 4; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM 5; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM 6 7target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 8declare void @f(i32) 9declare token @llvm.call.preallocated.setup(i32) 10declare i8* @llvm.call.preallocated.arg(token, i32) 11 12@ConstAS3Ptr = addrspace(3) global i32 0, align 4 13 14;. 15; CHECK: @[[CONSTAS3PTR:[a-zA-Z0-9_$"\\.-]+]] = addrspace(3) global i32 0, align 4 16; CHECK: @[[S:[a-zA-Z0-9_$"\\.-]+]] = external global [[STRUCT_X:%.*]] 17; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal constant { [2 x i8*] } { [2 x i8*] [i8* bitcast (void (i8***)* @f1 to i8*), i8* bitcast (void (i1 (i8*)*)* @f2 to i8*)] } 18;. 19define internal i32 addrspace(3)* @const_ptr_return_as3() { 20; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 21; IS__CGSCC____-LABEL: define {{[^@]+}}@const_ptr_return_as3 22; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] { 23; IS__CGSCC____-NEXT: ret i32 addrspace(3)* undef 24; 25 ret i32 addrspace(3)* @ConstAS3Ptr 26} 27define internal i32* @const_ptr_return() { 28; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 29; IS__CGSCC____-LABEL: define {{[^@]+}}@const_ptr_return 30; IS__CGSCC____-SAME: () #[[ATTR1]] { 31; IS__CGSCC____-NEXT: ret i32* undef 32; 33 ret i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*) 34} 35 36; Test1: Replace argument with constant 37define internal void @test1(i32 %a) { 38; CHECK-LABEL: define {{[^@]+}}@test1() { 39; CHECK-NEXT: tail call void @f(i32 noundef 1) 40; CHECK-NEXT: ret void 41; 42 tail call void @f(i32 %a) 43 ret void 44} 45 46define void @test1_helper() { 47; CHECK-LABEL: define {{[^@]+}}@test1_helper() { 48; CHECK-NEXT: tail call void @test1() 49; CHECK-NEXT: ret void 50; 51 tail call void @test1(i32 1) 52 ret void 53} 54 55; TEST 2 : Simplify return value 56define i32 @return0() { 57; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 58; IS__TUNIT____-LABEL: define {{[^@]+}}@return0 59; IS__TUNIT____-SAME: () #[[ATTR1:[0-9]+]] { 60; IS__TUNIT____-NEXT: ret i32 0 61; 62; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 63; IS__CGSCC____-LABEL: define {{[^@]+}}@return0 64; IS__CGSCC____-SAME: () #[[ATTR1]] { 65; IS__CGSCC____-NEXT: ret i32 0 66; 67 ret i32 0 68} 69 70define i32 @return1() { 71; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 72; IS__TUNIT____-LABEL: define {{[^@]+}}@return1 73; IS__TUNIT____-SAME: () #[[ATTR1]] { 74; IS__TUNIT____-NEXT: ret i32 1 75; 76; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 77; IS__CGSCC____-LABEL: define {{[^@]+}}@return1 78; IS__CGSCC____-SAME: () #[[ATTR1]] { 79; IS__CGSCC____-NEXT: ret i32 1 80; 81 ret i32 1 82} 83 84define i32 @test2_1(i1 %c) { 85; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 86; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_1 87; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { 88; IS__TUNIT____-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] 89; IS__TUNIT____: if.true: 90; IS__TUNIT____-NEXT: [[RET0:%.*]] = add i32 0, 1 91; IS__TUNIT____-NEXT: br label [[END:%.*]] 92; IS__TUNIT____: if.false: 93; IS__TUNIT____-NEXT: br label [[END]] 94; IS__TUNIT____: end: 95; IS__TUNIT____-NEXT: [[RET:%.*]] = phi i32 [ [[RET0]], [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ] 96; IS__TUNIT____-NEXT: ret i32 1 97; 98; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 99; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_1 100; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { 101; IS__CGSCC____-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] 102; IS__CGSCC____: if.true: 103; IS__CGSCC____-NEXT: [[RET0:%.*]] = add i32 0, 1 104; IS__CGSCC____-NEXT: br label [[END:%.*]] 105; IS__CGSCC____: if.false: 106; IS__CGSCC____-NEXT: br label [[END]] 107; IS__CGSCC____: end: 108; IS__CGSCC____-NEXT: [[RET:%.*]] = phi i32 [ [[RET0]], [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ] 109; IS__CGSCC____-NEXT: ret i32 1 110; 111 br i1 %c, label %if.true, label %if.false 112if.true: 113 %call = tail call i32 @return0() 114 %ret0 = add i32 %call, 1 115 br label %end 116if.false: 117 %ret1 = tail call i32 @return1() 118 br label %end 119end: 120 121 %ret = phi i32 [ %ret0, %if.true ], [ %ret1, %if.false ] 122 123 ret i32 1 124} 125 126 127 128define i32 @test2_2(i1 %c) { 129; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 130; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_2 131; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { 132; IS__TUNIT____-NEXT: ret i32 1 133; 134; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 135; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_2 136; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { 137; IS__CGSCC____-NEXT: ret i32 1 138; 139 %ret = tail call i32 @test2_1(i1 %c) 140 ret i32 %ret 141} 142 143declare void @use(i32) 144define void @test3(i1 %c) { 145; CHECK-LABEL: define {{[^@]+}}@test3 146; CHECK-SAME: (i1 [[C:%.*]]) { 147; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] 148; CHECK: if.true: 149; CHECK-NEXT: br label [[END:%.*]] 150; CHECK: if.false: 151; CHECK-NEXT: br label [[END]] 152; CHECK: end: 153; CHECK-NEXT: [[R:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ] 154; CHECK-NEXT: tail call void @use(i32 noundef 1) 155; CHECK-NEXT: ret void 156; 157 br i1 %c, label %if.true, label %if.false 158if.true: 159 br label %end 160if.false: 161 %ret1 = tail call i32 @return1() 162 br label %end 163end: 164 165 %r = phi i32 [ 1, %if.true ], [ %ret1, %if.false ] 166 167 tail call void @use(i32 %r) 168 ret void 169} 170 171define void @test-select-phi(i1 %c) { 172; CHECK-LABEL: define {{[^@]+}}@test-select-phi 173; CHECK-SAME: (i1 [[C:%.*]]) { 174; CHECK-NEXT: tail call void @use(i32 noundef 1) 175; CHECK-NEXT: [[SELECT_NOT_SAME:%.*]] = select i1 [[C]], i32 1, i32 0 176; CHECK-NEXT: tail call void @use(i32 noundef [[SELECT_NOT_SAME]]) 177; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]] 178; CHECK: if-true: 179; CHECK-NEXT: br label [[END:%.*]] 180; CHECK: if-false: 181; CHECK-NEXT: br label [[END]] 182; CHECK: end: 183; CHECK-NEXT: [[PHI_SAME:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ] 184; CHECK-NEXT: [[PHI_NOT_SAME:%.*]] = phi i32 [ 0, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ] 185; CHECK-NEXT: [[PHI_SAME_PROP:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ] 186; CHECK-NEXT: [[PHI_SAME_UNDEF:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ undef, [[IF_FALSE]] ] 187; CHECK-NEXT: [[SELECT_NOT_SAME_UNDEF:%.*]] = select i1 [[C]], i32 [[PHI_NOT_SAME]], i32 undef 188; CHECK-NEXT: tail call void @use(i32 noundef 1) 189; CHECK-NEXT: tail call void @use(i32 noundef [[PHI_NOT_SAME]]) 190; CHECK-NEXT: tail call void @use(i32 noundef 1) 191; CHECK-NEXT: tail call void @use(i32 1) 192; CHECK-NEXT: tail call void @use(i32 [[SELECT_NOT_SAME_UNDEF]]) 193; CHECK-NEXT: ret void 194; 195 %select-same = select i1 %c, i32 1, i32 1 196 tail call void @use(i32 %select-same) 197 198 %select-not-same = select i1 %c, i32 1, i32 0 199 tail call void @use(i32 %select-not-same) 200 br i1 %c, label %if-true, label %if-false 201if-true: 202 br label %end 203if-false: 204 br label %end 205end: 206 %phi-same = phi i32 [ 1, %if-true ], [ 1, %if-false ] 207 %phi-not-same = phi i32 [ 0, %if-true ], [ 1, %if-false ] 208 %phi-same-prop = phi i32 [ 1, %if-true ], [ %select-same, %if-false ] 209 %phi-same-undef = phi i32 [ 1, %if-true ], [ undef, %if-false ] 210 %select-not-same-undef = select i1 %c, i32 %phi-not-same, i32 undef 211 212 213 tail call void @use(i32 %phi-same) 214 215 tail call void @use(i32 %phi-not-same) 216 217 tail call void @use(i32 %phi-same-prop) 218 219 tail call void @use(i32 %phi-same-undef) 220 221 tail call void @use(i32 %select-not-same-undef) 222 223 ret void 224 225} 226 227define i32 @ipccp1(i32 %a) { 228; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 229; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp1 230; IS__TUNIT____-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] { 231; IS__TUNIT____-NEXT: br i1 true, label [[T:%.*]], label [[F:%.*]] 232; IS__TUNIT____: t: 233; IS__TUNIT____-NEXT: ret i32 [[A]] 234; IS__TUNIT____: f: 235; IS__TUNIT____-NEXT: unreachable 236; 237; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 238; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp1 239; IS__CGSCC____-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] { 240; IS__CGSCC____-NEXT: br i1 true, label [[T:%.*]], label [[F:%.*]] 241; IS__CGSCC____: t: 242; IS__CGSCC____-NEXT: ret i32 [[A]] 243; IS__CGSCC____: f: 244; IS__CGSCC____-NEXT: unreachable 245; 246 br i1 true, label %t, label %f 247t: 248 ret i32 %a 249f: 250 %r = call i32 @ipccp1(i32 5) 251 ret i32 %r 252} 253 254define internal i1 @ipccp2i(i1 %a) { 255; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 256; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2i 257; IS__CGSCC____-SAME: () #[[ATTR1]] { 258; IS__CGSCC____-NEXT: br label [[T:%.*]] 259; IS__CGSCC____: t: 260; IS__CGSCC____-NEXT: ret i1 undef 261; IS__CGSCC____: f: 262; IS__CGSCC____-NEXT: unreachable 263; 264 br i1 %a, label %t, label %f 265t: 266 ret i1 %a 267f: 268 %r = call i1 @ipccp2i(i1 false) 269 ret i1 %r 270} 271 272define i1 @ipccp2() { 273; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 274; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp2 275; IS__TUNIT____-SAME: () #[[ATTR1]] { 276; IS__TUNIT____-NEXT: ret i1 true 277; 278; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 279; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2 280; IS__CGSCC____-SAME: () #[[ATTR1]] { 281; IS__CGSCC____-NEXT: ret i1 true 282; 283 %r = call i1 @ipccp2i(i1 true) 284 ret i1 %r 285} 286 287define internal i1 @ipccp2ib(i1 %a) { 288; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 289; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2ib 290; IS__CGSCC____-SAME: () #[[ATTR1]] { 291; IS__CGSCC____-NEXT: br label [[T:%.*]] 292; IS__CGSCC____: t: 293; IS__CGSCC____-NEXT: ret i1 undef 294; IS__CGSCC____: f: 295; IS__CGSCC____-NEXT: unreachable 296; 297 br i1 %a, label %t, label %f 298t: 299 ret i1 true 300f: 301 %r = call i1 @ipccp2ib(i1 false) 302 ret i1 %r 303} 304 305define i1 @ipccp2b() { 306; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 307; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp2b 308; IS__TUNIT____-SAME: () #[[ATTR1]] { 309; IS__TUNIT____-NEXT: ret i1 true 310; 311; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 312; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2b 313; IS__CGSCC____-SAME: () #[[ATTR1]] { 314; IS__CGSCC____-NEXT: ret i1 true 315; 316 %r = call i1 @ipccp2ib(i1 true) 317 ret i1 %r 318} 319 320define internal i32 @ipccp3i(i32 %a) { 321; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 322; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3i 323; IS__CGSCC____-SAME: () #[[ATTR1]] { 324; IS__CGSCC____-NEXT: br label [[T:%.*]] 325; IS__CGSCC____: t: 326; IS__CGSCC____-NEXT: ret i32 undef 327; IS__CGSCC____: f: 328; IS__CGSCC____-NEXT: unreachable 329; 330 %c = icmp eq i32 %a, 7 331 br i1 %c, label %t, label %f 332t: 333 ret i32 %a 334f: 335 %r = call i32 @ipccp3i(i32 5) 336 ret i32 %r 337} 338 339define i32 @ipccp3() { 340; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 341; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp3 342; IS__TUNIT____-SAME: () #[[ATTR1]] { 343; IS__TUNIT____-NEXT: ret i32 7 344; 345; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 346; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3 347; IS__CGSCC____-SAME: () #[[ATTR1]] { 348; IS__CGSCC____-NEXT: ret i32 7 349; 350 %r = call i32 @ipccp3i(i32 7) 351 ret i32 %r 352} 353 354define internal i32 @ipccp4ia(i1 %c) { 355; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 356; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp4ia 357; IS__CGSCC____-SAME: () #[[ATTR1]] { 358; IS__CGSCC____-NEXT: br label [[T:%.*]] 359; IS__CGSCC____: t: 360; IS__CGSCC____-NEXT: ret i32 undef 361; IS__CGSCC____: f: 362; IS__CGSCC____-NEXT: unreachable 363; 364 br i1 %c, label %t, label %f 365t: 366 ret i32 0 367f: 368 ret i32 1 369} 370define internal i32 @ipccp4ib(i32 %a) { 371; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 372; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp4ib 373; IS__CGSCC____-SAME: () #[[ATTR1]] { 374; IS__CGSCC____-NEXT: [[C:%.*]] = icmp eq i32 7, 7 375; IS__CGSCC____-NEXT: br i1 true, label [[T:%.*]], label [[F:%.*]] 376; IS__CGSCC____: t: 377; IS__CGSCC____-NEXT: ret i32 undef 378; IS__CGSCC____: f: 379; IS__CGSCC____-NEXT: unreachable 380; 381 %c = icmp eq i32 %a, 7 382 br i1 %c, label %t, label %f 383t: 384 %r = call i32 @ipccp4ia(i1 %c) 385 ret i32 %r 386f: 387 ret i32 1 388} 389 390define i32 @ipccp4(i1 %c) { 391; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone 392; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp4 393; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR2:[0-9]+]] { 394; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 395; IS__TUNIT____: t: 396; IS__TUNIT____-NEXT: br label [[F]] 397; IS__TUNIT____: f: 398; IS__TUNIT____-NEXT: ret i32 0 399; 400; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 401; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp4 402; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { 403; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 404; IS__CGSCC____: t: 405; IS__CGSCC____-NEXT: br label [[F]] 406; IS__CGSCC____: f: 407; IS__CGSCC____-NEXT: ret i32 0 408; 409 br i1 %c, label %t, label %f 410t: 411 %q = call i32 @ipccp4ia(i1 undef) 412 br label %f 413f: 414 %r = call i32 @ipccp4ib(i32 7) 415 ret i32 %r 416} 417 418; Do not touch complicated arguments (for now) 419%struct.X = type { i8* } 420define internal i32* @test_inalloca(i32* inalloca(i32) %a) { 421; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 422; IS__TUNIT____-LABEL: define {{[^@]+}}@test_inalloca 423; IS__TUNIT____-SAME: (i32* noalias nofree nonnull returned writeonly inalloca(i32) dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] { 424; IS__TUNIT____-NEXT: ret i32* [[A]] 425; 426; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 427; IS__CGSCC____-LABEL: define {{[^@]+}}@test_inalloca 428; IS__CGSCC____-SAME: (i32* noalias nofree noundef nonnull returned writeonly inalloca(i32) dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] { 429; IS__CGSCC____-NEXT: ret i32* [[A]] 430; 431 ret i32* %a 432} 433define i32* @complicated_args_inalloca(i32* %arg) { 434; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 435; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_inalloca 436; IS__TUNIT____-SAME: (i32* nofree readnone returned "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] { 437; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @test_inalloca(i32* noalias nofree writeonly inalloca(i32) "no-capture-maybe-returned" [[ARG]]) #[[ATTR1]] 438; IS__TUNIT____-NEXT: ret i32* [[CALL]] 439; 440; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 441; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_inalloca 442; IS__CGSCC_OPM-SAME: (i32* nofree noundef nonnull readnone returned dereferenceable(4) "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] { 443; IS__CGSCC_OPM-NEXT: [[CALL:%.*]] = call i32* @test_inalloca(i32* noalias nofree noundef nonnull writeonly inalloca(i32) dereferenceable(4) "no-capture-maybe-returned" [[ARG]]) #[[ATTR8:[0-9]+]] 444; IS__CGSCC_OPM-NEXT: ret i32* [[CALL]] 445; 446; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 447; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_inalloca 448; IS__CGSCC_NPM-SAME: (i32* nofree noundef nonnull readnone returned dereferenceable(4) "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] { 449; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32* @test_inalloca(i32* noalias nofree noundef nonnull writeonly inalloca(i32) dereferenceable(4) "no-capture-maybe-returned" [[ARG]]) #[[ATTR7:[0-9]+]] 450; IS__CGSCC_NPM-NEXT: ret i32* [[CALL]] 451; 452 %call = call i32* @test_inalloca(i32* inalloca(i32) %arg) 453 ret i32* %call 454} 455 456define internal i32* @test_preallocated(i32* preallocated(i32) %a) { 457; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 458; IS__TUNIT____-LABEL: define {{[^@]+}}@test_preallocated 459; IS__TUNIT____-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 536870912 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] { 460; IS__TUNIT____-NEXT: ret i32* [[A]] 461; 462; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 463; IS__CGSCC____-LABEL: define {{[^@]+}}@test_preallocated 464; IS__CGSCC____-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 536870912 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] { 465; IS__CGSCC____-NEXT: ret i32* [[A]] 466; 467 ret i32* %a 468} 469define i32* @complicated_args_preallocated() { 470; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn 471; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated 472; IS__TUNIT_OPM-SAME: () #[[ATTR0:[0-9]+]] { 473; IS__TUNIT_OPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR7:[0-9]+]] 474; IS__TUNIT_OPM-NEXT: [[CALL:%.*]] = call i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR1]] [ "preallocated"(token [[C]]) ] 475; IS__TUNIT_OPM-NEXT: ret i32* [[CALL]] 476; 477; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn 478; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated 479; IS__TUNIT_NPM-SAME: () #[[ATTR0:[0-9]+]] { 480; IS__TUNIT_NPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR6:[0-9]+]] 481; IS__TUNIT_NPM-NEXT: [[CALL:%.*]] = call i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR1]] [ "preallocated"(token [[C]]) ] 482; IS__TUNIT_NPM-NEXT: ret i32* [[CALL]] 483; 484; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind willreturn 485; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated 486; IS__CGSCC_OPM-SAME: () #[[ATTR0:[0-9]+]] { 487; IS__CGSCC_OPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR9:[0-9]+]] 488; IS__CGSCC_OPM-NEXT: [[CALL:%.*]] = call i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR10:[0-9]+]] [ "preallocated"(token [[C]]) ] 489; IS__CGSCC_OPM-NEXT: ret i32* [[CALL]] 490; 491; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn 492; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated 493; IS__CGSCC_NPM-SAME: () #[[ATTR0:[0-9]+]] { 494; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR8:[0-9]+]] 495; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR9:[0-9]+]] [ "preallocated"(token [[C]]) ] 496; IS__CGSCC_NPM-NEXT: ret i32* [[CALL]] 497; 498 %c = call token @llvm.call.preallocated.setup(i32 1) 499 %call = call i32* @test_preallocated(i32* preallocated(i32) null) ["preallocated"(token %c)] 500 ret i32* %call 501} 502 503define internal void @test_sret(%struct.X* sret(%struct.X) %a, %struct.X** %b) { 504; 505; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly 506; IS__TUNIT____-LABEL: define {{[^@]+}}@test_sret 507; IS__TUNIT____-SAME: (%struct.X* noalias nofree noundef nonnull writeonly sret([[STRUCT_X:%.*]]) align 536870912 dereferenceable(8) [[A:%.*]], %struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR3:[0-9]+]] { 508; IS__TUNIT____-NEXT: store %struct.X* [[A]], %struct.X** [[B]], align 8 509; IS__TUNIT____-NEXT: ret void 510; 511; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly 512; IS__CGSCC____-LABEL: define {{[^@]+}}@test_sret 513; IS__CGSCC____-SAME: (%struct.X* noalias nofree noundef nonnull writeonly sret([[STRUCT_X:%.*]]) align 536870912 dereferenceable(8) [[A:%.*]], %struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2:[0-9]+]] { 514; IS__CGSCC____-NEXT: store %struct.X* [[A]], %struct.X** [[B]], align 8 515; IS__CGSCC____-NEXT: ret void 516; 517 store %struct.X* %a, %struct.X** %b 518 ret void 519} 520; FIXME: Alignment and dereferenceability are not propagated to the argument 521define void @complicated_args_sret(%struct.X** %b) { 522; 523; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly 524; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_sret 525; IS__TUNIT_OPM-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) #[[ATTR3]] { 526; IS__TUNIT_OPM-NEXT: call void @test_sret(%struct.X* noalias nocapture nofree noundef writeonly sret([[STRUCT_X:%.*]]) align 536870912 null, %struct.X** nocapture nofree writeonly align 8 [[B]]) #[[ATTR6:[0-9]+]] 527; IS__TUNIT_OPM-NEXT: ret void 528; 529; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly 530; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_sret 531; IS__TUNIT_NPM-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) #[[ATTR3]] { 532; IS__TUNIT_NPM-NEXT: call void @test_sret(%struct.X* noalias nocapture nofree noundef writeonly sret([[STRUCT_X:%.*]]) align 536870912 null, %struct.X** nocapture nofree writeonly align 8 [[B]]) #[[ATTR5:[0-9]+]] 533; IS__TUNIT_NPM-NEXT: ret void 534; 535; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly 536; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_sret 537; IS__CGSCC____-SAME: (%struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2]] { 538; IS__CGSCC____-NEXT: unreachable 539; 540 call void @test_sret(%struct.X* sret(%struct.X) null, %struct.X** %b) 541 ret void 542} 543 544define internal %struct.X* @test_nest(%struct.X* nest %a) { 545; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 546; IS__TUNIT____-LABEL: define {{[^@]+}}@test_nest 547; IS__TUNIT____-SAME: (%struct.X* nest noalias nofree noundef readnone returned align 536870912 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] { 548; IS__TUNIT____-NEXT: ret %struct.X* [[A]] 549; 550; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 551; IS__CGSCC____-LABEL: define {{[^@]+}}@test_nest 552; IS__CGSCC____-SAME: (%struct.X* nest noalias nofree noundef readnone returned align 536870912 "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] { 553; IS__CGSCC____-NEXT: ret %struct.X* [[A]] 554; 555 ret %struct.X* %a 556} 557define %struct.X* @complicated_args_nest() { 558; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 559; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_nest 560; IS__TUNIT____-SAME: () #[[ATTR1]] { 561; IS__TUNIT____-NEXT: [[CALL:%.*]] = call %struct.X* @test_nest(%struct.X* noalias nocapture nofree noundef readnone align 536870912 null) #[[ATTR1]] 562; IS__TUNIT____-NEXT: ret %struct.X* [[CALL]] 563; 564; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 565; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_nest 566; IS__CGSCC_OPM-SAME: () #[[ATTR1]] { 567; IS__CGSCC_OPM-NEXT: [[CALL:%.*]] = call %struct.X* @test_nest(%struct.X* noalias nocapture nofree noundef readnone align 536870912 null) #[[ATTR8]] 568; IS__CGSCC_OPM-NEXT: ret %struct.X* [[CALL]] 569; 570; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 571; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_nest 572; IS__CGSCC_NPM-SAME: () #[[ATTR1]] { 573; IS__CGSCC_NPM-NEXT: [[CALL:%.*]] = call %struct.X* @test_nest(%struct.X* noalias nocapture nofree noundef readnone align 536870912 null) #[[ATTR7]] 574; IS__CGSCC_NPM-NEXT: ret %struct.X* [[CALL]] 575; 576 %call = call %struct.X* @test_nest(%struct.X* null) 577 ret %struct.X* %call 578} 579 580@S = external global %struct.X 581define internal void @test_byval(%struct.X* byval(%struct.X) %a) { 582; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 583; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test_byval 584; IS__CGSCC_OPM-SAME: (%struct.X* noalias nocapture nofree noundef nonnull writeonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR1]] { 585; IS__CGSCC_OPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A]], i32 0, i32 0 586; IS__CGSCC_OPM-NEXT: store i8* null, i8** [[G0]], align 8 587; IS__CGSCC_OPM-NEXT: ret void 588; 589; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 590; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_byval 591; IS__CGSCC_NPM-SAME: (i8* noalias nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR1]] { 592; IS__CGSCC_NPM-NEXT: [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8 593; IS__CGSCC_NPM-NEXT: [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8** 594; IS__CGSCC_NPM-NEXT: store i8* [[TMP0]], i8** [[A_PRIV_CAST]], align 8 595; IS__CGSCC_NPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0 596; IS__CGSCC_NPM-NEXT: store i8* null, i8** [[G0]], align 8 597; IS__CGSCC_NPM-NEXT: ret void 598; 599 %g0 = getelementptr %struct.X, %struct.X* %a, i32 0, i32 0 600 store i8* null, i8** %g0 601 ret void 602} 603define void @complicated_args_byval() { 604; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 605; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_byval 606; IS__TUNIT____-SAME: () #[[ATTR1]] { 607; IS__TUNIT____-NEXT: ret void 608; 609; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 610; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval 611; IS__CGSCC_OPM-SAME: () #[[ATTR1]] { 612; IS__CGSCC_OPM-NEXT: ret void 613; 614; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn 615; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_byval 616; IS__CGSCC_NPM-SAME: () #[[ATTR3:[0-9]+]] { 617; IS__CGSCC_NPM-NEXT: ret void 618; 619 call void @test_byval(%struct.X* byval(%struct.X) @S) 620 ret void 621} 622 623define internal i8*@test_byval2(%struct.X* byval(%struct.X) %a) { 624; IS__TUNIT____: Function Attrs: nofree nosync nounwind readonly willreturn 625; IS__TUNIT____-LABEL: define {{[^@]+}}@test_byval2 626; IS__TUNIT____-SAME: () #[[ATTR4:[0-9]+]] { 627; IS__TUNIT____-NEXT: [[L:%.*]] = load i8*, i8** getelementptr inbounds ([[STRUCT_X:%.*]], %struct.X* @S, i32 0, i32 0), align 8 628; IS__TUNIT____-NEXT: ret i8* [[L]] 629; 630; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readonly willreturn 631; IS__CGSCC____-LABEL: define {{[^@]+}}@test_byval2 632; IS__CGSCC____-SAME: () #[[ATTR3:[0-9]+]] { 633; IS__CGSCC____-NEXT: [[L:%.*]] = load i8*, i8** getelementptr inbounds ([[STRUCT_X:%.*]], %struct.X* @S, i32 0, i32 0), align 8 634; IS__CGSCC____-NEXT: ret i8* [[L]] 635; 636 %g0 = getelementptr %struct.X, %struct.X* %a, i32 0, i32 0 637 %l = load i8*, i8** %g0 638 ret i8* %l 639} 640define i8* @complicated_args_byval2() { 641; IS__TUNIT____: Function Attrs: nofree nosync nounwind readonly willreturn 642; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_byval2 643; IS__TUNIT____-SAME: () #[[ATTR4]] { 644; IS__TUNIT____-NEXT: [[C:%.*]] = call i8* @test_byval2() #[[ATTR4]] 645; IS__TUNIT____-NEXT: ret i8* [[C]] 646; 647; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn 648; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval2 649; IS__CGSCC_OPM-SAME: () #[[ATTR3]] { 650; IS__CGSCC_OPM-NEXT: [[C:%.*]] = call i8* @test_byval2() #[[ATTR11:[0-9]+]] 651; IS__CGSCC_OPM-NEXT: ret i8* [[C]] 652; 653; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readonly willreturn 654; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_byval2 655; IS__CGSCC_NPM-SAME: () #[[ATTR3]] { 656; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i8* @test_byval2() #[[ATTR10:[0-9]+]] 657; IS__CGSCC_NPM-NEXT: ret i8* [[C]] 658; 659 %c = call i8* @test_byval2(%struct.X* byval(%struct.X) @S) 660 ret i8* %c 661} 662 663define void @fixpoint_changed(i32* %p) { 664; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind writeonly 665; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@fixpoint_changed 666; IS__TUNIT_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR5:[0-9]+]] { 667; IS__TUNIT_OPM-NEXT: entry: 668; IS__TUNIT_OPM-NEXT: br label [[FOR_COND:%.*]] 669; IS__TUNIT_OPM: for.cond: 670; IS__TUNIT_OPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ] 671; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30 672; IS__TUNIT_OPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] 673; IS__TUNIT_OPM: for.body: 674; IS__TUNIT_OPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [ 675; IS__TUNIT_OPM-NEXT: i32 1, label [[SW_BB:%.*]] 676; IS__TUNIT_OPM-NEXT: ] 677; IS__TUNIT_OPM: sw.bb: 678; IS__TUNIT_OPM-NEXT: br label [[SW_EPILOG]] 679; IS__TUNIT_OPM: sw.epilog: 680; IS__TUNIT_OPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ] 681; IS__TUNIT_OPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4 682; IS__TUNIT_OPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1 683; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]] 684; IS__TUNIT_OPM: for.end: 685; IS__TUNIT_OPM-NEXT: ret void 686; 687; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly 688; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@fixpoint_changed 689; IS__TUNIT_NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR3]] { 690; IS__TUNIT_NPM-NEXT: entry: 691; IS__TUNIT_NPM-NEXT: br label [[FOR_COND:%.*]] 692; IS__TUNIT_NPM: for.cond: 693; IS__TUNIT_NPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ] 694; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30 695; IS__TUNIT_NPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] 696; IS__TUNIT_NPM: for.body: 697; IS__TUNIT_NPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [ 698; IS__TUNIT_NPM-NEXT: i32 1, label [[SW_BB:%.*]] 699; IS__TUNIT_NPM-NEXT: ] 700; IS__TUNIT_NPM: sw.bb: 701; IS__TUNIT_NPM-NEXT: br label [[SW_EPILOG]] 702; IS__TUNIT_NPM: sw.epilog: 703; IS__TUNIT_NPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ] 704; IS__TUNIT_NPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4 705; IS__TUNIT_NPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1 706; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]] 707; IS__TUNIT_NPM: for.end: 708; IS__TUNIT_NPM-NEXT: ret void 709; 710; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind writeonly 711; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@fixpoint_changed 712; IS__CGSCC_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR4:[0-9]+]] { 713; IS__CGSCC_OPM-NEXT: entry: 714; IS__CGSCC_OPM-NEXT: br label [[FOR_COND:%.*]] 715; IS__CGSCC_OPM: for.cond: 716; IS__CGSCC_OPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ] 717; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30 718; IS__CGSCC_OPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] 719; IS__CGSCC_OPM: for.body: 720; IS__CGSCC_OPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [ 721; IS__CGSCC_OPM-NEXT: i32 1, label [[SW_BB:%.*]] 722; IS__CGSCC_OPM-NEXT: ] 723; IS__CGSCC_OPM: sw.bb: 724; IS__CGSCC_OPM-NEXT: br label [[SW_EPILOG]] 725; IS__CGSCC_OPM: sw.epilog: 726; IS__CGSCC_OPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ] 727; IS__CGSCC_OPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4 728; IS__CGSCC_OPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1 729; IS__CGSCC_OPM-NEXT: br label [[FOR_COND]] 730; IS__CGSCC_OPM: for.end: 731; IS__CGSCC_OPM-NEXT: ret void 732; 733; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly 734; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@fixpoint_changed 735; IS__CGSCC_NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR2]] { 736; IS__CGSCC_NPM-NEXT: entry: 737; IS__CGSCC_NPM-NEXT: br label [[FOR_COND:%.*]] 738; IS__CGSCC_NPM: for.cond: 739; IS__CGSCC_NPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ] 740; IS__CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30 741; IS__CGSCC_NPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]] 742; IS__CGSCC_NPM: for.body: 743; IS__CGSCC_NPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [ 744; IS__CGSCC_NPM-NEXT: i32 1, label [[SW_BB:%.*]] 745; IS__CGSCC_NPM-NEXT: ] 746; IS__CGSCC_NPM: sw.bb: 747; IS__CGSCC_NPM-NEXT: br label [[SW_EPILOG]] 748; IS__CGSCC_NPM: sw.epilog: 749; IS__CGSCC_NPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ] 750; IS__CGSCC_NPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4 751; IS__CGSCC_NPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1 752; IS__CGSCC_NPM-NEXT: br label [[FOR_COND]] 753; IS__CGSCC_NPM: for.end: 754; IS__CGSCC_NPM-NEXT: ret void 755; 756entry: 757 br label %for.cond 758 759for.cond: 760 %j.0 = phi i32 [ 0, %entry ], [ %inc, %sw.epilog ] 761 %cmp = icmp slt i32 %j.0, 30 762 br i1 %cmp, label %for.body, label %for.end 763 764for.body: 765 switch i32 %j.0, label %sw.epilog [ 766 i32 1, label %sw.bb 767 ] 768 769sw.bb: 770 br label %sw.epilog 771 772sw.epilog: 773 %x.0 = phi i32 [ 255, %for.body ], [ 253, %sw.bb ] 774 store i32 %x.0, i32* %p 775 %inc = add nsw i32 %j.0, 1 776 br label %for.cond 777 778for.end: 779 ret void 780} 781 782; Check we merge undef and a constant properly. 783define i8 @caller0() { 784; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 785; IS__TUNIT____-LABEL: define {{[^@]+}}@caller0 786; IS__TUNIT____-SAME: () #[[ATTR1]] { 787; IS__TUNIT____-NEXT: ret i8 49 788; 789; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 790; IS__CGSCC____-LABEL: define {{[^@]+}}@caller0 791; IS__CGSCC____-SAME: () #[[ATTR1]] { 792; IS__CGSCC____-NEXT: ret i8 49 793; 794 %c = call i8 @callee(i8 undef) 795 ret i8 %c 796} 797define i8 @caller1() { 798; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 799; IS__TUNIT____-LABEL: define {{[^@]+}}@caller1 800; IS__TUNIT____-SAME: () #[[ATTR1]] { 801; IS__TUNIT____-NEXT: ret i8 49 802; 803; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 804; IS__CGSCC____-LABEL: define {{[^@]+}}@caller1 805; IS__CGSCC____-SAME: () #[[ATTR1]] { 806; IS__CGSCC____-NEXT: ret i8 49 807; 808 %c = call i8 @callee(i8 undef) 809 ret i8 %c 810} 811define i8 @caller2() { 812; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 813; IS__TUNIT____-LABEL: define {{[^@]+}}@caller2 814; IS__TUNIT____-SAME: () #[[ATTR1]] { 815; IS__TUNIT____-NEXT: ret i8 49 816; 817; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 818; IS__CGSCC____-LABEL: define {{[^@]+}}@caller2 819; IS__CGSCC____-SAME: () #[[ATTR1]] { 820; IS__CGSCC____-NEXT: ret i8 49 821; 822 %c = call i8 @callee(i8 undef) 823 ret i8 %c 824} 825define i8 @caller_middle() { 826; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 827; IS__TUNIT____-LABEL: define {{[^@]+}}@caller_middle 828; IS__TUNIT____-SAME: () #[[ATTR1]] { 829; IS__TUNIT____-NEXT: ret i8 49 830; 831; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 832; IS__CGSCC____-LABEL: define {{[^@]+}}@caller_middle 833; IS__CGSCC____-SAME: () #[[ATTR1]] { 834; IS__CGSCC____-NEXT: ret i8 49 835; 836 %c = call i8 @callee(i8 42) 837 ret i8 %c 838} 839define i8 @caller3() { 840; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 841; IS__TUNIT____-LABEL: define {{[^@]+}}@caller3 842; IS__TUNIT____-SAME: () #[[ATTR1]] { 843; IS__TUNIT____-NEXT: ret i8 49 844; 845; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 846; IS__CGSCC____-LABEL: define {{[^@]+}}@caller3 847; IS__CGSCC____-SAME: () #[[ATTR1]] { 848; IS__CGSCC____-NEXT: ret i8 49 849; 850 %c = call i8 @callee(i8 undef) 851 ret i8 %c 852} 853define i8 @caller4() { 854; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 855; IS__TUNIT____-LABEL: define {{[^@]+}}@caller4 856; IS__TUNIT____-SAME: () #[[ATTR1]] { 857; IS__TUNIT____-NEXT: ret i8 49 858; 859; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 860; IS__CGSCC____-LABEL: define {{[^@]+}}@caller4 861; IS__CGSCC____-SAME: () #[[ATTR1]] { 862; IS__CGSCC____-NEXT: ret i8 49 863; 864 %c = call i8 @callee(i8 undef) 865 ret i8 %c 866} 867define internal i8 @callee(i8 %a) { 868; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 869; IS__CGSCC____-LABEL: define {{[^@]+}}@callee 870; IS__CGSCC____-SAME: () #[[ATTR1]] { 871; IS__CGSCC____-NEXT: ret i8 undef 872; 873 %c = add i8 %a, 7 874 ret i8 %c 875} 876 877define void @user_as3() { 878; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn writeonly 879; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@user_as3 880; IS__TUNIT_OPM-SAME: () #[[ATTR6]] { 881; IS__TUNIT_OPM-NEXT: store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4 882; IS__TUNIT_OPM-NEXT: ret void 883; 884; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn writeonly 885; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@user_as3 886; IS__TUNIT_NPM-SAME: () #[[ATTR5]] { 887; IS__TUNIT_NPM-NEXT: store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4 888; IS__TUNIT_NPM-NEXT: ret void 889; 890; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly 891; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@user_as3 892; IS__CGSCC_OPM-SAME: () #[[ATTR5:[0-9]+]] { 893; IS__CGSCC_OPM-NEXT: store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4 894; IS__CGSCC_OPM-NEXT: ret void 895; 896; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly 897; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@user_as3 898; IS__CGSCC_NPM-SAME: () #[[ATTR4:[0-9]+]] { 899; IS__CGSCC_NPM-NEXT: store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4 900; IS__CGSCC_NPM-NEXT: ret void 901; 902 %call = call fastcc i32 addrspace(3)* @const_ptr_return_as3() 903 store i32 0, i32 addrspace(3)* %call 904 ret void 905} 906define void @user() { 907; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn writeonly 908; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@user 909; IS__TUNIT_OPM-SAME: () #[[ATTR6]] { 910; IS__TUNIT_OPM-NEXT: store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4 911; IS__TUNIT_OPM-NEXT: ret void 912; 913; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn writeonly 914; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@user 915; IS__TUNIT_NPM-SAME: () #[[ATTR5]] { 916; IS__TUNIT_NPM-NEXT: store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4 917; IS__TUNIT_NPM-NEXT: ret void 918; 919; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly 920; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@user 921; IS__CGSCC_OPM-SAME: () #[[ATTR5]] { 922; IS__CGSCC_OPM-NEXT: store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4 923; IS__CGSCC_OPM-NEXT: ret void 924; 925; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly 926; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@user 927; IS__CGSCC_NPM-SAME: () #[[ATTR4]] { 928; IS__CGSCC_NPM-NEXT: store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4 929; IS__CGSCC_NPM-NEXT: ret void 930; 931 %call = call fastcc i32* @const_ptr_return() 932 store i32 0, i32* %call 933 ret void 934} 935 936 937define i1 @test_merge_with_undef_values_ptr(i1 %c) { 938; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone 939; IS__TUNIT____-LABEL: define {{[^@]+}}@test_merge_with_undef_values_ptr 940; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR2]] { 941; IS__TUNIT____-NEXT: [[R1:%.*]] = call i1 @undef_then_null(i1 [[C]]) #[[ATTR2]] 942; IS__TUNIT____-NEXT: ret i1 [[R1]] 943; 944; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone 945; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test_merge_with_undef_values_ptr 946; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR6:[0-9]+]] { 947; IS__CGSCC_OPM-NEXT: [[R1:%.*]] = call noundef i1 @undef_then_null(i1 [[C]]) #[[ATTR12:[0-9]+]] 948; IS__CGSCC_OPM-NEXT: ret i1 [[R1]] 949; 950; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone 951; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_merge_with_undef_values_ptr 952; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR5:[0-9]+]] { 953; IS__CGSCC_NPM-NEXT: [[R1:%.*]] = call noundef i1 @undef_then_null(i1 [[C]]) #[[ATTR11:[0-9]+]] 954; IS__CGSCC_NPM-NEXT: ret i1 [[R1]] 955; 956 %r1 = call i1 @undef_then_null(i1 %c, i32* undef, i32* undef) 957 ret i1 %r1 958} 959define internal i1 @undef_then_null(i1 %c, i32* %i32Aptr, i32* %i32Bptr) { 960; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone 961; IS__TUNIT____-LABEL: define {{[^@]+}}@undef_then_null 962; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR2]] { 963; IS__TUNIT____-NEXT: [[CMP1:%.*]] = icmp eq i32* null, null 964; IS__TUNIT____-NEXT: [[CMP2:%.*]] = icmp eq i1 [[CMP1]], false 965; IS__TUNIT____-NEXT: [[OR:%.*]] = or i1 [[CMP2]], [[C]] 966; IS__TUNIT____-NEXT: br i1 [[OR]], label [[A:%.*]], label [[B:%.*]] 967; IS__TUNIT____: a: 968; IS__TUNIT____-NEXT: [[R2:%.*]] = call i1 @undef_then_null(i1 noundef false) #[[ATTR2]] 969; IS__TUNIT____-NEXT: ret i1 [[R2]] 970; IS__TUNIT____: b: 971; IS__TUNIT____-NEXT: ret i1 [[CMP2]] 972; 973; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone 974; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@undef_then_null 975; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR6]] { 976; IS__CGSCC_OPM-NEXT: [[CMP1:%.*]] = icmp eq i32* null, null 977; IS__CGSCC_OPM-NEXT: [[CMP2:%.*]] = icmp eq i1 [[CMP1]], false 978; IS__CGSCC_OPM-NEXT: [[OR:%.*]] = or i1 [[CMP2]], [[C]] 979; IS__CGSCC_OPM-NEXT: br i1 [[OR]], label [[A:%.*]], label [[B:%.*]] 980; IS__CGSCC_OPM: a: 981; IS__CGSCC_OPM-NEXT: [[R2:%.*]] = call noundef i1 @undef_then_null(i1 noundef false) #[[ATTR6]] 982; IS__CGSCC_OPM-NEXT: ret i1 [[R2]] 983; IS__CGSCC_OPM: b: 984; IS__CGSCC_OPM-NEXT: ret i1 [[CMP2]] 985; 986; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone 987; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@undef_then_null 988; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR5]] { 989; IS__CGSCC_NPM-NEXT: [[CMP1:%.*]] = icmp eq i32* null, null 990; IS__CGSCC_NPM-NEXT: [[CMP2:%.*]] = icmp eq i1 [[CMP1]], false 991; IS__CGSCC_NPM-NEXT: [[OR:%.*]] = or i1 [[CMP2]], [[C]] 992; IS__CGSCC_NPM-NEXT: br i1 [[OR]], label [[A:%.*]], label [[B:%.*]] 993; IS__CGSCC_NPM: a: 994; IS__CGSCC_NPM-NEXT: [[R2:%.*]] = call noundef i1 @undef_then_null(i1 noundef false) #[[ATTR5]] 995; IS__CGSCC_NPM-NEXT: ret i1 [[R2]] 996; IS__CGSCC_NPM: b: 997; IS__CGSCC_NPM-NEXT: ret i1 [[CMP2]] 998; 999 %cmp1 = icmp eq i32* %i32Aptr, %i32Bptr 1000 %cmp2 = icmp eq i1 %cmp1, false 1001 %or = or i1 %cmp2, %c 1002 br i1 %or, label %a, label %b 1003a: 1004 %r2 = call i1 @undef_then_null(i1 false, i32* null, i32* null) 1005 ret i1 %r2 1006b: 1007 ret i1 %cmp2 1008} 1009 1010define i1 @test_merge_with_undef_values(i1 %c) { 1011; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone 1012; IS__TUNIT____-LABEL: define {{[^@]+}}@test_merge_with_undef_values 1013; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR2]] { 1014; IS__TUNIT____-NEXT: [[R1:%.*]] = call i1 @undef_then_1(i1 [[C]]) #[[ATTR2]] 1015; IS__TUNIT____-NEXT: ret i1 [[R1]] 1016; 1017; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 1018; IS__CGSCC____-LABEL: define {{[^@]+}}@test_merge_with_undef_values 1019; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] { 1020; IS__CGSCC____-NEXT: ret i1 false 1021; 1022 %r1 = call i1 @undef_then_1(i1 %c, i32 undef, i32 undef) 1023 ret i1 %r1 1024} 1025define internal i1 @undef_then_1(i1 %c, i32 %i32A, i32 %i32B) { 1026; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone 1027; IS__TUNIT____-LABEL: define {{[^@]+}}@undef_then_1 1028; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR2]] { 1029; IS__TUNIT____-NEXT: [[CMP1:%.*]] = icmp eq i32 1, 1 1030; IS__TUNIT____-NEXT: [[CMP2:%.*]] = icmp eq i1 [[CMP1]], false 1031; IS__TUNIT____-NEXT: [[OR:%.*]] = or i1 [[CMP2]], [[C]] 1032; IS__TUNIT____-NEXT: br i1 [[OR]], label [[A:%.*]], label [[B:%.*]] 1033; IS__TUNIT____: a: 1034; IS__TUNIT____-NEXT: [[R2:%.*]] = call i1 @undef_then_1(i1 noundef false) #[[ATTR2]] 1035; IS__TUNIT____-NEXT: ret i1 [[R2]] 1036; IS__TUNIT____: b: 1037; IS__TUNIT____-NEXT: ret i1 [[CMP2]] 1038; 1039; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn 1040; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@undef_then_1 1041; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR7:[0-9]+]] { 1042; IS__CGSCC_OPM-NEXT: [[CMP1:%.*]] = icmp eq i32 1, 1 1043; IS__CGSCC_OPM-NEXT: [[CMP2:%.*]] = icmp eq i1 [[CMP1]], false 1044; IS__CGSCC_OPM-NEXT: [[OR:%.*]] = or i1 false, [[C]] 1045; IS__CGSCC_OPM-NEXT: br i1 [[OR]], label [[A:%.*]], label [[B:%.*]] 1046; IS__CGSCC_OPM: a: 1047; IS__CGSCC_OPM-NEXT: [[R2:%.*]] = call i1 @undef_then_1(i1 noundef false) #[[ATTR6]] 1048; IS__CGSCC_OPM-NEXT: ret i1 undef 1049; IS__CGSCC_OPM: b: 1050; IS__CGSCC_OPM-NEXT: ret i1 undef 1051; 1052; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn 1053; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@undef_then_1 1054; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR6:[0-9]+]] { 1055; IS__CGSCC_NPM-NEXT: [[CMP1:%.*]] = icmp eq i32 1, 1 1056; IS__CGSCC_NPM-NEXT: [[CMP2:%.*]] = icmp eq i1 [[CMP1]], false 1057; IS__CGSCC_NPM-NEXT: [[OR:%.*]] = or i1 false, [[C]] 1058; IS__CGSCC_NPM-NEXT: br i1 [[OR]], label [[A:%.*]], label [[B:%.*]] 1059; IS__CGSCC_NPM: a: 1060; IS__CGSCC_NPM-NEXT: [[R2:%.*]] = call i1 @undef_then_1(i1 noundef false) #[[ATTR5]] 1061; IS__CGSCC_NPM-NEXT: ret i1 undef 1062; IS__CGSCC_NPM: b: 1063; IS__CGSCC_NPM-NEXT: ret i1 undef 1064; 1065 %cmp1 = icmp eq i32 %i32A, %i32B 1066 %cmp2 = icmp eq i1 %cmp1, false 1067 %or = or i1 %cmp2, %c 1068 br i1 %or, label %a, label %b 1069a: 1070 %r2 = call i1 @undef_then_1(i1 false, i32 1, i32 1) 1071 ret i1 %r2 1072b: 1073 ret i1 %cmp2 1074} 1075 1076define i32 @test_select(i32 %c) { 1077; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 1078; IS__TUNIT____-LABEL: define {{[^@]+}}@test_select 1079; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { 1080; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32 @select() #[[ATTR1]] 1081; IS__TUNIT____-NEXT: ret i32 [[CALL]] 1082; 1083; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 1084; IS__CGSCC____-LABEL: define {{[^@]+}}@test_select 1085; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { 1086; IS__CGSCC____-NEXT: ret i32 42 1087; 1088 %call = call i32 @select(i1 1, i32 42, i32 %c) 1089 ret i32 %call 1090} 1091 1092define internal i32 @select(i1 %a, i32 %b, i32 %c) { 1093; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 1094; IS__TUNIT____-LABEL: define {{[^@]+}}@select 1095; IS__TUNIT____-SAME: () #[[ATTR1]] { 1096; IS__TUNIT____-NEXT: ret i32 42 1097; 1098; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 1099; IS__CGSCC____-LABEL: define {{[^@]+}}@select 1100; IS__CGSCC____-SAME: () #[[ATTR1]] { 1101; IS__CGSCC____-NEXT: ret i32 undef 1102; 1103 %s = select i1 %a, i32 %b, i32 %c 1104 ret i32 %s 1105} 1106 1107define i1 @icmp() { 1108; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 1109; IS__TUNIT____-LABEL: define {{[^@]+}}@icmp 1110; IS__TUNIT____-SAME: () #[[ATTR1]] { 1111; IS__TUNIT____-NEXT: ret i1 true 1112; 1113; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 1114; IS__CGSCC____-LABEL: define {{[^@]+}}@icmp 1115; IS__CGSCC____-SAME: () #[[ATTR1]] { 1116; IS__CGSCC____-NEXT: ret i1 true 1117; 1118 %c = icmp eq i8* null, null 1119 ret i1 %c 1120} 1121 1122define void @test_callee_is_undef(void (i32)* %fn) { 1123; IS__TUNIT____-LABEL: define {{[^@]+}}@test_callee_is_undef 1124; IS__TUNIT____-SAME: (void (i32)* nocapture nofree [[FN:%.*]]) { 1125; IS__TUNIT____-NEXT: call void @callee_is_undef() 1126; IS__TUNIT____-NEXT: call void @unknown_calle_arg_is_undef(void (i32)* nocapture nofree [[FN]], i32 undef) 1127; IS__TUNIT____-NEXT: ret void 1128; 1129; IS__CGSCC____-LABEL: define {{[^@]+}}@test_callee_is_undef 1130; IS__CGSCC____-SAME: (void (i32)* nocapture nofree [[FN:%.*]]) { 1131; IS__CGSCC____-NEXT: unreachable 1132; 1133 call void @callee_is_undef(void ()* undef) 1134 call void @unknown_calle_arg_is_undef(void (i32)* %fn, i32 undef) 1135 ret void 1136} 1137define internal void @callee_is_undef(void ()* %fn) { 1138; 1139; IS__TUNIT____-LABEL: define {{[^@]+}}@callee_is_undef() { 1140; IS__TUNIT____-NEXT: call void undef() 1141; IS__TUNIT____-NEXT: ret void 1142; 1143; IS__CGSCC____-LABEL: define {{[^@]+}}@callee_is_undef 1144; IS__CGSCC____-SAME: (void ()* noalias nocapture nofree noundef nonnull [[FN:%.*]]) { 1145; IS__CGSCC____-NEXT: call void [[FN]]() 1146; IS__CGSCC____-NEXT: ret void 1147; 1148 call void %fn() 1149 ret void 1150} 1151define internal void @unknown_calle_arg_is_undef(void (i32)* %fn, i32 %arg) { 1152; 1153; IS__TUNIT____-LABEL: define {{[^@]+}}@unknown_calle_arg_is_undef 1154; IS__TUNIT____-SAME: (void (i32)* nocapture nofree noundef nonnull [[FN:%.*]], i32 [[ARG:%.*]]) { 1155; IS__TUNIT____-NEXT: call void [[FN]](i32 undef) 1156; IS__TUNIT____-NEXT: ret void 1157; 1158; IS__CGSCC____-LABEL: define {{[^@]+}}@unknown_calle_arg_is_undef 1159; IS__CGSCC____-SAME: (void (i32)* nocapture nofree noundef nonnull [[FN:%.*]]) { 1160; IS__CGSCC____-NEXT: call void [[FN]](i32 undef) 1161; IS__CGSCC____-NEXT: ret void 1162; 1163 call void %fn(i32 %arg) 1164 ret void 1165} 1166 1167; Taken from 50683 1168; {{{ 1169 1170@g = internal constant { [2 x i8*] } { [2 x i8*] [i8* bitcast (void (i8***)* @f1 to i8*), i8* bitcast (void (i1 (i8*)*)* @f2 to i8*)] } 1171 1172define internal void @f1(i8*** %a) { 1173; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly 1174; IS__TUNIT____-LABEL: define {{[^@]+}}@f1 1175; IS__TUNIT____-SAME: (i8*** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR3]] { 1176; IS__TUNIT____-NEXT: entry: 1177; IS__TUNIT____-NEXT: [[X:%.*]] = getelementptr { [2 x i8*] }, { [2 x i8*] }* @g, i32 0, i32 0, i32 0 1178; IS__TUNIT____-NEXT: store i8** [[X]], i8*** [[A]], align 8 1179; IS__TUNIT____-NEXT: ret void 1180; 1181; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly 1182; IS__CGSCC____-LABEL: define {{[^@]+}}@f1 1183; IS__CGSCC____-SAME: (i8*** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR2]] { 1184; IS__CGSCC____-NEXT: entry: 1185; IS__CGSCC____-NEXT: [[X:%.*]] = getelementptr { [2 x i8*] }, { [2 x i8*] }* @g, i32 0, i32 0, i32 0 1186; IS__CGSCC____-NEXT: store i8** [[X]], i8*** [[A]], align 8 1187; IS__CGSCC____-NEXT: ret void 1188; 1189entry: 1190 %x = getelementptr { [2 x i8*] }, { [2 x i8*] }* @g, i32 0, i32 0, i32 0 1191 store i8** %x , i8*** %a, align 8 1192 ret void 1193} 1194 1195define internal void @f2(i1 (i8*)* %a) { 1196; CHECK-LABEL: define {{[^@]+}}@f2 1197; CHECK-SAME: (i1 (i8*)* [[A:%.*]]) { 1198; CHECK-NEXT: cont461: 1199; CHECK-NEXT: [[C1:%.*]] = bitcast i1 (i8*)* [[A]] to i8* 1200; CHECK-NEXT: call void @f3(i8* [[C1]], i1 (i8*)* nocapture nofree [[A]]) 1201; CHECK-NEXT: ret void 1202; 1203cont461: 1204 %c1 = bitcast i1 (i8*)* %a to i8* 1205 call void @f3(i8* %c1, i1 (i8*)* %a) 1206 ret void 1207} 1208 1209define internal void @f3(i8* %a1, i1 (i8*)* %a) { 1210; CHECK-LABEL: define {{[^@]+}}@f3 1211; CHECK-SAME: (i8* [[A1:%.*]], i1 (i8*)* nocapture nofree [[A:%.*]]) { 1212; CHECK-NEXT: entry: 1213; CHECK-NEXT: [[CALL20:%.*]] = call i1 @f9() 1214; CHECK-NEXT: br i1 [[CALL20]], label [[LAND_LHS_TRUE:%.*]], label [[IF_END40:%.*]] 1215; CHECK: land.lhs.true: 1216; CHECK-NEXT: [[TMP0:%.*]] = call i1 [[A]](i8* [[A1]]) 1217; CHECK-NEXT: br label [[IF_END40]] 1218; CHECK: if.end40: 1219; CHECK-NEXT: ret void 1220; 1221entry: 1222 %call20 = call i1 @f9() 1223 br i1 %call20, label %land.lhs.true, label %if.end40 1224 1225land.lhs.true: 1226 call i1 %a(i8* %a1) 1227 br label %if.end40 1228 1229if.end40: 1230 ret void 1231} 1232 1233define linkonce_odr i1 @f9() { 1234; CHECK-LABEL: define {{[^@]+}}@f9() { 1235; CHECK-NEXT: entry: 1236; CHECK-NEXT: ret i1 false 1237; 1238entry: 1239 ret i1 false 1240} 1241 1242; }}} 1243 1244;. 1245; IS__TUNIT_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn } 1246; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } 1247; IS__TUNIT_OPM: attributes #[[ATTR2]] = { nofree nosync nounwind readnone } 1248; IS__TUNIT_OPM: attributes #[[ATTR3]] = { argmemonly nofree nosync nounwind willreturn writeonly } 1249; IS__TUNIT_OPM: attributes #[[ATTR4]] = { nofree nosync nounwind readonly willreturn } 1250; IS__TUNIT_OPM: attributes #[[ATTR5]] = { argmemonly nofree nosync nounwind writeonly } 1251; IS__TUNIT_OPM: attributes #[[ATTR6]] = { nofree nosync nounwind willreturn writeonly } 1252; IS__TUNIT_OPM: attributes #[[ATTR7]] = { willreturn } 1253;. 1254; IS__TUNIT_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn } 1255; IS__TUNIT_NPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } 1256; IS__TUNIT_NPM: attributes #[[ATTR2]] = { nofree nosync nounwind readnone } 1257; IS__TUNIT_NPM: attributes #[[ATTR3]] = { argmemonly nofree nosync nounwind willreturn writeonly } 1258; IS__TUNIT_NPM: attributes #[[ATTR4]] = { nofree nosync nounwind readonly willreturn } 1259; IS__TUNIT_NPM: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn writeonly } 1260; IS__TUNIT_NPM: attributes #[[ATTR6]] = { willreturn } 1261;. 1262; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn } 1263; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } 1264; IS__CGSCC_OPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } 1265; IS__CGSCC_OPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind readonly willreturn } 1266; IS__CGSCC_OPM: attributes #[[ATTR4]] = { argmemonly nofree norecurse nosync nounwind writeonly } 1267; IS__CGSCC_OPM: attributes #[[ATTR5]] = { nofree norecurse nosync nounwind willreturn writeonly } 1268; IS__CGSCC_OPM: attributes #[[ATTR6]] = { nofree nosync nounwind readnone } 1269; IS__CGSCC_OPM: attributes #[[ATTR7]] = { nofree nosync nounwind readnone willreturn } 1270; IS__CGSCC_OPM: attributes #[[ATTR8]] = { readnone willreturn } 1271; IS__CGSCC_OPM: attributes #[[ATTR9]] = { willreturn } 1272; IS__CGSCC_OPM: attributes #[[ATTR10]] = { nounwind readnone willreturn } 1273; IS__CGSCC_OPM: attributes #[[ATTR11]] = { readonly willreturn } 1274; IS__CGSCC_OPM: attributes #[[ATTR12]] = { nounwind readnone } 1275;. 1276; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn } 1277; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } 1278; IS__CGSCC_NPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } 1279; IS__CGSCC_NPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind readonly willreturn } 1280; IS__CGSCC_NPM: attributes #[[ATTR4]] = { nofree norecurse nosync nounwind willreturn writeonly } 1281; IS__CGSCC_NPM: attributes #[[ATTR5]] = { nofree nosync nounwind readnone } 1282; IS__CGSCC_NPM: attributes #[[ATTR6]] = { nofree nosync nounwind readnone willreturn } 1283; IS__CGSCC_NPM: attributes #[[ATTR7]] = { readnone willreturn } 1284; IS__CGSCC_NPM: attributes #[[ATTR8]] = { willreturn } 1285; IS__CGSCC_NPM: attributes #[[ATTR9]] = { nounwind readnone willreturn } 1286; IS__CGSCC_NPM: attributes #[[ATTR10]] = { readonly willreturn } 1287; IS__CGSCC_NPM: attributes #[[ATTR11]] = { nounwind readnone } 1288;. 1289