50 lines · plain
1!RUN: %flang_fc1 -emit-llvm -fopenmp %s -o - | FileCheck %s2 3! Regression test for https://github.com/llvm/llvm-project/issues/1062974 5program bug6 implicit none7 integer :: table(10)8 !$OMP PARALLEL PRIVATE(table)9 table = 5010 if (any(table/=50)) then11 stop 'fail 3'12 end if13 !$OMP END PARALLEL14 print *,'ok'15End Program16 17 18! CHECK-LABEL: define internal void {{.*}}..omp_par(19! CHECK: omp.par.entry:20! CHECK: %[[VAL_9:.*]] = alloca i32, align 421! CHECK: %[[VAL_10:.*]] = load i32, ptr %[[VAL_11:.*]], align 422! CHECK: store i32 %[[VAL_10]], ptr %[[VAL_9]], align 423! CHECK: %[[VAL_12:.*]] = load i32, ptr %[[VAL_9]], align 424! CHECK: %[[PRIV_BOX_ALLOC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 825! ...26! check that we use the private copy of table for the assignment27! CHECK: omp.par.region1:28! CHECK: %[[ELEMENTAL_TMP:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 829! CHECK: %[[TABLE_BOX_ADDR:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 830! CHECK: %[[BOXED_FIFTY:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 831! CHECK: %[[FIFTY:.*]] = alloca i32, i64 1, align 432! CHECK: %[[INTERMEDIATE:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 833! CHECK: %[[TABLE_BOX_ADDR2:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, i64 1, align 834! CHECK: call void @llvm.memcpy.p0.p0.i32(ptr %[[INTERMEDIATE]], ptr %[[PRIV_BOX_ALLOC]], i32 {{4[48]}}, i1 false)35! CHECK: store i32 50, ptr %[[FIFTY]], align 436! CHECK: %[[FIFTY_BOX_VAL:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8 } { ptr undef, i64 4, i32 20240719, i8 0, i8 9, i8 0, i8 0 }, ptr %[[FIFTY]], 037! CHECK: store { ptr, i64, i32, i8, i8, i8, i8 } %[[FIFTY_BOX_VAL]], ptr %[[BOXED_FIFTY]], align {{[48]}}38! CHECK: call void @llvm.memcpy.p0.p0.i32(ptr %[[TABLE_BOX_ADDR2]], ptr %[[INTERMEDIATE]], i32 {{4[48]}}, i1 false)39! CHECK: call void @_FortranAAssign(ptr %[[TABLE_BOX_ADDR2]], ptr %[[BOXED_FIFTY]], ptr @{{.*}}, i32 9)40! CHECK: call void @llvm.memcpy.p0.p0.i32(ptr %[[TABLE_BOX_ADDR]], ptr %[[PRIV_BOX_ALLOC]], i32 {{4[48]}}, i1 false)41! CHECK: %[[PRIV_TABLE:.*]] = call ptr @malloc(i{{(32)|(64)}} 40)42! ...43! check that we use the private copy of table for table/=5044! CHECK: omp.par.region3:45! CHECK: %[[VAL_44:.*]] = sub nsw i64 %{{.*}}, 146! CHECK: %[[VAL_45:.*]] = mul nsw i64 %[[VAL_44]], 147! CHECK: %[[VAL_46:.*]] = mul nsw i64 %[[VAL_45]], 148! CHECK: %[[VAL_47:.*]] = add nsw i64 %[[VAL_46]], 049! CHECK: %[[VAL_48:.*]] = getelementptr i32, ptr %[[PRIV_TABLE]], i64 %[[VAL_47]]50