2020-01-01 01:41:57 +08:00
|
|
|
// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu -fnoopenmp-use-tls -std=c++98 | FileCheck %s
|
2017-12-30 02:07:07 +08:00
|
|
|
|
2020-01-01 01:41:57 +08:00
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu -fnoopenmp-use-tls -std=c++98 | FileCheck --check-prefix SIMD-ONLY0 %s
|
2017-12-30 02:07:07 +08:00
|
|
|
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
|
2017-07-17 21:30:36 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
struct S {
|
|
|
|
float a;
|
|
|
|
S() : a(0.0f) {}
|
|
|
|
~S() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
#pragma omp declare reduction(+:S:omp_out.a += omp_in.a) initializer(omp_priv = omp_orig)
|
|
|
|
|
|
|
|
float g;
|
|
|
|
|
|
|
|
int a;
|
|
|
|
#pragma omp threadprivate(a)
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int i, n;
|
|
|
|
float a[100], b[100], sum, e[argc + 100];
|
|
|
|
S c[100];
|
|
|
|
float &d = g;
|
|
|
|
|
|
|
|
/* Some initializations */
|
|
|
|
n = 100;
|
|
|
|
for (i=0; i < n; i++)
|
|
|
|
a[i] = b[i] = i * 1.0;
|
|
|
|
sum = 0.0;
|
|
|
|
|
|
|
|
#pragma omp taskloop simd reduction(+:sum, c[:n], d, e)
|
|
|
|
for (i=0; i < n; i++) {
|
|
|
|
sum = sum + (a[i] * b[i]);
|
|
|
|
c[i].a = i*i;
|
|
|
|
d += i*i;
|
|
|
|
e[i] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @main(
|
2017-07-17 22:22:34 +08:00
|
|
|
// CHECK: [[RETVAL:%.*]] = alloca i32,
|
|
|
|
// CHECK: [[ARGC_ADDR:%.*]] = alloca i32,
|
|
|
|
// CHECK: [[ARGV_ADDR:%.*]] = alloca i8**,
|
|
|
|
// CHECK: [[I:%.*]] = alloca i32,
|
|
|
|
// CHECK: [[N:%.*]] = alloca i32,
|
|
|
|
// CHECK: [[A:%.*]] = alloca [100 x float],
|
|
|
|
// CHECK: [[B:%.*]] = alloca [100 x float],
|
|
|
|
// CHECK: [[SUM:%.*]] = alloca float,
|
|
|
|
// CHECK: [[SAVED_STACK:%.*]] = alloca i8*,
|
|
|
|
// CHECK: [[C:%.*]] = alloca [100 x %struct.S],
|
|
|
|
// CHECK: [[D:%.*]] = alloca float*,
|
|
|
|
// CHECK: [[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK: [[DOTRD_INPUT_:%.*]] = alloca [4 x %struct.kmp_taskred_input_t],
|
2017-12-05 05:30:42 +08:00
|
|
|
// CHECK: alloca i32,
|
2017-07-17 22:22:34 +08:00
|
|
|
// CHECK: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32,
|
|
|
|
// CHECK: [[DOTCAPTURE_EXPR_9:%.*]] = alloca i32,
|
2018-10-05 23:08:53 +08:00
|
|
|
// CHECK: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t*
|
2017-07-17 22:22:34 +08:00
|
|
|
// CHECK: store i32 0, i32* [[RETVAL]],
|
|
|
|
// CHECK: store i32 [[ARGC:%.*]], i32* [[ARGC_ADDR]],
|
|
|
|
// CHECK: store i8** [[ARGV:%.*]], i8*** [[ARGV_ADDR]],
|
|
|
|
// CHECK: [[TMP1:%.*]] = load i32, i32* [[ARGC_ADDR]],
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: [[ADD:%.*]] = add nsw i32 [[TMP1]], 100
|
|
|
|
// CHECK: [[TMP2:%.*]] = zext i32 [[ADD]] to i64
|
|
|
|
// CHECK: [[VLA:%.+]] = alloca float, i64 %
|
|
|
|
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: call void @__kmpc_taskgroup(%struct.ident_t*
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: [[TMP21:%.*]] = bitcast float* [[SUM]] to i8*
|
|
|
|
// CHECK-DAG: store i8* [[TMP21]], i8** [[TMP20:%[^,]+]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP20]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_:%.+]], i32 0, i32 0
|
|
|
|
// CHECK-DAG: [[TMP21:%.*]] = bitcast float* [[SUM]] to i8*
|
|
|
|
// CHECK-DAG: store i8* [[TMP21]], i8** [[TMP20:%[^,]+]],
|
|
|
|
// CHECK-DAG: [[TMP20]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 1
|
|
|
|
// CHECK-DAG: [[TMP22:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 2
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: store i64 4, i64* [[TMP22]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP23:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 3
|
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_INIT1:.+]] to i8*), i8** [[TMP23]],
|
|
|
|
// CHECK-DAG: [[TMP24:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 4
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: store i8* null, i8** [[TMP24]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP25:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 5
|
2018-01-09 04:09:47 +08:00
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_COMB1:.+]] to i8*), i8** [[TMP25]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP26:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 6
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: [[TMP27:%.*]] = bitcast i32* [[TMP26]] to i8*
|
Change memcpy/memove/memset to have dest and source alignment attributes (Step 1).
Summary:
Upstream LLVM is changing the the prototypes of the @llvm.memcpy/memmove/memset
intrinsics. This change updates the Clang tests for this change.
The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument
which is required to be a constant integer. It represents the alignment of the
dest (and source), and so must be the minimum of the actual alignment of the
two.
This change removes the alignment argument in favour of placing the alignment
attribute on the source and destination pointers of the memory intrinsic call.
For example, code which used to read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false)
will now read
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false)
At this time the source and destination alignments must be the same (Step 1).
Step 2 of the change, to be landed shortly, will relax that contraint and allow
the source and destination to have different alignments.
llvm-svn: 322964
2018-01-20 01:12:54 +08:00
|
|
|
// CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP27]], i8 0, i64 4, i1 false)
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: [[ARRAYIDX5:%.*]] = getelementptr inbounds [100 x %struct.S], [100 x %struct.S]* [[C]], i64 0, i64 0
|
|
|
|
// CHECK-DAG: [[LB_ADD_LEN:%.*]] = add nsw i64 -1, %
|
|
|
|
// CHECK-DAG: [[ARRAYIDX6:%.*]] = getelementptr inbounds [100 x %struct.S], [100 x %struct.S]* [[C]], i64 0, i64 [[LB_ADD_LEN]]
|
|
|
|
// CHECK-DAG: [[TMP31:%.*]] = bitcast %struct.S* [[ARRAYIDX5]] to i8*
|
|
|
|
// CHECK-DAG: store i8* [[TMP31]], i8** [[TMP28:%[^,]+]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP28]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_4:%.+]], i32 0, i32 0
|
|
|
|
// CHECK-DAG: [[TMP31:%.*]] = bitcast %struct.S* [[ARRAYIDX5]] to i8*
|
|
|
|
// CHECK-DAG: store i8* [[TMP31]], i8** [[TMP28:%[^,]+]],
|
|
|
|
// CHECK-DAG: [[TMP28]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 1
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: [[TMP32:%.*]] = ptrtoint %struct.S* [[ARRAYIDX6]] to i64
|
|
|
|
// CHECK-DAG: [[TMP33:%.*]] = ptrtoint %struct.S* [[ARRAYIDX5]] to i64
|
|
|
|
// CHECK-DAG: [[TMP34:%.*]] = sub i64 [[TMP32]], [[TMP33]]
|
|
|
|
// CHECK-DAG: [[TMP35:%.*]] = sdiv exact i64 [[TMP34]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64)
|
|
|
|
// CHECK-DAG: [[TMP36:%.*]] = add nuw i64 [[TMP35]], 1
|
|
|
|
// CHECK-DAG: [[TMP37:%.*]] = mul nuw i64 [[TMP36]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64)
|
|
|
|
// CHECK-DAG: store i64 [[TMP37]], i64* [[TMP38:%[^,]+]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP38]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 2
|
|
|
|
// CHECK-DAG: [[TMP39:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 3
|
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_INIT2:.+]] to i8*), i8** [[TMP39]],
|
|
|
|
// CHECK-DAG: [[TMP40:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 4
|
2018-01-09 04:09:47 +08:00
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*)* @[[RED_FINI2:.+]] to i8*), i8** [[TMP40]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP41:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 5
|
2018-01-09 04:09:47 +08:00
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_COMB2:.+]] to i8*), i8** [[TMP41]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP42:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 6
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: store i32 1, i32* [[TMP42]],
|
|
|
|
// CHECK-DAG: [[TMP44:%.*]] = load float*, float** [[D]],
|
|
|
|
// CHECK-DAG: [[TMP45:%.*]] = bitcast float* [[TMP44]] to i8*
|
|
|
|
// CHECK-DAG: store i8* [[TMP45]], i8** [[TMP43:%[^,]+]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP43]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_7:%.+]], i32 0, i32 0
|
|
|
|
// CHECK-DAG: [[TMP45:%.*]] = bitcast float* [[TMP44]] to i8*
|
|
|
|
// CHECK-DAG: store i8* [[TMP45]], i8** [[TMP43:%[^,]+]],
|
|
|
|
// CHECK-DAG: [[TMP43]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 1
|
|
|
|
// CHECK-DAG: [[TMP46:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 2
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: store i64 4, i64* [[TMP46]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP47:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 3
|
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_INIT3:.+]] to i8*), i8** [[TMP47]],
|
|
|
|
// CHECK-DAG: [[TMP48:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 4
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: store i8* null, i8** [[TMP48]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP49:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 5
|
2018-01-09 04:09:47 +08:00
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_COMB3:.+]] to i8*), i8** [[TMP49]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP50:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 6
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: [[TMP51:%.*]] = bitcast i32* [[TMP50]] to i8*
|
Change memcpy/memove/memset to have dest and source alignment attributes (Step 1).
Summary:
Upstream LLVM is changing the the prototypes of the @llvm.memcpy/memmove/memset
intrinsics. This change updates the Clang tests for this change.
The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument
which is required to be a constant integer. It represents the alignment of the
dest (and source), and so must be the minimum of the actual alignment of the
two.
This change removes the alignment argument in favour of placing the alignment
attribute on the source and destination pointers of the memory intrinsic call.
For example, code which used to read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false)
will now read
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false)
At this time the source and destination alignments must be the same (Step 1).
Step 2 of the change, to be landed shortly, will relax that contraint and allow
the source and destination to have different alignments.
llvm-svn: 322964
2018-01-20 01:12:54 +08:00
|
|
|
// CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP51]], i8 0, i64 4, i1 false)
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: [[TMP53:%.*]] = bitcast float* [[VLA]] to i8*
|
|
|
|
// CHECK-DAG: store i8* [[TMP53]], i8** [[TMP52:%[^,]+]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP52]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_8:%.+]], i32 0, i32 0
|
|
|
|
// CHECK-DAG: [[TMP53:%.*]] = bitcast float* [[VLA]] to i8*
|
|
|
|
// CHECK-DAG: store i8* [[TMP53]], i8** [[TMP52:%[^,]+]],
|
|
|
|
// CHECK-DAG: [[TMP52]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 1
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: [[TMP54:%.*]] = mul nuw i64 [[TMP2]], 4
|
|
|
|
// CHECK-DAG: [[TMP55:%.*]] = udiv exact i64 [[TMP54]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64)
|
|
|
|
// CHECK-DAG: store i64 [[TMP54]], i64* [[TMP56:%[^,]+]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP56]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 2
|
|
|
|
// CHECK-DAG: [[TMP57:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 3
|
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_INIT4:.+]] to i8*), i8** [[TMP57]],
|
|
|
|
// CHECK-DAG: [[TMP58:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 4
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: store i8* null, i8** [[TMP58]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP59:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 5
|
2018-01-09 04:09:47 +08:00
|
|
|
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_COMB4:.+]] to i8*), i8** [[TMP59]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[TMP60:%.*]] = getelementptr inbounds %struct.kmp_taskred_input_t, %struct.kmp_taskred_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 6
|
2017-07-17 22:47:59 +08:00
|
|
|
// CHECK-DAG: store i32 1, i32* [[TMP60]],
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK-DAG: [[DOTRD_INPUT_GEP_]] = getelementptr inbounds [4 x %struct.kmp_taskred_input_t], [4 x %struct.kmp_taskred_input_t]* [[DOTRD_INPUT_]], i64 0, i64
|
|
|
|
// CHECK-DAG: [[DOTRD_INPUT_GEP_4]] = getelementptr inbounds [4 x %struct.kmp_taskred_input_t], [4 x %struct.kmp_taskred_input_t]* [[DOTRD_INPUT_]], i64 0, i64
|
|
|
|
// CHECK-DAG: [[DOTRD_INPUT_GEP_7]] = getelementptr inbounds [4 x %struct.kmp_taskred_input_t], [4 x %struct.kmp_taskred_input_t]* [[DOTRD_INPUT_]], i64 0, i64
|
|
|
|
// CHECK-DAG: [[DOTRD_INPUT_GEP_8]] = getelementptr inbounds [4 x %struct.kmp_taskred_input_t], [4 x %struct.kmp_taskred_input_t]* [[DOTRD_INPUT_]], i64 0, i64
|
|
|
|
// CHECK: [[TMP61:%.*]] = bitcast [4 x %struct.kmp_taskred_input_t]* [[DOTRD_INPUT_]] to i8*
|
|
|
|
// CHECK: [[TMP62:%.*]] = call i8* @__kmpc_taskred_init(i32 [[TMP0]], i32 4, i8* [[TMP61]])
|
2017-07-17 22:22:34 +08:00
|
|
|
// CHECK: [[TMP63:%.*]] = load i32, i32* [[N]],
|
|
|
|
// CHECK: store i32 [[TMP63]], i32* [[DOTCAPTURE_EXPR_]],
|
|
|
|
// CHECK: [[TMP64:%.*]] = load i32, i32* [[DOTCAPTURE_EXPR_]],
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: [[SUB:%.*]] = sub nsw i32 [[TMP64]], 0
|
|
|
|
// CHECK: [[SUB10:%.*]] = sub nsw i32 [[SUB]], 1
|
|
|
|
// CHECK: [[ADD11:%.*]] = add nsw i32 [[SUB10]], 1
|
|
|
|
// CHECK: [[DIV:%.*]] = sdiv i32 [[ADD11]], 1
|
|
|
|
// CHECK: [[SUB12:%.*]] = sub nsw i32 [[DIV]], 1
|
2017-07-17 22:22:34 +08:00
|
|
|
// CHECK: store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]],
|
2020-03-09 20:55:57 +08:00
|
|
|
// CHECK: [[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* %{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 40, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @{{.+}} to i32 (i32, i8*)*))
|
Do not always request an implicit taskgroup region inside the kmpc_taskloop function
Summary:
For the following code:
```
int i;
#pragma omp taskloop
for (i = 0; i < 100; ++i)
{}
#pragma omp taskloop nogroup
for (i = 0; i < 100; ++i)
{}
```
Clang emits the following LLVM IR:
```
...
call void @__kmpc_taskgroup(%struct.ident_t* @0, i32 %0)
%2 = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 %0, i32 1, i64 80, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @.omp_task_entry. to i32 (i32, i8*)*))
...
call void @__kmpc_taskloop(%struct.ident_t* @0, i32 %0, i8* %2, i32 1, i64* %8, i64* %9, i64 %13, i32 0, i32 0, i64 0, i8* null)
call void @__kmpc_end_taskgroup(%struct.ident_t* @0, i32 %0)
...
%15 = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 %0, i32 1, i64 80, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates.1*)* @.omp_task_entry..2 to i32 (i32, i8*)*))
...
call void @__kmpc_taskloop(%struct.ident_t* @0, i32 %0, i8* %15, i32 1, i64* %21, i64* %22, i64 %26, i32 0, i32 0, i64 0, i8* null)
```
The first set of instructions corresponds to the first taskloop construct. It is important to note that the implicit taskgroup region associated with the taskloop construct has been materialized in our IR: the `__kmpc_taskloop` occurs inside a taskgroup region. Note also that this taskgroup region does not exist in our second taskloop because we are using the `nogroup` clause.
The issue here is the 4th argument of the kmpc_taskloop call, starting from the end, is always a zero. Checking the LLVM OpenMP RT implementation, we see that this argument corresponds to the nogroup parameter:
```
void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
kmp_uint64 *lb, kmp_uint64 *ub, kmp_int64 st, int nogroup,
int sched, kmp_uint64 grainsize, void *task_dup);
```
So basically we always tell to the RT to do another taskgroup region. For the first taskloop, this means that we create two taskgroup regions. For the second example, it means that despite the fact we had a nogroup clause we are going to have a taskgroup region, so we unnecessary wait until all descendant tasks have been executed.
Reviewers: ABataev
Reviewed By: ABataev
Subscribers: rogfer01, cfe-commits
Differential Revision: https://reviews.llvm.org/D53636
llvm-svn: 345180
2018-10-25 03:06:37 +08:00
|
|
|
// CHECK: call void @__kmpc_taskloop(%struct.ident_t* %{{.+}}, i32 [[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, i8* null)
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: call void @__kmpc_end_taskgroup(%struct.ident_t*
|
2017-07-17 21:30:36 +08:00
|
|
|
|
|
|
|
// CHECK: ret i32
|
|
|
|
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK: define internal void @[[RED_INIT1]](i8* noalias %{{.+}}, i8* noalias %{{.+}})
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: store float 0.000000e+00, float* %
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal void @[[RED_COMB1]](i8* %0, i8* %1)
|
2017-07-17 22:53:02 +08:00
|
|
|
// CHECK: fadd float %
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: store float %{{.+}}, float* %
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK: define internal void @[[RED_INIT2]](i8* noalias %{{.+}}, i8* noalias %{{.+}})
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: call i8* @__kmpc_threadprivate_cached(
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK: call void [[OMP_INIT1:@.+]](%struct.S*
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal void [[OMP_COMB1:@.+]](%struct.S* noalias %0, %struct.S* noalias %1)
|
2019-05-21 23:11:58 +08:00
|
|
|
// CHECK: fadd float %
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal void [[OMP_INIT1]](%struct.S* noalias %0, %struct.S* noalias %1)
|
2019-05-21 23:11:58 +08:00
|
|
|
// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal void @[[RED_FINI2]](i8* %0)
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: call i8* @__kmpc_threadprivate_cached(
|
|
|
|
// CHECK: call void @
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal void @[[RED_COMB2]](i8* %0, i8* %1)
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: call i8* @__kmpc_threadprivate_cached(
|
2019-05-21 23:11:58 +08:00
|
|
|
// CHECK: call void [[OMP_COMB1]](
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK: define internal void @[[RED_INIT3]](i8* noalias %{{.+}}, i8* noalias %{{.+}})
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: store float 0.000000e+00, float* %
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal void @[[RED_COMB3]](i8* %0, i8* %1)
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: fadd float %
|
|
|
|
// CHECK: store float %{{.+}}, float* %
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2020-04-24 01:27:03 +08:00
|
|
|
// CHECK: define internal void @[[RED_INIT4]](i8* noalias %{{.+}}, i8* noalias %{{.+}})
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: call i8* @__kmpc_threadprivate_cached(
|
|
|
|
// CHECK: store float 0.000000e+00, float* %
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal void @[[RED_COMB4]](i8* %0, i8* %1)
|
2017-07-17 21:30:36 +08:00
|
|
|
// CHECK: call i8* @__kmpc_threadprivate_cached(
|
|
|
|
// CHECK: fadd float %
|
|
|
|
// CHECK: store float %{{.+}}, float* %
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2018-01-09 04:09:47 +08:00
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_INIT1]]"
|
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_COMB1]]"
|
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_INIT2]]"
|
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_FINI2]]"
|
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_COMB2]]"
|
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_INIT3]]"
|
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_COMB3]]"
|
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_INIT4]]"
|
|
|
|
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_COMB4]]"
|