1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature 2; RUN: opt -S -openmpopt < %s | FileCheck %s 3; RUN: opt -S -passes=openmpopt < %s | FileCheck %s 4 5%struct.ident_t = type { i32, i32, i32, i32, i8* } 6 7@.str = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1 8@0 = private unnamed_addr global %struct.ident_t { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i32 0, i32 0) }, align 8 9 10; doesn't modify any ICVs. 11define i32 @icv_free_use(i32 %0) { 12; CHECK-LABEL: define {{[^@]+}}@icv_free_use 13; CHECK-SAME: (i32 [[TMP0:%.*]]) 14; CHECK-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP0]], 1 15; CHECK-NEXT: ret i32 [[TMP2]] 16; 17 %2 = add nsw i32 %0, 1 18 ret i32 %2 19} 20 21define i32 @bad_use(i32 %0) { 22; CHECK-LABEL: define {{[^@]+}}@bad_use 23; CHECK-SAME: (i32 [[TMP0:%.*]]) 24; CHECK-NEXT: tail call void @use(i32 [[TMP0]]) 25; CHECK-NEXT: [[TMP2:%.*]] = add nsw i32 [[TMP0]], 1 26; CHECK-NEXT: ret i32 [[TMP2]] 27; 28 tail call void @use(i32 %0) 29 %2 = add nsw i32 %0, 1 30 ret i32 %2 31} 32 33define void @indirect_call(void ()* %0) { 34; CHECK-LABEL: define {{[^@]+}}@indirect_call 35; CHECK-SAME: (void ()* [[TMP0:%.*]]) 36; CHECK-NEXT: call void @omp_set_num_threads(i32 4) 37; CHECK-NEXT: tail call void [[TMP0]]() 38; CHECK-NEXT: [[TMP2:%.*]] = tail call i32 @omp_get_max_threads() 39; CHECK-NEXT: tail call void @use(i32 [[TMP2]]) 40; CHECK-NEXT: ret void 41 call void @omp_set_num_threads(i32 4) 42 tail call void %0() 43 %2 = tail call i32 @omp_get_max_threads() 44 tail call void @use(i32 %2) 45 ret void 46} 47 48define dso_local i32 @foo(i32 %0, i32 %1) { 49; CHECK-LABEL: define {{[^@]+}}@foo 50; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) 51; CHECK-NEXT: tail call void @omp_set_num_threads(i32 [[TMP0]]) 52; CHECK-NEXT: tail call void @omp_set_num_threads(i32 [[TMP1]]) 53; CHECK-NEXT: tail call void @use(i32 [[TMP1]]) 54; CHECK-NEXT: tail call void @use(i32 [[TMP1]]) 55; CHECK-NEXT: tail call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* nonnull @0, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @.omp_outlined. to void (i32*, i32*, ...)*)) 56; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @omp_get_max_threads() 57; CHECK-NEXT: tail call void @use(i32 [[TMP3]]) 58; CHECK-NEXT: ret i32 0 59; 60 tail call void @omp_set_num_threads(i32 %0) 61 %3 = tail call i32 @omp_get_max_threads() 62; FIXME: this value should be tracked and the rest of the getters deduplicated and replaced with it. 63 tail call void @omp_set_num_threads(i32 %1) 64 %4 = tail call i32 @omp_get_max_threads() 65 %5 = tail call i32 @omp_get_max_threads() 66 %6 = tail call i32 @omp_get_max_threads() 67 tail call void @use(i32 %4) 68 tail call void @use(i32 %5) 69 tail call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* nonnull @0, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @.omp_outlined. to void (i32*, i32*, ...)*)) 70 %7 = tail call i32 @omp_get_max_threads() 71 tail call void @use(i32 %7) 72 ret i32 0 73} 74 75declare dso_local void @omp_set_num_threads(i32) 76 77declare dso_local i32 @omp_get_max_threads() 78 79declare dso_local void @use(i32) 80 81define internal void @.omp_outlined.(i32* %0, i32* %1) { 82; CHECK-LABEL: define {{[^@]+}}@.omp_outlined. 83; CHECK-SAME: (i32* [[TMP0:%.*]], i32* [[TMP1:%.*]]) 84; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @omp_get_max_threads() 85; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @omp_get_max_threads() 86; CHECK-NEXT: tail call void @use(i32 [[TMP4]]) 87; CHECK-NEXT: tail call void @omp_set_num_threads(i32 10) 88; CHECK-NEXT: tail call void @use(i32 10) 89; CHECK-NEXT: ret void 90; 91; FIXME: this value should be tracked and the rest of the getters deduplicated and replaced with it. 92 %3 = tail call i32 @omp_get_max_threads() 93 %4 = tail call i32 @omp_get_max_threads() 94 tail call void @use(i32 %4) 95 tail call void @omp_set_num_threads(i32 10) 96 %5 = tail call i32 @omp_get_max_threads() 97 tail call void @use(i32 %5) 98 ret void 99} 100 101declare !callback !0 void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) 102 103define dso_local i32 @bar(i32 %0, i32 %1) { 104; CHECK-LABEL: define {{[^@]+}}@bar 105; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) 106; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]] 107; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP0]], i32 [[TMP1]] 108; CHECK-NEXT: tail call void @omp_set_num_threads(i32 [[TMP4]]) 109; CHECK-NEXT: tail call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* nonnull @0, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @.omp_outlined..1 to void (i32*, i32*, ...)*)) 110; CHECK-NEXT: [[TMP5:%.*]] = tail call i32 @omp_get_max_threads() 111; CHECK-NEXT: tail call void @use(i32 [[TMP5]]) 112; CHECK-NEXT: ret i32 0 113; 114 %3 = icmp sgt i32 %0, %1 115 %4 = select i1 %3, i32 %0, i32 %1 116; FIXME: getters can be replaced with %4 117 tail call void @omp_set_num_threads(i32 %4) 118 %5 = tail call i32 @omp_get_max_threads() 119 tail call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* nonnull @0, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @.omp_outlined..1 to void (i32*, i32*, ...)*)) 120 %6 = tail call i32 @omp_get_max_threads() 121 tail call void @use(i32 %6) 122 ret i32 0 123} 124 125define internal void @.omp_outlined..1(i32* %0, i32* %1) { 126; CHECK-LABEL: define {{[^@]+}}@.omp_outlined..1 127; CHECK-SAME: (i32* [[TMP0:%.*]], i32* [[TMP1:%.*]]) 128; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @omp_get_max_threads() 129; CHECK-NEXT: tail call void @use(i32 [[TMP3]]) 130; CHECK-NEXT: tail call void @omp_set_num_threads(i32 10) 131; CHECK-NEXT: tail call void @use(i32 10) 132; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @omp_get_max_threads() 133; CHECK-NEXT: tail call void @use(i32 [[TMP4]]) 134; CHECK-NEXT: ret void 135; 136 %3 = tail call i32 @omp_get_max_threads() 137 tail call void @use(i32 %3) 138 tail call void @omp_set_num_threads(i32 10) 139 %4 = tail call i32 @omp_get_max_threads() 140 tail call void @use(i32 %4) 141 %5 = tail call i32 @omp_get_max_threads() 142 tail call void @use(i32 %5) 143 ret void 144} 145 146define dso_local i32 @bar1(i32 %0, i32 %1) { 147; CHECK-LABEL: define {{[^@]+}}@bar1 148; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) 149; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]] 150; CHECK-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP0]], i32 [[TMP1]] 151; CHECK-NEXT: tail call void @omp_set_num_threads(i32 [[TMP4]]) 152; CHECK-NEXT: tail call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* nonnull @0, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @.omp_outlined..2 to void (i32*, i32*, ...)*)) 153; CHECK-NEXT: [[TMP5:%.*]] = tail call i32 @omp_get_max_threads() 154; CHECK-NEXT: tail call void @use(i32 [[TMP5]]) 155; CHECK-NEXT: ret i32 0 156; 157 %3 = icmp sgt i32 %0, %1 158 %4 = select i1 %3, i32 %0, i32 %1 159 tail call void @omp_set_num_threads(i32 %4) 160 %5 = tail call i32 @omp_get_max_threads() 161 tail call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* nonnull @0, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @.omp_outlined..2 to void (i32*, i32*, ...)*)) 162 %6 = tail call i32 @omp_get_max_threads() 163 tail call void @use(i32 %6) 164 ret i32 0 165} 166 167define internal void @.omp_outlined..2(i32* %0, i32* %1) { 168; CHECK-LABEL: define {{[^@]+}}@.omp_outlined..2 169; CHECK-SAME: (i32* [[TMP0:%.*]], i32* [[TMP1:%.*]]) 170; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @omp_get_max_threads() 171; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @icv_free_use(i32 [[TMP3]]) 172; CHECK-NEXT: tail call void @omp_set_num_threads(i32 10) 173; CHECK-NEXT: [[TMP5:%.*]] = tail call i32 @icv_free_use(i32 10) 174; CHECK-NEXT: [[TMP6:%.*]] = tail call i32 @icv_free_use(i32 10) 175; CHECK-NEXT: ret void 176; 177 %3 = tail call i32 @omp_get_max_threads() 178 %4 = tail call i32 @icv_free_use(i32 %3) 179 tail call void @omp_set_num_threads(i32 10) 180 %5 = tail call i32 @omp_get_max_threads() 181 %6 = tail call i32 @icv_free_use(i32 %5) 182 %7 = tail call i32 @omp_get_max_threads() 183 %8 = tail call i32 @icv_free_use(i32 %7) 184 ret void 185} 186define void @test(i1 %0) { 187; CHECK-LABEL: define {{[^@]+}}@test 188; CHECK-SAME: (i1 [[TMP0:%.*]]) 189; CHECK-NEXT: call void @omp_set_num_threads(i32 2) 190; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false 191; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]] 192; CHECK: 3: 193; CHECK-NEXT: call void @use(i32 10) 194; CHECK-NEXT: br label [[TMP4]] 195; CHECK: 4: 196; CHECK-NEXT: [[TMP5:%.*]] = call i32 @omp_get_max_threads() 197; CHECK-NEXT: call void @use(i32 [[TMP5]]) 198; CHECK-NEXT: ret void 199; 200 call void @omp_set_num_threads(i32 2) 201 %2 = icmp eq i1 %0, 0 202 br i1 %2, label %4, label %3 203 2043: ; preds = %1 205 call void @use(i32 10) 206 br label %4 207 2084: ; preds = %3, %1 209 %5 = call i32 @omp_get_max_threads() 210 call void @use(i32 %5) 211 ret void 212} 213 214define void @test1(i1 %0) { 215; CHECK-LABEL: define {{[^@]+}}@test1 216; CHECK-SAME: (i1 [[TMP0:%.*]]) 217; CHECK-NEXT: call void @omp_set_num_threads(i32 2) 218; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false 219; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] 220; CHECK: 3: 221; CHECK-NEXT: [[TMP4:%.*]] = call i32 @icv_free_use(i32 10) 222; CHECK-NEXT: br label [[TMP5]] 223; CHECK: 5: 224; CHECK-NEXT: call void @use(i32 2) 225; CHECK-NEXT: ret void 226; 227 call void @omp_set_num_threads(i32 2) 228 %2 = icmp eq i1 %0, 0 229 br i1 %2, label %5, label %3 230 2313: ; preds = %1 232 %4 = call i32 @icv_free_use(i32 10) 233 br label %5 234 2355: ; preds = %3, %1 236 %6 = call i32 @omp_get_max_threads() 237 call void @use(i32 %6) 238 ret void 239} 240 241define void @bad_use_test(i1 %0) { 242; CHECK-LABEL: define {{[^@]+}}@bad_use_test 243; CHECK-SAME: (i1 [[TMP0:%.*]]) 244; CHECK-NEXT: call void @omp_set_num_threads(i32 2) 245; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false 246; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] 247; CHECK: 3: 248; CHECK-NEXT: [[TMP4:%.*]] = call i32 @bad_use(i32 10) 249; CHECK-NEXT: br label [[TMP5]] 250; CHECK: 5: 251; CHECK-NEXT: [[TMP6:%.*]] = call i32 @omp_get_max_threads() 252; CHECK-NEXT: call void @use(i32 [[TMP6]]) 253; CHECK-NEXT: ret void 254; 255 call void @omp_set_num_threads(i32 2) 256 %2 = icmp eq i1 %0, 0 257 br i1 %2, label %5, label %3 258 2593: ; preds = %1 260 %4 = call i32 @bad_use(i32 10) 261 br label %5 262 2635: ; preds = %3, %1 264 %6 = call i32 @omp_get_max_threads() 265 call void @use(i32 %6) 266 ret void 267} 268 269define weak void @weak_known_unique_icv(i1 %0) { 270; CHECK-LABEL: define {{[^@]+}}@weak_known_unique_icv 271; CHECK-SAME: (i1 [[TMP0:%.*]]) 272; CHECK-NEXT: call void @omp_set_num_threads(i32 2) 273; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false 274; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] 275; CHECK: 3: 276; CHECK-NEXT: [[TMP4:%.*]] = call i32 @icv_free_use(i32 10) 277; CHECK-NEXT: br label [[TMP5]] 278; CHECK: 5: 279; CHECK-NEXT: [[TMP6:%.*]] = call i32 @omp_get_max_threads() 280; CHECK-NEXT: [[TMP7:%.*]] = call i32 @icv_free_use(i32 [[TMP6]]) 281; CHECK-NEXT: ret void 282; 283 call void @omp_set_num_threads(i32 2) 284 %2 = icmp eq i1 %0, 0 285 br i1 %2, label %5, label %3 286 2873: ; preds = %1 288 %4 = call i32 @icv_free_use(i32 10) 289 br label %5 290 2915: ; preds = %3, %1 292 %6 = call i32 @omp_get_max_threads() 293 %7 = call i32 @icv_free_use(i32 %6) 294 ret void 295} 296 297define void @known_unique_icv(i1 %0) { 298; CHECK-LABEL: define {{[^@]+}}@known_unique_icv 299; CHECK-SAME: (i1 [[TMP0:%.*]]) 300; CHECK-NEXT: call void @omp_set_num_threads(i32 2) 301; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false 302; CHECK-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] 303; CHECK: 3: 304; CHECK-NEXT: [[TMP4:%.*]] = call i32 @icv_free_use(i32 10) 305; CHECK-NEXT: br label [[TMP5]] 306; CHECK: 5: 307; CHECK-NEXT: [[TMP6:%.*]] = call i32 @icv_free_use(i32 2) 308; CHECK-NEXT: ret void 309; 310 call void @omp_set_num_threads(i32 2) 311 %2 = icmp eq i1 %0, 0 312 br i1 %2, label %5, label %3 313 3143: ; preds = %1 315 %4 = call i32 @icv_free_use(i32 10) 316 br label %5 317 3185: ; preds = %3, %1 319 %6 = call i32 @omp_get_max_threads() 320 %7 = call i32 @icv_free_use(i32 %6) 321 ret void 322} 323 324define i32 @no_unique_icv(i1 %0) { 325; CHECK-LABEL: define {{[^@]+}}@no_unique_icv 326; CHECK-SAME: (i1 [[TMP0:%.*]]) 327; CHECK-NEXT: call void @omp_set_num_threads(i32 4) 328; CHECK-NEXT: br i1 [[TMP0]], label [[TMP3:%.*]], label [[TMP2:%.*]] 329; CHECK: 2: 330; CHECK-NEXT: call void @omp_set_num_threads(i32 2) 331; CHECK-NEXT: br label [[TMP3]] 332; CHECK: 3: 333; CHECK-NEXT: [[TMP4:%.*]] = call i32 @omp_get_max_threads() 334; CHECK-NEXT: ret i32 [[TMP4]] 335; 336 call void @omp_set_num_threads(i32 4) 337 br i1 %0, label %3, label %2 338 3392: ; preds = %1 340 call void @omp_set_num_threads(i32 2) 341 br label %3 342 3433: ; preds = %1, %2 344 %4 = call i32 @omp_get_max_threads() 345 ret i32 %4 346} 347 348define void @test2(i1 %0) { 349; CHECK-LABEL: define {{[^@]+}}@test2 350; CHECK-SAME: (i1 [[TMP0:%.*]]) 351; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false 352; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]] 353; CHECK: 3: 354; CHECK-NEXT: call void @omp_set_num_threads(i32 4) 355; CHECK-NEXT: br label [[TMP4]] 356; CHECK: 4: 357; CHECK-NEXT: [[TMP5:%.*]] = call i32 @omp_get_max_threads() 358; CHECK-NEXT: call void @use(i32 [[TMP5]]) 359; CHECK-NEXT: ret void 360; 361 %2 = icmp eq i1 %0, 0 362 br i1 %2, label %4, label %3 363 3643: ; preds = %1 365 call void @omp_set_num_threads(i32 4) 366 br label %4 367 3684: ; preds = %3, %1 369 %5 = call i32 @omp_get_max_threads() 370 call void @use(i32 %5) 371 ret void 372} 373 374define void @test3(i1 %0) { 375; CHECK-LABEL: define {{[^@]+}}@test3 376; CHECK-SAME: (i1 [[TMP0:%.*]]) 377; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false 378; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]] 379; CHECK: 3: 380; CHECK-NEXT: call void @omp_set_num_threads(i32 4) 381; CHECK-NEXT: br label [[TMP4]] 382; CHECK: 4: 383; CHECK-NEXT: call void @weak_known_unique_icv(i1 [[TMP0]]) 384; CHECK-NEXT: [[TMP5:%.*]] = call i32 @omp_get_max_threads() 385; CHECK-NEXT: [[TMP6:%.*]] = call i32 @icv_free_use(i32 [[TMP5]]) 386; CHECK-NEXT: ret void 387; 388 %2 = icmp eq i1 %0, 0 389 br i1 %2, label %4, label %3 390 3913: ; preds = %1 392 call void @omp_set_num_threads(i32 4) 393 br label %4 394 3954: ; preds = %3, %1 396 call void @weak_known_unique_icv(i1 %0) 397 %5 = call i32 @omp_get_max_threads() 398 %6 = call i32 @icv_free_use(i32 %5) 399 ret void 400} 401 402declare void @__cxa_rethrow() 403 404define i32 @maybe_throw(i1 zeroext %0) { 405; CHECK-LABEL: define {{[^@]+}}@maybe_throw 406; CHECK-SAME: (i1 zeroext [[TMP0:%.*]]) 407; CHECK-NEXT: call void @omp_set_num_threads(i32 4) 408; CHECK-NEXT: br i1 [[TMP0]], label [[TMP2:%.*]], label [[TMP3:%.*]] 409; CHECK: 2: 410; CHECK-NEXT: tail call void @__cxa_rethrow() 411; CHECK-NEXT: unreachable 412; CHECK: 3: 413; CHECK-NEXT: ret i32 -1 414; 415 call void @omp_set_num_threads(i32 4) 416 br i1 %0, label %2, label %3 417 4182: ; preds = %1 419 tail call void @__cxa_rethrow() #1 420 unreachable 421 4223: ; preds = %1 423 ret i32 -1 424} 425 426define void @test4(i1 %0) { 427; CHECK-LABEL: define {{[^@]+}}@test4 428; CHECK-SAME: (i1 [[TMP0:%.*]]) 429; CHECK-NEXT: call void @known_unique_icv(i1 [[TMP0]]) 430; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i1 [[TMP0]], false 431; CHECK-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]] 432; CHECK: 3: 433; CHECK-NEXT: [[VAL:%.*]] = call i32 @icv_free_use(i32 10) 434; CHECK-NEXT: br label [[TMP4]] 435; CHECK: 4: 436; CHECK-NEXT: call void @use(i32 2) 437; CHECK-NEXT: [[TMP5:%.*]] = call i32 @omp_get_max_threads() 438; CHECK-NEXT: [[TMP6:%.*]] = call i32 @no_unique_icv(i1 [[TMP0]]) 439; CHECK-NEXT: call void @use(i32 [[TMP5]]) 440; CHECK-NEXT: ret void 441; 442 call void @known_unique_icv(i1 %0) 443 %2 = icmp eq i1 %0, 0 444 br i1 %2, label %4, label %3 445 4463: ; preds = %1 447 %val = call i32 @icv_free_use(i32 10) 448 br label %4 449 4504: ; preds = %3, %1 451 %5 = call i32 @omp_get_max_threads() 452 call void @use(i32 %5) 453 %6 = call i32 @omp_get_max_threads() 454 call i32 @no_unique_icv(i1 %0) 455 call void @use(i32 %6) 456 ret void 457} 458 459define void @test4_invoke(i1 %0) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { 460; CHECK-LABEL: define {{[^@]+}}@test4_invoke 461; CHECK-SAME: (i1 [[TMP0:%.*]]) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) 462; CHECK-NEXT: call void @known_unique_icv(i1 [[TMP0]]) 463; CHECK-NEXT: [[TMP2:%.*]] = invoke i32 @maybe_throw(i1 [[TMP0]]) 464; CHECK-NEXT: to label [[CONT:%.*]] unwind label [[EXC:%.*]] 465; CHECK: cont: 466; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i1 [[TMP0]], false 467; CHECK-NEXT: br i1 [[TMP3]], label [[TMP5:%.*]], label [[TMP4:%.*]] 468; CHECK: exc: 469; CHECK-NEXT: [[LP:%.*]] = landingpad { i8*, i32 } 470; CHECK-NEXT: filter [0 x i8*] zeroinitializer 471; CHECK-NEXT: unreachable 472; CHECK: 4: 473; CHECK-NEXT: [[VAL:%.*]] = call i32 @icv_free_use(i32 10) 474; CHECK-NEXT: br label [[TMP5]] 475; CHECK: 5: 476; CHECK-NEXT: call void @use(i32 2) 477; CHECK-NEXT: ret void 478; 479 call void @known_unique_icv(i1 %0) 480 invoke i32 @maybe_throw(i1 %0) 481 to label %cont unwind label %exc 482 483cont: 484 %3 = icmp eq i1 %0, 0 485 br i1 %3, label %5, label %4 486 487exc: 488 %lp = landingpad { i8*, i32 } 489 filter [0 x i8*] zeroinitializer 490 unreachable 491 4924: ; preds = %1 493 %val = call i32 @icv_free_use(i32 10) 494 br label %5 495 4965: ; preds = %3, %1 497 %6 = call i32 @omp_get_max_threads() 498 call void @use(i32 %6) 499 ret void 500} 501 502define i32 @test5(i32 %0) #0 { 503; CHECK-LABEL: define {{[^@]+}}@test5 504; CHECK-SAME: (i32 [[TMP0:%.*]]) 505; CHECK-NEXT: call void @omp_set_num_threads(i32 4) 506; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP0]], 3 507; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]] 508; CHECK: 3: 509; CHECK-NEXT: call void @use(i32 4) 510; CHECK-NEXT: br label [[TMP12:%.*]] 511; CHECK: 4: 512; CHECK-NEXT: [[TMP5:%.*]] = icmp sgt i32 [[TMP0]], 0 513; CHECK-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP8:%.*]] 514; CHECK: 6: 515; CHECK-NEXT: [[TMP7:%.*]] = call i32 @icv_free_use(i32 [[TMP0]]) 516; CHECK-NEXT: br label [[TMP15:%.*]] 517; CHECK: 8: 518; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP0]], 0 519; CHECK-NEXT: br i1 [[TMP9]], label [[TMP10:%.*]], label [[TMP12]] 520; CHECK: 10: 521; CHECK-NEXT: [[TMP11:%.*]] = call i32 @icv_free_use(i32 10) 522; CHECK-NEXT: br label [[TMP15]] 523; CHECK: 12: 524; CHECK-NEXT: [[TMP13:%.*]] = add nsw i32 [[TMP0]], 1 525; CHECK-NEXT: [[TMP14:%.*]] = call i32 @icv_free_use(i32 [[TMP13]]) 526; CHECK-NEXT: br label [[TMP15]] 527; CHECK: 15: 528; CHECK-NEXT: [[TMP16:%.*]] = call i32 @omp_get_max_threads() 529; CHECK-NEXT: [[TMP17:%.*]] = call i32 @icv_free_use(i32 [[TMP16]]) 530; CHECK-NEXT: ret i32 [[TMP17]] 531; 532 call void @omp_set_num_threads(i32 4) 533 %2 = icmp sgt i32 %0, 3 534 br i1 %2, label %3, label %5 535 5363: 537 %4 = call i32 @omp_get_max_threads() 538 call void @use(i32 %4) 539 br label %13 540 5415: 542 %6 = icmp sgt i32 %0, 0 543 br i1 %6, label %7, label %9 544 5457: 546 %8 = call i32 @icv_free_use(i32 %0) 547 br label %16 548 5499: 550 %10 = icmp eq i32 %0, 0 551 br i1 %10, label %11, label %13 552 55311: 554 %12 = call i32 @icv_free_use(i32 10) 555 br label %16 556 55713: 558 %14 = add nsw i32 %0, 1 559 %15 = call i32 @icv_free_use(i32 %14) 560 br label %16 561 56216: 563 %17 = call i32 @omp_get_max_threads() 564 %18 = call i32 @icv_free_use(i32 %17) 565 ret i32 %18 566} 567 568define i32 @test6(i32 %0) { 569; CHECK-LABEL: define {{[^@]+}}@test6 570; CHECK-SAME: (i32 [[TMP0:%.*]]) 571; CHECK-NEXT: call void @omp_set_num_threads(i32 4) 572; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP0]], 3 573; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]] 574; CHECK: 3: 575; CHECK-NEXT: [[TMP4:%.*]] = call i32 @icv_free_use(i32 10) 576; CHECK-NEXT: br label [[TMP16:%.*]] 577; CHECK: 5: 578; CHECK-NEXT: [[TMP6:%.*]] = icmp sgt i32 [[TMP0]], 0 579; CHECK-NEXT: br i1 [[TMP6]], label [[TMP7:%.*]], label [[TMP9:%.*]] 580; CHECK: 7: 581; CHECK-NEXT: [[TMP8:%.*]] = call i32 @icv_free_use(i32 [[TMP0]]) 582; CHECK-NEXT: br label [[TMP16]] 583; CHECK: 9: 584; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i32 [[TMP0]], 0 585; CHECK-NEXT: br i1 [[TMP10]], label [[TMP11:%.*]], label [[TMP13:%.*]] 586; CHECK: 11: 587; CHECK-NEXT: [[TMP12:%.*]] = call i32 @icv_free_use(i32 5) 588; CHECK-NEXT: br label [[TMP16]] 589; CHECK: 13: 590; CHECK-NEXT: [[TMP14:%.*]] = add nsw i32 [[TMP0]], 1 591; CHECK-NEXT: [[TMP15:%.*]] = call i32 @icv_free_use(i32 [[TMP14]]) 592; CHECK-NEXT: br label [[TMP16]] 593; CHECK: 16: 594; CHECK-NEXT: [[TMP17:%.*]] = call i32 @icv_free_use(i32 4) 595; CHECK-NEXT: ret i32 [[TMP17]] 596; 597 call void @omp_set_num_threads(i32 4) 598 %2 = icmp sgt i32 %0, 3 599 br i1 %2, label %3, label %5 600 6013: ; preds = %1 602 %4 = call i32 @icv_free_use(i32 10) 603 br label %16 604 6055: ; preds = %1 606 %6 = icmp sgt i32 %0, 0 607 br i1 %6, label %7, label %9 608 6097: ; preds = %5 610 %8 = call i32 @icv_free_use(i32 %0) 611 br label %16 612 6139: ; preds = %5 614 %10 = icmp eq i32 %0, 0 615 br i1 %10, label %11, label %13 616 61711: ; preds = %9 618 %12 = call i32 @icv_free_use(i32 5) 619 br label %16 620 62113: ; preds = %9 622 %14 = add nsw i32 %0, 1 623 %15 = call i32 @icv_free_use(i32 %14) 624 br label %16 625 62616: ; preds = %7, %13, %11, %3 627 %17 = call i32 @omp_get_max_threads() 628 %18 = call i32 @icv_free_use(i32 %17) 629 ret i32 %18 630} 631 632declare i32 @__gxx_personality_v0(...) 633 634!0 = !{!1} 635!1 = !{i64 2, i64 -1, i64 -1, i1 true} 636