[PATCH] D51331: [OPENMP] Create non-const ident_t structs.
This revision was automatically updated to reflect the committed changes. Closed by commit rL340934: [OPENMP] Create non-const ident_t objects. (authored by mikerice, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D51331?vs=162776&id=163105#toc Repository: rL LLVM https://reviews.llvm.org/D51331 Files: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/test/OpenMP/distribute_codegen.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp cfe/trunk/test/OpenMP/distribute_simd_codegen.cpp cfe/trunk/test/OpenMP/for_codegen.cpp cfe/trunk/test/OpenMP/for_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/for_lastprivate_codegen.cpp cfe/trunk/test/OpenMP/for_linear_codegen.cpp cfe/trunk/test/OpenMP/for_reduction_codegen.cpp cfe/trunk/test/OpenMP/for_reduction_codegen_UDR.cpp cfe/trunk/test/OpenMP/ordered_codegen.cpp cfe/trunk/test/OpenMP/parallel_codegen.cpp cfe/trunk/test/OpenMP/parallel_copyin_codegen.cpp cfe/trunk/test/OpenMP/parallel_for_codegen.cpp cfe/trunk/test/OpenMP/parallel_num_threads_codegen.cpp cfe/trunk/test/OpenMP/parallel_proc_bind_codegen.cpp cfe/trunk/test/OpenMP/parallel_reduction_codegen.cpp cfe/trunk/test/OpenMP/sections_codegen.cpp cfe/trunk/test/OpenMP/sections_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/sections_lastprivate_codegen.cpp cfe/trunk/test/OpenMP/sections_reduction_codegen.cpp cfe/trunk/test/OpenMP/single_codegen.cpp cfe/trunk/test/OpenMP/single_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/target_parallel_codegen.cpp cfe/trunk/test/OpenMP/target_parallel_for_codegen.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_codegen.cpp cfe/trunk/test/OpenMP/target_parallel_if_codegen.cpp cfe/trunk/test/OpenMP/target_parallel_num_threads_codegen.cpp cfe/trunk/test/OpenMP/target_teams_codegen.cpp cfe/trunk/test/OpenMP/target_teams_distribute_codegen.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_proc_bind_codegen.cpp cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen.cpp cfe/trunk/test/OpenMP/target_teams_num_teams_codegen.cpp cfe/trunk/test/OpenMP/target_teams_thread_limit_codegen.cpp cfe/trunk/test/OpenMP/teams_codegen.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_proc_bind_codegen.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_proc_bind_codegen.cpp cfe/trunk/test/OpenMP/threadprivate_codegen.cpp Index: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp === --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1437,17 +1437,17 @@ template static llvm::GlobalVariable * -createConstantGlobalStruct(CodeGenModule &CGM, QualType Ty, - ArrayRef Data, const Twine &Name, - As &&... Args) { +createGlobalStruct(CodeGenModule &CGM, QualType Ty, bool IsConstant, + ArrayRef Data, const Twine &Name, + As &&... Args) { const auto *RD = cast(Ty->getAsTagDecl()); const CGRecordLayout &RL = CGM.getTypes().getCGRecordLayout(RD); ConstantInitBuilder CIBuilder(CGM); ConstantStructBuilder Fields = CIBuilder.beginStruct(RL.getLLVMType()); buildStructValue(Fields, CGM, RD, RL, Data); return Fields.finishAndCreateGlobal( - Name, CGM.getContext().getAlignOfGlobalVarInChars(Ty), - /*isConstant=*/true, std::forward(Args)...); + Name, CGM.getContext().getAlignOfGlobalVarInChars(Ty), IsConstant, + std::forward(Args)...); } template @@ -1482,8 +1482,9 @@ llvm::ConstantInt::getNullValue(CGM.Int32Ty), llvm::ConstantInt::getNullValue(CGM.Int32Ty), DefaultOpenMPPSource}; -llvm::GlobalValue *DefaultOpenMPLocation = createConstantGlobalStruct( -CGM, IdentQTy, Data, "", llvm::GlobalValue::PrivateLinkage); +llvm::GlobalValue *DefaultOpenMPLocation = +createGlobalStruct(CGM, IdentQTy, /*IsConstant=*/false, Data, "", + llvm::GlobalValue::PrivateLinkage); DefaultOpenMPLocation->setUnnamedAddr( llvm::GlobalValue::UnnamedAddr::Global); @@ -3765,8 +3766,8 @@ DeviceImages, Index), HostEntriesBegin, HostEntriesEnd}; std::string Descriptor = getName({"omp_offloading", "descriptor"}); - llvm::GlobalVariable *Desc = creat
[PATCH] D51331: [OPENMP] Create non-const ident_t structs.
This revision was automatically updated to reflect the committed changes. Closed by commit rC340934: [OPENMP] Create non-const ident_t objects. (authored by mikerice, committed by ). Repository: rC Clang https://reviews.llvm.org/D51331 Files: lib/CodeGen/CGOpenMPRuntime.cpp test/OpenMP/distribute_codegen.cpp test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp test/OpenMP/distribute_simd_codegen.cpp test/OpenMP/for_codegen.cpp test/OpenMP/for_firstprivate_codegen.cpp test/OpenMP/for_lastprivate_codegen.cpp test/OpenMP/for_linear_codegen.cpp test/OpenMP/for_reduction_codegen.cpp test/OpenMP/for_reduction_codegen_UDR.cpp test/OpenMP/ordered_codegen.cpp test/OpenMP/parallel_codegen.cpp test/OpenMP/parallel_copyin_codegen.cpp test/OpenMP/parallel_for_codegen.cpp test/OpenMP/parallel_num_threads_codegen.cpp test/OpenMP/parallel_proc_bind_codegen.cpp test/OpenMP/parallel_reduction_codegen.cpp test/OpenMP/sections_codegen.cpp test/OpenMP/sections_firstprivate_codegen.cpp test/OpenMP/sections_lastprivate_codegen.cpp test/OpenMP/sections_reduction_codegen.cpp test/OpenMP/single_codegen.cpp test/OpenMP/single_firstprivate_codegen.cpp test/OpenMP/target_parallel_codegen.cpp test/OpenMP/target_parallel_for_codegen.cpp test/OpenMP/target_parallel_for_simd_codegen.cpp test/OpenMP/target_parallel_if_codegen.cpp test/OpenMP/target_parallel_num_threads_codegen.cpp test/OpenMP/target_teams_codegen.cpp test/OpenMP/target_teams_distribute_codegen.cpp test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp test/OpenMP/target_teams_distribute_parallel_for_simd_proc_bind_codegen.cpp test/OpenMP/target_teams_distribute_simd_codegen.cpp test/OpenMP/target_teams_num_teams_codegen.cpp test/OpenMP/target_teams_thread_limit_codegen.cpp test/OpenMP/teams_codegen.cpp test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp test/OpenMP/teams_distribute_parallel_for_proc_bind_codegen.cpp test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp test/OpenMP/teams_distribute_parallel_for_simd_proc_bind_codegen.cpp test/OpenMP/threadprivate_codegen.cpp Index: test/OpenMP/target_teams_distribute_codegen.cpp === --- test/OpenMP/target_teams_distribute_codegen.cpp +++ test/OpenMP/target_teams_distribute_codegen.cpp @@ -40,7 +40,7 @@ // CHECK-DAG: %struct.ident_t = type { i32, i32, i32, i32, i8* } // CHECK-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00" -// CHECK-DAG: [[DEF_LOC:@.+]] = private unnamed_addr constant %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) } +// CHECK-DAG: [[DEF_LOC:@.+]] = 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) } // CHECK-DAG: [[TT:%.+]] = type { i64, i8 } // CHECK-DAG: [[S1:%.+]] = type { double } Index: test/OpenMP/parallel_num_threads_codegen.cpp === --- test/OpenMP/parallel_num_threads_codegen.cpp +++ test/OpenMP/parallel_num_threads_codegen.cpp @@ -15,7 +15,7 @@ // CHECK-DAG: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } // CHECK-DAG: [[S_TY:%.+]] = type { [[INTPTR_T_TY:i[0-9]+]], [[INTPTR_T_TY]], [[INTPTR_T_TY]] } // CHECK-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00" -// CHECK-DAG: [[DEF_LOC_2:@.+]] = private unnamed_addr constant [[IDENT_T_TY]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[STR]], i32 0, i32 0) } +// CHECK-DAG: [[DEF_LOC_2:@.+]] = private unnamed_addr global [[IDENT_T_TY]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[STR]], i32 0, i32 0) } void foo(); Index: test/OpenMP/target_teams_thread_limit_codegen.cpp === --- test/OpenMP/target_teams_thread_limit_codegen.cpp +++ test/OpenMP/target_teams_thread_limit_codegen.cpp @@ -40,7 +40,7 @@ // CHECK-DAG: %struct.ident_t = type { i32, i32, i32, i32, i8* } // CHECK-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00" -// CHECK-DAG: [[DEF_LOC:@.+]] = private unnamed_addr constant %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) } +// CHECK-DAG: [[DEF_LOC:@.+]] = 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) } // CHECK-DAG: [[S1:%.+]] = type { double } // CHECK-DAG: [[ENTTY:%.+]] = type { i
[PATCH] D51331: [OPENMP] Create non-const ident_t structs.
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D51331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51331: [OPENMP] Create non-const ident_t structs.
AndreyChurbanov added a comment. In https://reviews.llvm.org/D51331#1216509, @ABataev wrote: > When is ITT Notify used? Does it have some preconditions like debug info, > some optimizations level etc.? The libittnotify library is used by Intel tools (VTune Amplifier, Inspector, Spatial Advisor, etc.), may be used by others but I am not aware of any. Intel Tools development team still have no plans in near future to move to standard OMPT interface, mostly because the standard OpenMP Tools interface still lacks some important for customers features (like barrier imbalance reporting). It does not have any preconditions, although the presence of debug info usually helps to get better info in the tool. So, users are free to use tools without debug info and with any optimization level. https://reviews.llvm.org/D51331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51331: [OPENMP] Create non-const ident_t structs.
ABataev added a comment. When is ITT Notify used? Does it have some preconditions like debug info, some optimizations level etc.? https://reviews.llvm.org/D51331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51331: [OPENMP] Create non-const ident_t structs.
mikerice created this revision. mikerice added a reviewer: ABataev. Herald added subscribers: jfb, guansong. ITT Notify in the OpenMP runtime uses (and writes to) the reserved_2 field in the ident_t struct. See __kmp_itt_region_forking in openmp/runtime/src/kmp_itt.inl. Currently clang is creating these structs const and segfaults occur when running with analysis tools using libittnotify. The proposed change creates the ident_t object non-const and modifies the tests accordingly. https://reviews.llvm.org/D51331 Files: lib/CodeGen/CGOpenMPRuntime.cpp test/OpenMP/distribute_codegen.cpp test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp test/OpenMP/distribute_simd_codegen.cpp test/OpenMP/for_codegen.cpp test/OpenMP/for_firstprivate_codegen.cpp test/OpenMP/for_lastprivate_codegen.cpp test/OpenMP/for_linear_codegen.cpp test/OpenMP/for_reduction_codegen.cpp test/OpenMP/for_reduction_codegen_UDR.cpp test/OpenMP/ordered_codegen.cpp test/OpenMP/parallel_codegen.cpp test/OpenMP/parallel_copyin_codegen.cpp test/OpenMP/parallel_for_codegen.cpp test/OpenMP/parallel_num_threads_codegen.cpp test/OpenMP/parallel_proc_bind_codegen.cpp test/OpenMP/parallel_reduction_codegen.cpp test/OpenMP/sections_codegen.cpp test/OpenMP/sections_firstprivate_codegen.cpp test/OpenMP/sections_lastprivate_codegen.cpp test/OpenMP/sections_reduction_codegen.cpp test/OpenMP/single_codegen.cpp test/OpenMP/single_firstprivate_codegen.cpp test/OpenMP/target_parallel_codegen.cpp test/OpenMP/target_parallel_for_codegen.cpp test/OpenMP/target_parallel_for_simd_codegen.cpp test/OpenMP/target_parallel_if_codegen.cpp test/OpenMP/target_parallel_num_threads_codegen.cpp test/OpenMP/target_teams_codegen.cpp test/OpenMP/target_teams_distribute_codegen.cpp test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp test/OpenMP/target_teams_distribute_parallel_for_simd_proc_bind_codegen.cpp test/OpenMP/target_teams_distribute_simd_codegen.cpp test/OpenMP/target_teams_num_teams_codegen.cpp test/OpenMP/target_teams_thread_limit_codegen.cpp test/OpenMP/teams_codegen.cpp test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp test/OpenMP/teams_distribute_parallel_for_proc_bind_codegen.cpp test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp test/OpenMP/teams_distribute_parallel_for_simd_proc_bind_codegen.cpp test/OpenMP/threadprivate_codegen.cpp Index: test/OpenMP/threadprivate_codegen.cpp === --- test/OpenMP/threadprivate_codegen.cpp +++ test/OpenMP/threadprivate_codegen.cpp @@ -125,7 +125,7 @@ // CHECK-DAG: [[GS1:@.+]] = internal global [[S1]] zeroinitializer // CHECK-DAG: [[GS1]].cache. = common global i8** null -// CHECK-DAG: [[DEFAULT_LOC:@.+]] = private unnamed_addr constant [[IDENT]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([{{[0-9]+}} x i8], [{{[0-9]+}} x i8]* {{@.+}}, i32 0, i32 0) } +// CHECK-DAG: [[DEFAULT_LOC:@.+]] = private unnamed_addr global [[IDENT]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([{{[0-9]+}} x i8], [{{[0-9]+}} x i8]* {{@.+}}, i32 0, i32 0) } // CHECK-DAG: [[GS2:@.+]] = internal global [[S2]] zeroinitializer // CHECK-DAG: [[ARR_X:@.+]] = global [2 x [3 x [[S1 zeroinitializer // CHECK-DAG: [[ARR_X]].cache. = common global i8** null Index: test/OpenMP/teams_distribute_parallel_for_simd_proc_bind_codegen.cpp === --- test/OpenMP/teams_distribute_parallel_for_simd_proc_bind_codegen.cpp +++ test/OpenMP/teams_distribute_parallel_for_simd_proc_bind_codegen.cpp @@ -16,7 +16,7 @@ // CHECK-DAG: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } // CHECK-DAG: [[STR:@.+]] = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00" -// CHECK-DAG: [[DEF_LOC_2:@.+]] = private unnamed_addr constant [[IDENT_T_TY]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[STR]], i32 0, i32 0) } +// CHECK-DAG: [[DEF_LOC_2:@.+]] = private unnamed_addr global [[IDENT_T_TY]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* [[STR]], i32 0, i32 0) } void foo(); Index: test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp === --- test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp +++ test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp @@ -15,7 +15,7 @@ // CHECK-DAG: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } // CHECK-DAG: [[S_TY:%.+]] = type { [[INTPTR_T_TY:i[0-9]+]], [[INTPTR_T_TY]], [[INTPTR_T_TY]] } // CHECK-DAG: [[STR:@.+]] = private unnamed_addr