xref: /llvm-project/llvm/test/Transforms/Attributor/openmp_parallel.ll (revision 29441e4f5fa5f5c7709f7cf180815ba97f611297)
117207872SJohannes Doerfert; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
223dafbb1SJohannes Doerfert; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3846709b2SNikita Popov; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
417207872SJohannes Doerfert
517207872SJohannes Doerferttarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
617207872SJohannes Doerfert
74f4787e3SNikita Popov%struct.ident_t = type { i32, i32, i32, i32, ptr }
817207872SJohannes Doerfert
917207872SJohannes Doerfert@0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
104f4787e3SNikita Popov@1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 514, i32 0, i32 0, ptr @0 }, align 8
114f4787e3SNikita Popov@2 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 0, ptr @0 }, align 8
1217207872SJohannes Doerfert
1317207872SJohannes Doerfert; %a is write only, %b is read only, neither is captured or freed, or ...
1417207872SJohannes Doerfert; FIXME: %a and %b are *not* readnone!
1517207872SJohannes Doerfert
1617207872SJohannes Doerfert;.
1717207872SJohannes Doerfert; CHECK: @[[GLOB0:[0-9]+]] = private unnamed_addr constant [23 x i8] c"
18cd3a4c31SJohannes Doerfert; CHECK: @[[GLOB1:[0-9]+]] = private unnamed_addr constant %struct.ident_t { i32 0, i32 514, i32 0, i32 0, ptr @[[GLOB0]] }, align 8
19cd3a4c31SJohannes Doerfert; CHECK: @[[GLOB2:[0-9]+]] = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 0, ptr @[[GLOB0]] }, align 8
2017207872SJohannes Doerfert;.
214f4787e3SNikita Popovdefine dso_local void @func(ptr nocapture %a, ptr %b, i32 %N) local_unnamed_addr #0 {
22846709b2SNikita Popov; TUNIT: Function Attrs: nounwind uwtable
23846709b2SNikita Popov; TUNIT-LABEL: define {{[^@]+}}@func
24*29441e4fSNikita Popov; TUNIT-SAME: (ptr nofree writeonly captures(none) [[A:%.*]], ptr nofree readonly captures(none) [[B:%.*]], i32 [[N:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
25846709b2SNikita Popov; TUNIT-NEXT:  entry:
264f4787e3SNikita Popov; TUNIT-NEXT:    [[A_ADDR:%.*]] = alloca ptr, align 8
274f4787e3SNikita Popov; TUNIT-NEXT:    [[B_ADDR:%.*]] = alloca ptr, align 8
28846709b2SNikita Popov; TUNIT-NEXT:    [[N_ADDR:%.*]] = alloca i32, align 4
294f4787e3SNikita Popov; TUNIT-NEXT:    store ptr [[A]], ptr [[A_ADDR]], align 8
304f4787e3SNikita Popov; TUNIT-NEXT:    store ptr [[B]], ptr [[B_ADDR]], align 8
31*29441e4fSNikita Popov; TUNIT-NEXT:    call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr noundef nonnull align 8 dereferenceable(24) @[[GLOB2]], i32 noundef 3, ptr noundef nonnull @.omp_outlined., ptr noalias nofree nonnull readnone align 4 captures(none) dereferenceable(4) undef, ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[A_ADDR]], ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[B_ADDR]])
32846709b2SNikita Popov; TUNIT-NEXT:    ret void
3317207872SJohannes Doerfert;
34846709b2SNikita Popov; CGSCC: Function Attrs: nounwind uwtable
35846709b2SNikita Popov; CGSCC-LABEL: define {{[^@]+}}@func
36*29441e4fSNikita Popov; CGSCC-SAME: (ptr nofree captures(none) [[A:%.*]], ptr nofree [[B:%.*]], i32 [[N:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
37846709b2SNikita Popov; CGSCC-NEXT:  entry:
384f4787e3SNikita Popov; CGSCC-NEXT:    [[A_ADDR:%.*]] = alloca ptr, align 8
394f4787e3SNikita Popov; CGSCC-NEXT:    [[B_ADDR:%.*]] = alloca ptr, align 8
40846709b2SNikita Popov; CGSCC-NEXT:    [[N_ADDR:%.*]] = alloca i32, align 4
414f4787e3SNikita Popov; CGSCC-NEXT:    store ptr [[A]], ptr [[A_ADDR]], align 8
424f4787e3SNikita Popov; CGSCC-NEXT:    store ptr [[B]], ptr [[B_ADDR]], align 8
434f4787e3SNikita Popov; CGSCC-NEXT:    store i32 199, ptr [[N_ADDR]], align 4
44*29441e4fSNikita Popov; CGSCC-NEXT:    call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr noundef nonnull align 8 dereferenceable(24) @[[GLOB2]], i32 noundef 3, ptr noundef nonnull @.omp_outlined., ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[N_ADDR]], ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[A_ADDR]], ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[B_ADDR]])
45846709b2SNikita Popov; CGSCC-NEXT:    ret void
4617207872SJohannes Doerfert;
4717207872SJohannes Doerfertentry:
484f4787e3SNikita Popov  %a.addr = alloca ptr, align 8
494f4787e3SNikita Popov  %b.addr = alloca ptr, align 8
5017207872SJohannes Doerfert  %N.addr = alloca i32, align 4
514f4787e3SNikita Popov  store ptr %a, ptr %a.addr, align 8
524f4787e3SNikita Popov  store ptr %b, ptr %b.addr, align 8
534f4787e3SNikita Popov  store i32 199, ptr %N.addr, align 4
544f4787e3SNikita Popov  call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @2, i32 3, ptr @.omp_outlined., ptr nonnull %N.addr, ptr nonnull %a.addr, ptr nonnull %b.addr)
5517207872SJohannes Doerfert  ret void
5617207872SJohannes Doerfert}
5717207872SJohannes Doerfert
5817207872SJohannes Doerfert; FIXME: %N should not be loaded but 199 should be used.
5917207872SJohannes Doerfert
604f4787e3SNikita Popovdefine internal void @.omp_outlined.(ptr noalias nocapture readonly %.global_tid., ptr noalias nocapture readnone %.bound_tid., ptr nocapture nonnull readonly align 4 dereferenceable(4) %N, ptr nocapture nonnull readonly align 8 dereferenceable(8) %a, ptr nocapture nonnull readonly align 8 dereferenceable(8) %b) #1 {
61846709b2SNikita Popov; TUNIT: Function Attrs: alwaysinline nofree norecurse nounwind uwtable
62846709b2SNikita Popov; TUNIT-LABEL: define {{[^@]+}}@.omp_outlined.
63*29441e4fSNikita Popov; TUNIT-SAME: (ptr noalias nofree readonly captures(none) [[DOTGLOBAL_TID_:%.*]], ptr noalias nofree readnone captures(none) [[DOTBOUND_TID_:%.*]], ptr noalias nofree noundef nonnull readnone align 4 captures(none) dereferenceable(4) [[N:%.*]], ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[A:%.*]], ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[B:%.*]]) #[[ATTR1:[0-9]+]] {
64846709b2SNikita Popov; TUNIT-NEXT:  entry:
65846709b2SNikita Popov; TUNIT-NEXT:    [[DOTOMP_LB:%.*]] = alloca i32, align 4
66846709b2SNikita Popov; TUNIT-NEXT:    [[DOTOMP_UB:%.*]] = alloca i32, align 4
67846709b2SNikita Popov; TUNIT-NEXT:    [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
68846709b2SNikita Popov; TUNIT-NEXT:    [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
69846709b2SNikita Popov; TUNIT-NEXT:    br label [[OMP_PRECOND_THEN:%.*]]
70846709b2SNikita Popov; TUNIT:       omp.precond.then:
71*29441e4fSNikita Popov; TUNIT-NEXT:    call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_LB]]) #[[ATTR3:[0-9]+]]
724f4787e3SNikita Popov; TUNIT-NEXT:    store i32 0, ptr [[DOTOMP_LB]], align 4
73*29441e4fSNikita Popov; TUNIT-NEXT:    call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_UB]]) #[[ATTR3]]
744f4787e3SNikita Popov; TUNIT-NEXT:    store i32 197, ptr [[DOTOMP_UB]], align 4
75*29441e4fSNikita Popov; TUNIT-NEXT:    call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_STRIDE]]) #[[ATTR3]]
764f4787e3SNikita Popov; TUNIT-NEXT:    store i32 1, ptr [[DOTOMP_STRIDE]], align 4
77*29441e4fSNikita Popov; TUNIT-NEXT:    call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_IS_LAST]]) #[[ATTR3]]
784f4787e3SNikita Popov; TUNIT-NEXT:    store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
7956be9123SJohannes Doerfert; TUNIT-NEXT:    [[TMP0:%.*]] = load i32, ptr [[DOTGLOBAL_TID_]], align 4
8056be9123SJohannes Doerfert; TUNIT-NEXT:    call void @__kmpc_for_static_init_4(ptr noundef nonnull align 8 dereferenceable(24) @[[GLOB1]], i32 [[TMP0]], i32 noundef 34, ptr noundef nonnull align 4 dereferenceable(4) [[DOTOMP_IS_LAST]], ptr noundef nonnull align 4 dereferenceable(4) [[DOTOMP_LB]], ptr noundef nonnull align 4 dereferenceable(4) [[DOTOMP_UB]], ptr noundef nonnull align 4 dereferenceable(4) [[DOTOMP_STRIDE]], i32 noundef 1, i32 noundef 1)
8156be9123SJohannes Doerfert; TUNIT-NEXT:    [[TMP1:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
8256be9123SJohannes Doerfert; TUNIT-NEXT:    [[CMP4:%.*]] = icmp sgt i32 [[TMP1]], 197
8356be9123SJohannes Doerfert; TUNIT-NEXT:    [[COND:%.*]] = select i1 [[CMP4]], i32 197, i32 [[TMP1]]
844f4787e3SNikita Popov; TUNIT-NEXT:    store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
8556be9123SJohannes Doerfert; TUNIT-NEXT:    [[TMP2:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
8656be9123SJohannes Doerfert; TUNIT-NEXT:    [[CMP513:%.*]] = icmp sgt i32 [[TMP2]], [[COND]]
87846709b2SNikita Popov; TUNIT-NEXT:    br i1 [[CMP513]], label [[OMP_LOOP_EXIT:%.*]], label [[OMP_INNER_FOR_BODY_LR_PH:%.*]]
88846709b2SNikita Popov; TUNIT:       omp.inner.for.body.lr.ph:
8956be9123SJohannes Doerfert; TUNIT-NEXT:    [[TMP3:%.*]] = load ptr, ptr [[B]], align 8
9056be9123SJohannes Doerfert; TUNIT-NEXT:    [[TMP4:%.*]] = load ptr, ptr [[A]], align 8
9156be9123SJohannes Doerfert; TUNIT-NEXT:    [[TMP5:%.*]] = sext i32 [[TMP2]] to i64
9256be9123SJohannes Doerfert; TUNIT-NEXT:    [[TMP6:%.*]] = sext i32 [[COND]] to i64
93846709b2SNikita Popov; TUNIT-NEXT:    br label [[OMP_INNER_FOR_BODY:%.*]]
94846709b2SNikita Popov; TUNIT:       omp.inner.for.body:
9556be9123SJohannes Doerfert; TUNIT-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[OMP_INNER_FOR_BODY]] ], [ [[TMP5]], [[OMP_INNER_FOR_BODY_LR_PH]] ]
96846709b2SNikita Popov; TUNIT-NEXT:    [[INDVARS_IV_NEXT]] = add nsw i64 [[INDVARS_IV]], 1
9756be9123SJohannes Doerfert; TUNIT-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[TMP3]], i64 [[INDVARS_IV_NEXT]]
9856be9123SJohannes Doerfert; TUNIT-NEXT:    [[TMP7:%.*]] = load float, ptr [[ARRAYIDX]], align 4
9956be9123SJohannes Doerfert; TUNIT-NEXT:    [[CONV7:%.*]] = fadd float [[TMP7]], 1.000000e+00
10056be9123SJohannes Doerfert; TUNIT-NEXT:    [[ARRAYIDX9:%.*]] = getelementptr inbounds float, ptr [[TMP4]], i64 [[INDVARS_IV_NEXT]]
1014f4787e3SNikita Popov; TUNIT-NEXT:    store float [[CONV7]], ptr [[ARRAYIDX9]], align 4
10256be9123SJohannes Doerfert; TUNIT-NEXT:    [[CMP5:%.*]] = icmp slt i64 [[INDVARS_IV]], [[TMP6]]
103846709b2SNikita Popov; TUNIT-NEXT:    br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY]], label [[OMP_LOOP_EXIT]]
104846709b2SNikita Popov; TUNIT:       omp.loop.exit:
10556be9123SJohannes Doerfert; TUNIT-NEXT:    call void @__kmpc_for_static_fini(ptr noundef nonnull align 8 dereferenceable(24) @[[GLOB1]], i32 [[TMP0]])
106*29441e4fSNikita Popov; TUNIT-NEXT:    call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_IS_LAST]])
107*29441e4fSNikita Popov; TUNIT-NEXT:    call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_STRIDE]])
108*29441e4fSNikita Popov; TUNIT-NEXT:    call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_UB]])
109*29441e4fSNikita Popov; TUNIT-NEXT:    call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_LB]])
110846709b2SNikita Popov; TUNIT-NEXT:    br label [[OMP_PRECOND_END:%.*]]
111846709b2SNikita Popov; TUNIT:       omp.precond.end:
112846709b2SNikita Popov; TUNIT-NEXT:    ret void
113e87f10a7SJohannes Doerfert;
114846709b2SNikita Popov; CGSCC: Function Attrs: alwaysinline nofree norecurse nounwind uwtable
115846709b2SNikita Popov; CGSCC-LABEL: define {{[^@]+}}@.omp_outlined.
116*29441e4fSNikita Popov; CGSCC-SAME: (ptr noalias nofree readonly captures(none) [[DOTGLOBAL_TID_:%.*]], ptr noalias nofree readnone captures(none) [[DOTBOUND_TID_:%.*]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[N:%.*]], ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[A:%.*]], ptr noalias nofree noundef nonnull readonly align 8 captures(none) dereferenceable(8) [[B:%.*]]) #[[ATTR1:[0-9]+]] {
117846709b2SNikita Popov; CGSCC-NEXT:  entry:
118846709b2SNikita Popov; CGSCC-NEXT:    [[DOTOMP_LB:%.*]] = alloca i32, align 4
119846709b2SNikita Popov; CGSCC-NEXT:    [[DOTOMP_UB:%.*]] = alloca i32, align 4
120846709b2SNikita Popov; CGSCC-NEXT:    [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
121846709b2SNikita Popov; CGSCC-NEXT:    [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1224f4787e3SNikita Popov; CGSCC-NEXT:    [[TMP0:%.*]] = load i32, ptr [[N]], align 4
123846709b2SNikita Popov; CGSCC-NEXT:    [[SUB2:%.*]] = add nsw i32 [[TMP0]], -2
124846709b2SNikita Popov; CGSCC-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[TMP0]], 1
125846709b2SNikita Popov; CGSCC-NEXT:    br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
126846709b2SNikita Popov; CGSCC:       omp.precond.then:
127*29441e4fSNikita Popov; CGSCC-NEXT:    call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_LB]]) #[[ATTR3:[0-9]+]]
1284f4787e3SNikita Popov; CGSCC-NEXT:    store i32 0, ptr [[DOTOMP_LB]], align 4
129*29441e4fSNikita Popov; CGSCC-NEXT:    call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_UB]]) #[[ATTR3]]
1304f4787e3SNikita Popov; CGSCC-NEXT:    store i32 [[SUB2]], ptr [[DOTOMP_UB]], align 4
131*29441e4fSNikita Popov; CGSCC-NEXT:    call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_STRIDE]]) #[[ATTR3]]
1324f4787e3SNikita Popov; CGSCC-NEXT:    store i32 1, ptr [[DOTOMP_STRIDE]], align 4
133*29441e4fSNikita Popov; CGSCC-NEXT:    call void @llvm.lifetime.start.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_IS_LAST]]) #[[ATTR3]]
1344f4787e3SNikita Popov; CGSCC-NEXT:    store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
13556be9123SJohannes Doerfert; CGSCC-NEXT:    [[TMP1:%.*]] = load i32, ptr [[DOTGLOBAL_TID_]], align 4
13656be9123SJohannes Doerfert; CGSCC-NEXT:    call void @__kmpc_for_static_init_4(ptr noundef nonnull align 8 dereferenceable(24) @[[GLOB1]], i32 [[TMP1]], i32 noundef 34, ptr noundef nonnull align 4 dereferenceable(4) [[DOTOMP_IS_LAST]], ptr noundef nonnull align 4 dereferenceable(4) [[DOTOMP_LB]], ptr noundef nonnull align 4 dereferenceable(4) [[DOTOMP_UB]], ptr noundef nonnull align 4 dereferenceable(4) [[DOTOMP_STRIDE]], i32 noundef 1, i32 noundef 1)
13756be9123SJohannes Doerfert; CGSCC-NEXT:    [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
13856be9123SJohannes Doerfert; CGSCC-NEXT:    [[CMP4:%.*]] = icmp sgt i32 [[TMP2]], [[SUB2]]
13956be9123SJohannes Doerfert; CGSCC-NEXT:    [[COND:%.*]] = select i1 [[CMP4]], i32 [[SUB2]], i32 [[TMP2]]
1404f4787e3SNikita Popov; CGSCC-NEXT:    store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
14156be9123SJohannes Doerfert; CGSCC-NEXT:    [[TMP3:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
14256be9123SJohannes Doerfert; CGSCC-NEXT:    [[CMP513:%.*]] = icmp sgt i32 [[TMP3]], [[COND]]
143846709b2SNikita Popov; CGSCC-NEXT:    br i1 [[CMP513]], label [[OMP_LOOP_EXIT:%.*]], label [[OMP_INNER_FOR_BODY_LR_PH:%.*]]
144846709b2SNikita Popov; CGSCC:       omp.inner.for.body.lr.ph:
14556be9123SJohannes Doerfert; CGSCC-NEXT:    [[TMP4:%.*]] = load ptr, ptr [[B]], align 8
14656be9123SJohannes Doerfert; CGSCC-NEXT:    [[TMP5:%.*]] = load ptr, ptr [[A]], align 8
14756be9123SJohannes Doerfert; CGSCC-NEXT:    [[TMP6:%.*]] = sext i32 [[TMP3]] to i64
14856be9123SJohannes Doerfert; CGSCC-NEXT:    [[TMP7:%.*]] = sext i32 [[COND]] to i64
149846709b2SNikita Popov; CGSCC-NEXT:    br label [[OMP_INNER_FOR_BODY:%.*]]
150846709b2SNikita Popov; CGSCC:       omp.inner.for.body:
15156be9123SJohannes Doerfert; CGSCC-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[OMP_INNER_FOR_BODY]] ], [ [[TMP6]], [[OMP_INNER_FOR_BODY_LR_PH]] ]
152846709b2SNikita Popov; CGSCC-NEXT:    [[INDVARS_IV_NEXT]] = add nsw i64 [[INDVARS_IV]], 1
15356be9123SJohannes Doerfert; CGSCC-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[TMP4]], i64 [[INDVARS_IV_NEXT]]
15456be9123SJohannes Doerfert; CGSCC-NEXT:    [[TMP8:%.*]] = load float, ptr [[ARRAYIDX]], align 4
15556be9123SJohannes Doerfert; CGSCC-NEXT:    [[CONV7:%.*]] = fadd float [[TMP8]], 1.000000e+00
15656be9123SJohannes Doerfert; CGSCC-NEXT:    [[ARRAYIDX9:%.*]] = getelementptr inbounds float, ptr [[TMP5]], i64 [[INDVARS_IV_NEXT]]
1574f4787e3SNikita Popov; CGSCC-NEXT:    store float [[CONV7]], ptr [[ARRAYIDX9]], align 4
15856be9123SJohannes Doerfert; CGSCC-NEXT:    [[CMP5:%.*]] = icmp slt i64 [[INDVARS_IV]], [[TMP7]]
159846709b2SNikita Popov; CGSCC-NEXT:    br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY]], label [[OMP_LOOP_EXIT]]
160846709b2SNikita Popov; CGSCC:       omp.loop.exit:
16156be9123SJohannes Doerfert; CGSCC-NEXT:    call void @__kmpc_for_static_fini(ptr noundef nonnull align 8 dereferenceable(24) @[[GLOB1]], i32 [[TMP1]])
162*29441e4fSNikita Popov; CGSCC-NEXT:    call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_IS_LAST]])
163*29441e4fSNikita Popov; CGSCC-NEXT:    call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_STRIDE]])
164*29441e4fSNikita Popov; CGSCC-NEXT:    call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_UB]])
165*29441e4fSNikita Popov; CGSCC-NEXT:    call void @llvm.lifetime.end.p0(i64 noundef 4, ptr nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[DOTOMP_LB]])
166846709b2SNikita Popov; CGSCC-NEXT:    br label [[OMP_PRECOND_END]]
167846709b2SNikita Popov; CGSCC:       omp.precond.end:
168846709b2SNikita Popov; CGSCC-NEXT:    ret void
16917207872SJohannes Doerfert;
17017207872SJohannes Doerfertentry:
17117207872SJohannes Doerfert  %.omp.lb = alloca i32, align 4
17217207872SJohannes Doerfert  %.omp.ub = alloca i32, align 4
17317207872SJohannes Doerfert  %.omp.stride = alloca i32, align 4
17417207872SJohannes Doerfert  %.omp.is_last = alloca i32, align 4
1754f4787e3SNikita Popov  %0 = load i32, ptr %N, align 4
17617207872SJohannes Doerfert  %sub2 = add nsw i32 %0, -2
17717207872SJohannes Doerfert  %cmp = icmp sgt i32 %0, 1
17817207872SJohannes Doerfert  br i1 %cmp, label %omp.precond.then, label %omp.precond.end
17917207872SJohannes Doerfert
18017207872SJohannes Doerfertomp.precond.then:                                 ; preds = %entry
1814f4787e3SNikita Popov  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %.omp.lb) #3
1824f4787e3SNikita Popov  store i32 0, ptr %.omp.lb, align 4
1834f4787e3SNikita Popov  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %.omp.ub) #3
1844f4787e3SNikita Popov  store i32 %sub2, ptr %.omp.ub, align 4
1854f4787e3SNikita Popov  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %.omp.stride) #3
1864f4787e3SNikita Popov  store i32 1, ptr %.omp.stride, align 4
1874f4787e3SNikita Popov  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %.omp.is_last) #3
1884f4787e3SNikita Popov  store i32 0, ptr %.omp.is_last, align 4
1894f4787e3SNikita Popov  %1 = load i32, ptr %.global_tid., align 4
1904f4787e3SNikita Popov  call void @__kmpc_for_static_init_4(ptr nonnull @1, i32 %1, i32 34, ptr nonnull %.omp.is_last, ptr nonnull %.omp.lb, ptr nonnull %.omp.ub, ptr nonnull %.omp.stride, i32 1, i32 1) #3
1914f4787e3SNikita Popov  %2 = load i32, ptr %.omp.ub, align 4
1924f4787e3SNikita Popov  %cmp4 = icmp sgt i32 %2, %sub2
1934f4787e3SNikita Popov  %cond = select i1 %cmp4, i32 %sub2, i32 %2
1944f4787e3SNikita Popov  store i32 %cond, ptr %.omp.ub, align 4
1954f4787e3SNikita Popov  %3 = load i32, ptr %.omp.lb, align 4
1964f4787e3SNikita Popov  %cmp513 = icmp sgt i32 %3, %cond
19717207872SJohannes Doerfert  br i1 %cmp513, label %omp.loop.exit, label %omp.inner.for.body.lr.ph
19817207872SJohannes Doerfert
19917207872SJohannes Doerfertomp.inner.for.body.lr.ph:                         ; preds = %omp.precond.then
2004f4787e3SNikita Popov  %4 = load ptr, ptr %b, align 8
2014f4787e3SNikita Popov  %5 = load ptr, ptr %a, align 8
2024f4787e3SNikita Popov  %6 = sext i32 %3 to i64
2034f4787e3SNikita Popov  %7 = sext i32 %cond to i64
20417207872SJohannes Doerfert  br label %omp.inner.for.body
20517207872SJohannes Doerfert
20617207872SJohannes Doerfertomp.inner.for.body:                               ; preds = %omp.inner.for.body, %omp.inner.for.body.lr.ph
2074f4787e3SNikita Popov  %indvars.iv = phi i64 [ %indvars.iv.next, %omp.inner.for.body ], [ %6, %omp.inner.for.body.lr.ph ]
20817207872SJohannes Doerfert  %indvars.iv.next = add nsw i64 %indvars.iv, 1
2094f4787e3SNikita Popov  %arrayidx = getelementptr inbounds float, ptr %4, i64 %indvars.iv.next
2104f4787e3SNikita Popov  %8 = load float, ptr %arrayidx, align 4
2114f4787e3SNikita Popov  %conv7 = fadd float %8, 1.000000e+00
2124f4787e3SNikita Popov  %arrayidx9 = getelementptr inbounds float, ptr %5, i64 %indvars.iv.next
2134f4787e3SNikita Popov  store float %conv7, ptr %arrayidx9, align 4
2144f4787e3SNikita Popov  %cmp5 = icmp slt i64 %indvars.iv, %7
21517207872SJohannes Doerfert  br i1 %cmp5, label %omp.inner.for.body, label %omp.loop.exit
21617207872SJohannes Doerfert
21717207872SJohannes Doerfertomp.loop.exit:                                    ; preds = %omp.inner.for.body, %omp.precond.then
2184f4787e3SNikita Popov  call void @__kmpc_for_static_fini(ptr nonnull @1, i32 %1)
2194f4787e3SNikita Popov  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %.omp.is_last) #3
2204f4787e3SNikita Popov  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %.omp.stride) #3
2214f4787e3SNikita Popov  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %.omp.ub) #3
2224f4787e3SNikita Popov  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %.omp.lb) #3
22317207872SJohannes Doerfert  br label %omp.precond.end
22417207872SJohannes Doerfert
22517207872SJohannes Doerfertomp.precond.end:                                  ; preds = %omp.loop.exit, %entry
22617207872SJohannes Doerfert  ret void
22717207872SJohannes Doerfert}
22817207872SJohannes Doerfert
22917207872SJohannes Doerfert; Function Attrs: argmemonly nounwind willreturn
2304f4787e3SNikita Popovdeclare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
23117207872SJohannes Doerfert
23217207872SJohannes Doerfert; Function Attrs: argmemonly nounwind willreturn
2334f4787e3SNikita Popovdeclare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
23417207872SJohannes Doerfert
2354f4787e3SNikita Popovdeclare dso_local void @__kmpc_for_static_init_4(ptr, i32, i32, ptr, ptr, ptr, ptr, i32, i32) local_unnamed_addr
23617207872SJohannes Doerfert
23717207872SJohannes Doerfert; Function Attrs: nounwind
2384f4787e3SNikita Popovdeclare void @__kmpc_for_static_fini(ptr, i32) local_unnamed_addr #3
23917207872SJohannes Doerfert
24017207872SJohannes Doerfert; Function Attrs: nounwind
2414f4787e3SNikita Popovdeclare !callback !1 void @__kmpc_fork_call(ptr, i32, ptr, ...) local_unnamed_addr #3
24217207872SJohannes Doerfert
24317207872SJohannes Doerfertattributes #0 = { nounwind uwtable }
24417207872SJohannes Doerfertattributes #1 = { alwaysinline nofree norecurse nounwind uwtable }
24517207872SJohannes Doerfertattributes #2 = { nounwind }
24617207872SJohannes Doerfert
24717207872SJohannes Doerfert!llvm.module.flags = !{!0}
24817207872SJohannes Doerfert
24917207872SJohannes Doerfert!0 = !{i32 7, !"openmp", i32 50}
25017207872SJohannes Doerfert!1 = !{!2}
25117207872SJohannes Doerfert!2 = !{i64 2, i64 -1, i64 -1, i1 true}
25217207872SJohannes Doerfert;.
253cd3a4c31SJohannes Doerfert; TUNIT: attributes #[[ATTR0]] = { nounwind uwtable }
254cd3a4c31SJohannes Doerfert; TUNIT: attributes #[[ATTR1]] = { alwaysinline nofree norecurse nounwind uwtable }
255cd3a4c31SJohannes Doerfert; TUNIT: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
256cd3a4c31SJohannes Doerfert; TUNIT: attributes #[[ATTR3]] = { memory(readwrite) }
25717207872SJohannes Doerfert;.
258cd3a4c31SJohannes Doerfert; CGSCC: attributes #[[ATTR0]] = { nounwind uwtable }
259cd3a4c31SJohannes Doerfert; CGSCC: attributes #[[ATTR1]] = { alwaysinline nofree norecurse nounwind uwtable }
260cd3a4c31SJohannes Doerfert; CGSCC: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
261cd3a4c31SJohannes Doerfert; CGSCC: attributes #[[ATTR3]] = { memory(readwrite) }
262cd3a4c31SJohannes Doerfert;.
263cd3a4c31SJohannes Doerfert; TUNIT: [[META0:![0-9]+]] = !{i32 7, !"openmp", i32 50}
264cd3a4c31SJohannes Doerfert; TUNIT: [[META1:![0-9]+]] = !{[[META2:![0-9]+]]}
265cd3a4c31SJohannes Doerfert; TUNIT: [[META2]] = !{i64 2, i64 -1, i64 -1, i1 true}
266cd3a4c31SJohannes Doerfert;.
267cd3a4c31SJohannes Doerfert; CGSCC: [[META0:![0-9]+]] = !{i32 7, !"openmp", i32 50}
268cd3a4c31SJohannes Doerfert; CGSCC: [[META1:![0-9]+]] = !{[[META2:![0-9]+]]}
269cd3a4c31SJohannes Doerfert; CGSCC: [[META2]] = !{i64 2, i64 -1, i64 -1, i1 true}
27017207872SJohannes Doerfert;.
27123333bb6SJohannes Doerfert;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
27223333bb6SJohannes Doerfert; CHECK: {{.*}}
273