[clang] [llvm] [mlir] [OpenMP] Emit aggregate kernel prototypes and remove libffi dependency (PR #186261)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 12 14:47:11 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
Author: Joseph Huber (jhuber6)
<details>
<summary>Changes</summary>
Summary:
This PR changes the handling of the emitted kernels when targeting a CPU
to be a pointer struct.
The old handling emitted a standard function prototype, this
necessitated a target specific ABI to call it because the signature
differed with the number of arguments. Instead, this PR emits a void
pointer to a naturally aligned struct, this is what APIs like `pthreads`
assert.
This allows us to remove all the complexity around launching host
kernels and just pass the argument list.
---
Patch is 30.14 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/186261.diff
363 Files Affected:
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+23-2)
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+235)
- (modified) clang/lib/CodeGen/CodeGenFunction.h (+3)
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+4-4)
- (modified) clang/test/AST/ast-dump-openmp-target-parallel-for-simd.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-target-parallel-for.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-target-parallel.c (+2)
- (modified) clang/test/AST/ast-dump-openmp-target-simd.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for-simd.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-target-teams-distribute-parallel-for.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-target-teams-distribute-simd.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-target-teams-distribute.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-target-teams.c (+2)
- (modified) clang/test/AST/ast-dump-openmp-target.c (+4-2)
- (modified) clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for-simd.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-teams-distribute-parallel-for.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-teams-distribute-simd.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-teams-distribute.c (+10)
- (modified) clang/test/AST/ast-dump-openmp-teams.c (+2)
- (modified) clang/test/OpenMP/amdgcn_target_codegen.cpp (+19-19)
- (modified) clang/test/OpenMP/amdgcn_target_device_vla.cpp (+34-34)
- (modified) clang/test/OpenMP/amdgpu_target_with_aligned_attribute.c (+4-4)
- (modified) clang/test/OpenMP/bug59160.c (+2-2)
- (modified) clang/test/OpenMP/bug60602.cpp (+179-163)
- (modified) clang/test/OpenMP/constexpr_capture.cpp (+2-2)
- (modified) clang/test/OpenMP/copy-gaps-1.cpp (+6-6)
- (modified) clang/test/OpenMP/copy-gaps-2.cpp (+7-7)
- (modified) clang/test/OpenMP/copy-gaps-3.cpp (+6-6)
- (modified) clang/test/OpenMP/copy-gaps-4.cpp (+7-7)
- (modified) clang/test/OpenMP/copy-gaps-5.cpp (+7-7)
- (modified) clang/test/OpenMP/copy-gaps-6.cpp (+12-12)
- (modified) clang/test/OpenMP/declare_mapper_codegen.cpp (+43-43)
- (modified) clang/test/OpenMP/declare_target_codegen.cpp (+6-6)
- (modified) clang/test/OpenMP/declare_target_codegen_globalization.cpp (+6-6)
- (modified) clang/test/OpenMP/declare_target_link_codegen.cpp (+15-15)
- (modified) clang/test/OpenMP/declare_variant_mixed_codegen.c (+2-2)
- (modified) clang/test/OpenMP/distribute_codegen.cpp (+828-714)
- (modified) clang/test/OpenMP/distribute_firstprivate_codegen.cpp (+337-301)
- (modified) clang/test/OpenMP/distribute_lastprivate_codegen.cpp (+337-301)
- (modified) clang/test/OpenMP/distribute_parallel_for_codegen.cpp (+2880-2628)
- (modified) clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp (+360-324)
- (modified) clang/test/OpenMP/distribute_parallel_for_if_codegen.cpp (+385-291)
- (modified) clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp (+375-339)
- (modified) clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp (+1200-908)
- (modified) clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp (+206-150)
- (modified) clang/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp (+132-93)
- (modified) clang/test/OpenMP/distribute_parallel_for_reduction_task_codegen.cpp (+25-23)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp (+4350-4098)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp (+603-567)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_if_codegen.cpp (+2360-1984)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp (+583-547)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp (+1778-1486)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp (+392-336)
- (modified) clang/test/OpenMP/distribute_parallel_for_simd_proc_bind_codegen.cpp (+204-165)
- (modified) clang/test/OpenMP/distribute_private_codegen.cpp (+302-220)
- (modified) clang/test/OpenMP/distribute_simd_codegen.cpp (+2150-1914)
- (modified) clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp (+495-459)
- (modified) clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp (+491-455)
- (modified) clang/test/OpenMP/distribute_simd_private_codegen.cpp (+488-416)
- (modified) clang/test/OpenMP/distribute_simd_reduction_codegen.cpp (+288-254)
- (modified) clang/test/OpenMP/force-usm.c (+10-10)
- (modified) clang/test/OpenMP/map_struct_ordering.cpp (+59-51)
- (modified) clang/test/OpenMP/nvptx_SPMD_codegen.cpp (+2025-2025)
- (modified) clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp (+32-32)
- (modified) clang/test/OpenMP/nvptx_lambda_capturing.cpp (+546-506)
- (modified) clang/test/OpenMP/nvptx_lambda_pointer_capturing.cpp (+28-28)
- (modified) clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp (+12-12)
- (modified) clang/test/OpenMP/nvptx_parallel_codegen.cpp (+22-22)
- (modified) clang/test/OpenMP/nvptx_parallel_for_codegen.cpp (+6-6)
- (modified) clang/test/OpenMP/nvptx_target_codegen.cpp (+66-66)
- (modified) clang/test/OpenMP/nvptx_target_firstprivate_codegen.cpp (+12-12)
- (modified) clang/test/OpenMP/nvptx_target_parallel_codegen.cpp (+28-28)
- (modified) clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp (+28-28)
- (modified) clang/test/OpenMP/nvptx_target_parallel_proc_bind_codegen.cpp (+48-48)
- (modified) clang/test/OpenMP/nvptx_target_parallel_reduction_codegen.cpp (+423-423)
- (modified) clang/test/OpenMP/nvptx_target_requires_unified_shared_memory.cpp (+10-10)
- (modified) clang/test/OpenMP/nvptx_target_simd_codegen.cpp (+324-324)
- (modified) clang/test/OpenMP/nvptx_target_teams_codegen.cpp (+22-22)
- (modified) clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp (+108-108)
- (modified) clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp (+12-12)
- (modified) clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp (+380-380)
- (modified) clang/test/OpenMP/nvptx_target_teams_distribute_simd_codegen.cpp (+414-414)
- (modified) clang/test/OpenMP/nvptx_target_teams_generic_loop_codegen.cpp (+99-99)
- (modified) clang/test/OpenMP/nvptx_target_teams_generic_loop_generic_mode_codegen.cpp (+16-16)
- (modified) clang/test/OpenMP/nvptx_target_teams_ompx_bare_codegen.cpp (+3-3)
- (modified) clang/test/OpenMP/nvptx_teams_codegen.cpp (+32-32)
- (modified) clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp (+825-825)
- (modified) clang/test/OpenMP/openmp_offload_codegen.cpp (+1-1)
- (modified) clang/test/OpenMP/openmp_offload_registration.cpp (+1-1)
- (modified) clang/test/OpenMP/reduction_implicit_map.cpp (+402-354)
- (modified) clang/test/OpenMP/scope_codegen.cpp (+441-437)
- (modified) clang/test/OpenMP/spirv_kernel_addrspace.cpp (+1-1)
- (modified) clang/test/OpenMP/target_codegen.cpp (+131-131)
- (modified) clang/test/OpenMP/target_codegen_global_capture.cpp (+507-459)
- (modified) clang/test/OpenMP/target_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_data_member_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/target_data_use_device_ptr_if_codegen.cpp (+2-2)
- (modified) clang/test/OpenMP/target_default_codegen.cpp (+810-682)
- (modified) clang/test/OpenMP/target_defaultmap_codegen_01.cpp (+117-117)
- (modified) clang/test/OpenMP/target_defaultmap_codegen_02.cpp (+11-11)
- (modified) clang/test/OpenMP/target_defaultmap_codegen_03.cpp (+385-321)
- (modified) clang/test/OpenMP/target_depend_codegen.cpp (+33-34)
- (modified) clang/test/OpenMP/target_device_codegen.cpp (+3-3)
- (modified) clang/test/OpenMP/target_dyn_groupprivate_codegen.cpp (+1032-834)
- (modified) clang/test/OpenMP/target_firstprivate_codegen.cpp (+2426-2126)
- (modified) clang/test/OpenMP/target_firstprivate_pointer_codegen.cpp (+13-13)
- (modified) clang/test/OpenMP/target_has_device_addr_codegen.cpp (+794-674)
- (modified) clang/test/OpenMP/target_has_device_addr_codegen_01.cpp (+144-128)
- (modified) clang/test/OpenMP/target_in_reduction_codegen.cpp (+4-2)
- (modified) clang/test/OpenMP/target_is_device_ptr_codegen.cpp (+2532-2180)
- (modified) clang/test/OpenMP/target_map_array_of_structs_with_nested_mapper_codegen.cpp (+50-42)
- (modified) clang/test/OpenMP/target_map_array_section_no_length_codegen.cpp (+288-256)
- (modified) clang/test/OpenMP/target_map_array_section_of_structs_with_nested_mapper_codegen.cpp (+48-40)
- (modified) clang/test/OpenMP/target_map_both_pointer_pointee_codegen.cpp (+105-70)
- (modified) clang/test/OpenMP/target_map_both_pointer_pointee_codegen_global.cpp (+105-70)
- (modified) clang/test/OpenMP/target_map_codegen_00.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_01.cpp (+10-8)
- (modified) clang/test/OpenMP/target_map_codegen_02.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_03.cpp (+98-82)
- (modified) clang/test/OpenMP/target_map_codegen_04.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_05.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_06.cpp (+7-7)
- (modified) clang/test/OpenMP/target_map_codegen_07.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_08.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_09.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_10.cpp (+6-6)
- (modified) clang/test/OpenMP/target_map_codegen_11.cpp (+7-7)
- (modified) clang/test/OpenMP/target_map_codegen_12.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_13.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_14.cpp (+8-8)
- (modified) clang/test/OpenMP/target_map_codegen_15.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_16.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_17.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_18.inc (+235-235)
- (modified) clang/test/OpenMP/target_map_codegen_19.cpp (+12-12)
- (modified) clang/test/OpenMP/target_map_codegen_20.cpp (+31-31)
- (modified) clang/test/OpenMP/target_map_codegen_21.cpp (+45-45)
- (modified) clang/test/OpenMP/target_map_codegen_22.cpp (+18-18)
- (modified) clang/test/OpenMP/target_map_codegen_23.cpp (+39-39)
- (modified) clang/test/OpenMP/target_map_codegen_24.cpp (+8-8)
- (modified) clang/test/OpenMP/target_map_codegen_25.cpp (+16-16)
- (modified) clang/test/OpenMP/target_map_codegen_26.cpp (+24-24)
- (modified) clang/test/OpenMP/target_map_codegen_27.cpp (+6-6)
- (modified) clang/test/OpenMP/target_map_codegen_28.cpp (+9-9)
- (modified) clang/test/OpenMP/target_map_codegen_29.cpp (+14-14)
- (modified) clang/test/OpenMP/target_map_codegen_30.cpp (+6-6)
- (modified) clang/test/OpenMP/target_map_codegen_31.cpp (+13-13)
- (modified) clang/test/OpenMP/target_map_codegen_32.cpp (+8-8)
- (modified) clang/test/OpenMP/target_map_codegen_33.cpp (+2-2)
- (modified) clang/test/OpenMP/target_map_codegen_34.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_35.cpp (+4-4)
- (modified) clang/test/OpenMP/target_map_codegen_hold.cpp (+740-644)
- (modified) clang/test/OpenMP/target_map_deref_array_codegen.cpp (+214-190)
- (modified) clang/test/OpenMP/target_map_member_expr_codegen.cpp (+229-205)
- (modified) clang/test/OpenMP/target_map_names.cpp (+1-1)
- (modified) clang/test/OpenMP/target_map_names_attr.cpp (+1-1)
- (modified) clang/test/OpenMP/target_map_pointer_defalut_mapper_codegen.cpp (+6-6)
- (modified) clang/test/OpenMP/target_map_ptr_and_star_global.cpp (+82-54)
- (modified) clang/test/OpenMP/target_map_ptr_and_star_local.cpp (+82-54)
- (modified) clang/test/OpenMP/target_map_structptr_and_member_global.cpp (+114-79)
- (modified) clang/test/OpenMP/target_map_structptr_and_member_local.cpp (+114-79)
- (modified) clang/test/OpenMP/target_offload_mandatory_codegen.cpp (+120-87)
- (modified) clang/test/OpenMP/target_ompx_dyn_cgroup_mem_codegen.cpp (+1030-832)
- (modified) clang/test/OpenMP/target_parallel_codegen.cpp (+1456-1166)
- (modified) clang/test/OpenMP/target_parallel_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_parallel_debug_codegen.cpp (+444-444)
- (modified) clang/test/OpenMP/target_parallel_depend_codegen.cpp (+20-22)
- (modified) clang/test/OpenMP/target_parallel_for_codegen.cpp (+2696-2350)
- (modified) clang/test/OpenMP/target_parallel_for_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_parallel_for_debug_codegen.cpp (+613-613)
- (modified) clang/test/OpenMP/target_parallel_for_depend_codegen.cpp (+20-21)
- (modified) clang/test/OpenMP/target_parallel_for_reduction_task_codegen.cpp (+26-24)
- (modified) clang/test/OpenMP/target_parallel_for_simd_codegen.cpp (+4238-3626)
- (modified) clang/test/OpenMP/target_parallel_for_simd_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_parallel_for_simd_depend_codegen.cpp (+20-21)
- (modified) clang/test/OpenMP/target_parallel_for_simd_tl_codegen.cpp (+23-21)
- (modified) clang/test/OpenMP/target_parallel_for_simd_uses_allocators_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_parallel_for_tl_codegen.cpp (+16-14)
- (modified) clang/test/OpenMP/target_parallel_for_uses_allocators_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen-1.cpp (+722-572)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen-2.cpp (+176-128)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen-3.cpp (+613-613)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen.cpp (+18-14)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_depend_codegen.cpp (+1-81)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_tl_codegen.cpp (+16-14)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_uses_allocators_codegen.cpp (+49-41)
- (modified) clang/test/OpenMP/target_parallel_if_codegen.cpp (+912-710)
- (modified) clang/test/OpenMP/target_parallel_num_threads_codegen.cpp (+882-692)
- (modified) clang/test/OpenMP/target_parallel_num_threads_strict_codegen.cpp (+782-594)
- (modified) clang/test/OpenMP/target_parallel_reduction_task_codegen.cpp (+26-24)
- (modified) clang/test/OpenMP/target_parallel_tl_codegen.cpp (+16-14)
- (modified) clang/test/OpenMP/target_parallel_uses_allocators_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_private_codegen.cpp (+9-20)
- (modified) clang/test/OpenMP/target_simd_codegen.cpp (+112-112)
- (modified) clang/test/OpenMP/target_simd_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_simd_depend_codegen.cpp (+20-21)
- (modified) clang/test/OpenMP/target_simd_tl_codegen.cpp (+22-20)
- (modified) clang/test/OpenMP/target_simd_uses_allocators_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_task_affinity_codegen.cpp (+290-268)
- (modified) clang/test/OpenMP/target_teams_codegen.cpp (+2334-1938)
- (modified) clang/test/OpenMP/target_teams_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_teams_depend_codegen.cpp (+20-21)
- (modified) clang/test/OpenMP/target_teams_distribute_codegen.cpp (+1590-1372)
- (modified) clang/test/OpenMP/target_teams_distribute_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp (+358-310)
- (modified) clang/test/OpenMP/target_teams_distribute_depend_codegen.cpp (+20-21)
- (modified) clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp (+1140-996)
- (modified) clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp (+282-248)
- (modified) clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp (+310-274)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp (+412-346)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp (+362-314)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_depend_codegen.cpp (+20-21)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp (+1120-976)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp (+476-411)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp (+316-244)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp (+336-300)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_order_codegen.cpp (+43-30)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp (+233-154)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_proc_bind_codegen.cpp (+132-93)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_codegen.cpp (+206-172)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_task_codegen.cpp (+27-25)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_schedule_codegen.cpp (+4000-3520)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp (+758-668)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_codegen.cpp (+552-504)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_codegen.cpp (+20-21)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp (+1702-1558)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp (+820-755)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp (+2120-1852)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_codegen.cpp (+578-542)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_private_codegen.cpp (+515-436)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_proc_bind_codegen.cpp (+204-165)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_codegen.cpp (+343-309)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_schedule_codegen.cpp (+5294-4814)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_simd_uses_allocators_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_parallel_for_uses_allocators_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_private_codegen.cpp (+189-135)
- (modified) clang/test/OpenMP/target_teams_distribute_reduction_codegen.cpp (+2244-1904)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_codegen.cpp (+4078-3642)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_codegen_registration.cpp (+24-24)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_collapse_codegen.cpp (+500-452)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_depend_codegen.cpp (+34-36)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_dist_schedule_codegen.cpp (+1410-1266)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp (+412-378)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_lastprivate_codegen.cpp (+460-424)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp (+313-259)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_reduction_codegen.cpp (+293-259)
- (modified) clang/test/OpenMP/target_teams_distribute_simd_uses_allocators_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_distribute_uses_allocators_codegen.cpp (+4-4)
- (modified) clang/test/OpenMP/target_teams_generic_loop_codegen-1.cpp (+408-342)
- (modified) clang/test/OpenMP/target_teams_generic_loop_codegen.cpp (+67-63)
- (modified) clang/test/OpenMP/target_teams_generic_loop_codegen_as_distribute.cpp (+26-22)
- (modified) clang/test/OpenMP/target_teams_generic_loop_codegen_as_parallel_for.cpp (+123-107)
- (modified) clang/test/OpenMP/target_teams_generic_loop_collapse_codegen.cpp (+362-314)
- (modified) clang/test/OpenMP/target_teams_generic_loop_depend_codegen.cpp (+1-101)
- (modified) clang/test/OpenMP/target_teams_generic_loop_if_codegen.cpp (+273-212)
``````````diff
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 3ec09b4e8c630..dbe255117de3f 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -6371,11 +6371,13 @@ void CGOpenMPRuntime::emitTargetOutlinedFunctionHelper(
CodeGenFunction CGF(CGM, true);
llvm::OpenMPIRBuilder::FunctionGenCallback &&GenerateOutlinedFunction =
- [&CGF, &D, &CodeGen](StringRef EntryFnName) {
+ [&CGF, &D, &CodeGen, this](StringRef EntryFnName) {
const CapturedStmt &CS = *D.getCapturedStmt(OMPD_target);
CGOpenMPTargetRegionInfo CGInfo(CS, CodeGen, EntryFnName);
CodeGenFunction::CGCapturedStmtRAII CapInfoRAII(CGF, &CGInfo);
+ if (CGM.getLangOpts().OpenMPIsTargetDevice && !isGPU())
+ return CGF.GenerateOpenMPCapturedStmtFunctionAggregate(CS, D);
return CGF.GenerateOpenMPCapturedStmtFunction(CS, D);
};
@@ -10639,8 +10641,11 @@ emitTargetCallFallback(CGOpenMPRuntime *OMPRuntime, llvm::Function *OutlinedFn,
CapturedVars.clear();
CGF.GenerateOpenMPCapturedVars(CS, CapturedVars);
}
+ llvm::SmallVector<llvm::Value *, 16> Args(CapturedVars.begin(),
+ CapturedVars.end());
+ Args.push_back(llvm::Constant::getNullValue(CGF.Builder.getPtrTy()));
OMPRuntime->emitOutlinedFunctionCall(CGF, D.getBeginLoc(), OutlinedFn,
- CapturedVars);
+ Args);
}
}
@@ -10877,6 +10882,22 @@ static void emitTargetCallKernelLaunch(
CGOpenMPRuntime::TargetDataInfo Info;
genMapInfo(D, CGF, CS, CapturedVars, OMPBuilder, CombinedInfo);
+ // Append a null entry for the implicit dyn_ptr argument.
+ using OpenMPOffloadMappingFlags = llvm::omp::OpenMPOffloadMappingFlags;
+ auto *NullPtr = llvm::Constant::getNullValue(CGF.Builder.getPtrTy());
+ CombinedInfo.BasePointers.push_back(NullPtr);
+ CombinedInfo.Pointers.push_back(NullPtr);
+ CombinedInfo.DevicePointers.push_back(
+ llvm::OpenMPIRBuilder::DeviceInfoTy::None);
+ CombinedInfo.Sizes.push_back(CGF.Builder.getInt64(0));
+ CombinedInfo.Types.push_back(OpenMPOffloadMappingFlags::OMP_MAP_TARGET_PARAM |
+ OpenMPOffloadMappingFlags::OMP_MAP_LITERAL);
+ if (!CombinedInfo.Names.empty())
+ CombinedInfo.Names.push_back(NullPtr);
+ CombinedInfo.Exprs.push_back(nullptr);
+ CombinedInfo.Mappers.push_back(nullptr);
+ CombinedInfo.DevicePtrDecls.push_back(nullptr);
+
emitOffloadingArraysAndArgs(CGF, CombinedInfo, Info, OMPBuilder,
/*IsNonContiguous=*/true, /*ForEndCall=*/false);
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index cc85de9221eef..ebfeb33b54c1a 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -695,6 +695,116 @@ static llvm::Function *emitOutlinedFunctionPrologue(
return F;
}
+static llvm::Function *emitOutlinedFunctionPrologueAggregate(
+ CodeGenFunction &CGF, FunctionArgList &Args,
+ llvm::MapVector<const Decl *, std::pair<const VarDecl *, Address>>
+ &LocalAddrs,
+ llvm::DenseMap<const Decl *, std::pair<const Expr *, llvm::Value *>>
+ &VLASizes,
+ llvm::Value *&CXXThisValue, llvm::Value *&ContextV,
+ unsigned &AggregateFieldCount, const CapturedStmt &CS, SourceLocation Loc,
+ StringRef FunctionName) {
+ const CapturedDecl *CD = CS.getCapturedDecl();
+ const RecordDecl *RD = CS.getCapturedRecordDecl();
+
+ CXXThisValue = nullptr;
+ CodeGenModule &CGM = CGF.CGM;
+ ASTContext &Ctx = CGM.getContext();
+ Args.push_back(CD->getContextParam());
+
+ const CGFunctionInfo &FuncInfo =
+ CGM.getTypes().arrangeBuiltinFunctionDeclaration(Ctx.VoidTy, Args);
+ llvm::FunctionType *FuncLLVMTy = CGM.getTypes().GetFunctionType(FuncInfo);
+
+ auto *F =
+ llvm::Function::Create(FuncLLVMTy, llvm::GlobalValue::InternalLinkage,
+ FunctionName, &CGM.getModule());
+ CGM.SetInternalFunctionAttributes(CD, F, FuncInfo);
+ if (CD->isNothrow())
+ F->setDoesNotThrow();
+ F->setDoesNotRecurse();
+
+ CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, Loc, Loc);
+ Address ContextAddr = CGF.GetAddrOfLocalVar(CD->getContextParam());
+ ContextV = CGF.Builder.CreateLoad(ContextAddr);
+
+ // The runtime passes arguments as a flat array of promoted intptr_t values.
+ llvm::Type *IntPtrTy = CGF.IntPtrTy;
+ llvm::Type *PtrTy = CGF.Builder.getPtrTy();
+ llvm::Align PtrAlign = CGM.getDataLayout().getPointerABIAlignment(0);
+ CharUnits SlotAlign = CharUnits::fromQuantity(PtrAlign.value());
+
+ unsigned FieldIdx = 0;
+ auto I = CS.captures().begin();
+ for (const FieldDecl *FD : RD->fields()) {
+ llvm::Value *Slot =
+ CGF.Builder.CreateConstInBoundsGEP1_32(IntPtrTy, ContextV, FieldIdx);
+
+ // Generate the appropriate load from the GEP into the __context struct.
+ // This includes all of the user arguments as well as the implicit kernel
+ // argument pointer.
+ if (I->capturesVariableByCopy() && FD->getType()->isAnyPointerType()) {
+ const VarDecl *CurVD = I->getCapturedVar();
+ Slot->setName(CurVD->getName());
+ Address SlotAddr(Slot, PtrTy, SlotAlign);
+ LocalAddrs.insert({FD, {CurVD, SlotAddr}});
+ } else if (FD->hasCapturedVLAType()) {
+ // VLA size is stored as intptr_t directly in the slot.
+ Address SlotAddr(Slot, CGF.ConvertTypeForMem(FD->getType()), SlotAlign);
+ LValue ArgLVal =
+ CGF.MakeAddrLValue(SlotAddr, FD->getType(), AlignmentSource::Decl);
+ llvm::Value *ExprArg = CGF.EmitLoadOfScalar(ArgLVal, I->getLocation());
+ const VariableArrayType *VAT = FD->getCapturedVLAType();
+ VLASizes.try_emplace(FD, VAT->getSizeExpr(), ExprArg);
+ } else if (I->capturesVariable()) {
+ const VarDecl *Var = I->getCapturedVar();
+ QualType VarTy = Var->getType();
+
+ if (VarTy->isVariablyModifiedType() && VarTy->isPointerType()) {
+ Slot->setName(Var->getName() + ".addr");
+ Address SlotAddr(Slot, PtrTy, SlotAlign);
+ LocalAddrs.insert({FD, {Var, SlotAddr}});
+ } else {
+ llvm::Value *VarAddr = CGF.Builder.CreateAlignedLoad(
+ PtrTy, Slot, PtrAlign, Var->getName());
+ LocalAddrs.insert({FD,
+ {Var, Address(VarAddr, CGF.ConvertTypeForMem(VarTy),
+ Ctx.getDeclAlign(Var))}});
+ }
+ } else if (I->capturesVariableByCopy()) {
+ assert(!FD->getType()->isAnyPointerType() &&
+ "Not expecting a captured pointer.");
+ const VarDecl *Var = I->getCapturedVar();
+ QualType FieldTy = FD->getType();
+
+ // Scalar values are promoted and stored directly in the slot.
+ Address SlotAddr(Slot, CGF.ConvertTypeForMem(FieldTy), SlotAlign);
+ Address CopyAddr =
+ CGF.CreateMemTemp(FieldTy, Ctx.getDeclAlign(FD), Var->getName());
+ LValue SrcLVal =
+ CGF.MakeAddrLValue(SlotAddr, FieldTy, AlignmentSource::Decl);
+ LValue CopyLVal =
+ CGF.MakeAddrLValue(CopyAddr, FieldTy, AlignmentSource::Decl);
+
+ RValue ArgRVal = CGF.EmitLoadOfLValue(SrcLVal, I->getLocation());
+ CGF.EmitStoreThroughLValue(ArgRVal, CopyLVal);
+
+ LocalAddrs.insert({FD, {Var, CopyAddr}});
+ } else {
+ assert(I->capturesThis());
+ CXXThisValue =
+ CGF.Builder.CreateAlignedLoad(PtrTy, Slot, PtrAlign, "this");
+ Address SlotAddr(Slot, PtrTy, SlotAlign);
+ LocalAddrs.insert({FD, {nullptr, SlotAddr}});
+ }
+ ++FieldIdx;
+ ++I;
+ }
+
+ AggregateFieldCount = FieldIdx;
+ return F;
+}
+
llvm::Function *CodeGenFunction::GenerateOpenMPCapturedStmtFunction(
const CapturedStmt &S, const OMPExecutableDirective &D) {
SourceLocation Loc = D.getBeginLoc();
@@ -789,6 +899,131 @@ llvm::Function *CodeGenFunction::GenerateOpenMPCapturedStmtFunction(
return WrapperF;
}
+llvm::Function *CodeGenFunction::GenerateOpenMPCapturedStmtFunctionAggregate(
+ const CapturedStmt &S, const OMPExecutableDirective &D) {
+ SourceLocation Loc = D.getBeginLoc();
+ assert(
+ CapturedStmtInfo &&
+ "CapturedStmtInfo should be set when generating the captured function");
+ const CapturedDecl *CD = S.getCapturedDecl();
+ const RecordDecl *RD = S.getCapturedRecordDecl();
+ StringRef FunctionName = CapturedStmtInfo->getHelperName();
+ bool NeedWrapperFunction =
+ getDebugInfo() && CGM.getCodeGenOpts().hasReducedDebugInfo();
+
+ CodeGenFunction WrapperCGF(CGM, /*suppressNewContext=*/true);
+ llvm::Function *WrapperF = nullptr;
+ llvm::Value *WrapperContextV = nullptr;
+ if (NeedWrapperFunction) {
+ WrapperCGF.CapturedStmtInfo = CapturedStmtInfo;
+ FunctionArgList WrapperArgs;
+ llvm::MapVector<const Decl *, std::pair<const VarDecl *, Address>>
+ WrapperLocalAddrs;
+ llvm::DenseMap<const Decl *, std::pair<const Expr *, llvm::Value *>>
+ WrapperVLASizes;
+ unsigned WrapperFieldIdx = 0;
+ WrapperF = emitOutlinedFunctionPrologueAggregate(
+ WrapperCGF, WrapperArgs, WrapperLocalAddrs, WrapperVLASizes,
+ WrapperCGF.CXXThisValue, WrapperContextV, WrapperFieldIdx, S, Loc,
+ FunctionName);
+ }
+
+ FunctionArgList Args;
+ llvm::MapVector<const Decl *, std::pair<const VarDecl *, Address>> LocalAddrs;
+ llvm::DenseMap<const Decl *, std::pair<const Expr *, llvm::Value *>> VLASizes;
+ llvm::Function *F;
+
+ if (NeedWrapperFunction) {
+ SmallString<256> Buffer;
+ llvm::raw_svector_ostream Out(Buffer);
+ Out << FunctionName << "_debug__";
+
+ FunctionOptions FO(&S, /*UIntPtrCastRequired=*/false,
+ /*RegisterCastedArgsOnly=*/false, Out.str(), Loc,
+ /*IsDeviceKernel=*/false);
+ F = emitOutlinedFunctionPrologue(*this, Args, LocalAddrs, VLASizes,
+ CXXThisValue, FO);
+ } else {
+ llvm::Value *ContextV = nullptr;
+ unsigned FieldIdx = 0;
+ F = emitOutlinedFunctionPrologueAggregate(*this, Args, LocalAddrs, VLASizes,
+ CXXThisValue, ContextV, FieldIdx,
+ S, Loc, FunctionName);
+
+ for (unsigned I = 0; I < CD->getNumParams(); ++I) {
+ const ImplicitParamDecl *Param = CD->getParam(I);
+ if (Param == CD->getContextParam())
+ continue;
+ llvm::Value *ParamAddr = Builder.CreateConstInBoundsGEP1_32(
+ IntPtrTy, ContextV, FieldIdx, Twine(Param->getName()) + ".addr");
+ llvm::Value *ParamVal = Builder.CreateAlignedLoad(
+ Builder.getPtrTy(), ParamAddr,
+ CGM.getDataLayout().getPointerABIAlignment(0), Param->getName());
+ Address ParamLocalAddr =
+ CreateMemTemp(Param->getType(), Param->getName());
+ Builder.CreateStore(ParamVal, ParamLocalAddr);
+ LocalAddrs.insert({Param, {Param, ParamLocalAddr}});
+ ++FieldIdx;
+ }
+ }
+
+ CodeGenFunction::OMPPrivateScope LocalScope(*this);
+ for (const auto &LocalAddrPair : LocalAddrs) {
+ if (LocalAddrPair.second.first)
+ LocalScope.addPrivate(LocalAddrPair.second.first,
+ LocalAddrPair.second.second);
+ }
+ (void)LocalScope.Privatize();
+ for (const auto &VLASizePair : VLASizes)
+ VLASizeMap[VLASizePair.second.first] = VLASizePair.second.second;
+ PGO->assignRegionCounters(GlobalDecl(CD), F);
+ CapturedStmtInfo->EmitBody(*this, CD->getBody());
+ (void)LocalScope.ForceCleanup();
+ FinishFunction(CD->getBodyRBrace());
+
+ if (!NeedWrapperFunction)
+ return F;
+
+ // Reverse the order.
+ WrapperF->removeFromParent();
+ F->getParent()->getFunctionList().insertAfter(F->getIterator(), WrapperF);
+
+ llvm::Align PtrAlign = CGM.getDataLayout().getPointerABIAlignment(0);
+ llvm::SmallVector<llvm::Value *, 16> CallArgs;
+ unsigned SlotIdx = 0;
+ auto *InnerParam = F->arg_begin();
+
+ assert(CD->getContextParamPosition() == 0 &&
+ "Expected context param at position 0 for target regions");
+
+ for (const FieldDecl *FD : RD->fields()) {
+ (void)FD;
+ llvm::Value *Slot = WrapperCGF.Builder.CreateConstInBoundsGEP1_32(
+ WrapperCGF.IntPtrTy, WrapperContextV, SlotIdx);
+ llvm::Value *Val = WrapperCGF.Builder.CreateAlignedLoad(
+ InnerParam->getType(), Slot, PtrAlign, InnerParam->getName());
+ CallArgs.push_back(Val);
+ ++SlotIdx;
+ ++InnerParam;
+ }
+
+ for (unsigned I = CD->getContextParamPosition() + 1; I < CD->getNumParams();
+ ++I) {
+ llvm::Value *Slot = WrapperCGF.Builder.CreateConstInBoundsGEP1_32(
+ WrapperCGF.IntPtrTy, WrapperContextV, SlotIdx);
+ llvm::Value *Val = WrapperCGF.Builder.CreateAlignedLoad(
+ InnerParam->getType(), Slot, PtrAlign, InnerParam->getName());
+ CallArgs.push_back(Val);
+ ++SlotIdx;
+ ++InnerParam;
+ }
+
+ assert(InnerParam == F->arg_end() && "Argument count mismatch");
+ CGM.getOpenMPRuntime().emitOutlinedFunctionCall(WrapperCGF, Loc, F, CallArgs);
+ WrapperCGF.FinishFunction();
+ return WrapperF;
+}
+
//===----------------------------------------------------------------------===//
// OpenMP Directive Emission
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 9771b89b55aae..7bc5aaad1c024 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3756,6 +3756,9 @@ class CodeGenFunction : public CodeGenTypeCache {
llvm::Function *
GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S,
const OMPExecutableDirective &D);
+ llvm::Function *
+ GenerateOpenMPCapturedStmtFunctionAggregate(const CapturedStmt &S,
+ const OMPExecutableDirective &D);
void GenerateOpenMPCapturedVars(const CapturedStmt &S,
SmallVectorImpl<llvm::Value *> &CapturedVars);
void emitOMPSimpleStore(LValue LVal, RValue RVal, QualType RValTy,
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index bbb4f939028ec..ce0a092fffb42 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -4473,12 +4473,12 @@ static SmallVector<SemaOpenMP::CapturedParamNameType>
getTargetRegionParams(Sema &SemaRef) {
ASTContext &Context = SemaRef.getASTContext();
SmallVector<SemaOpenMP::CapturedParamNameType> Params;
- if (SemaRef.getLangOpts().OpenMPIsTargetDevice) {
- QualType VoidPtrTy = Context.VoidPtrTy.withConst().withRestrict();
- Params.push_back(std::make_pair(StringRef("dyn_ptr"), VoidPtrTy));
- }
// __context with shared vars
Params.push_back(std::make_pair(StringRef(), QualType()));
+ // Implicit dyn_ptr argument, appended as the last parameter. Present on both
+ // host and device so argument counts match without runtime manipulation.
+ QualType VoidPtrTy = Context.VoidPtrTy.withConst().withRestrict();
+ Params.push_back(std::make_pair(StringRef("dyn_ptr"), VoidPtrTy));
return Params;
}
diff --git a/clang/test/AST/ast-dump-openmp-target-parallel-for-simd.c b/clang/test/AST/ast-dump-openmp-target-parallel-for-simd.c
index cae1f0e018c59..e483f215d2577 100644
--- a/clang/test/AST/ast-dump-openmp-target-parallel-for-simd.c
+++ b/clang/test/AST/ast-dump-openmp-target-parallel-for-simd.c
@@ -68,6 +68,7 @@ void test_five(int x, int y, int z) {
// CHECK-NEXT: | | | | | | `-IntegerLiteral {{.*}} <col:16> 'int' 0
// CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} <col:23> 'int' lvalue ParmVar {{.*}} 'x' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | | | |-ImplicitParamDecl {{.*}} <line:4:1> col:1 implicit __context 'struct (unnamed at {{.*}}ast-dump-openmp-target-parallel-for-simd.c:4:1) *const restrict'
+// CHECK-NEXT: | | | | |-ImplicitParamDecl {{.*}} <col:1> col:1 implicit dyn_ptr 'void *const restrict'
// CHECK-NEXT: | | | | |-RecordDecl {{.*}} <col:1> col:1 implicit struct definition
// CHECK-NEXT: | | | | | |-CapturedRecordAttr {{.*}} <<invalid sloc>> Implicit
// CHECK-NEXT: | | | | | `-FieldDecl {{.*}} <line:5:23> col:23 implicit 'int'
@@ -126,6 +127,7 @@ void test_five(int x, int y, int z) {
// CHECK-NEXT: | | | | `-IntegerLiteral {{.*}} <col:16> 'int' 0
// CHECK-NEXT: | | | `-DeclRefExpr {{.*}} <col:23> 'int' lvalue ParmVar {{.*}} 'x' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} <line:4:1> col:1 implicit __context 'struct (unnamed at {{.*}}ast-dump-openmp-target-parallel-for-simd.c:4:1) *const restrict'
+// CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} <col:1> col:1 implicit dyn_ptr 'void *const restrict'
// CHECK-NEXT: | | |-RecordDecl {{.*}} <col:1> col:1 implicit struct definition
// CHECK-NEXT: | | | |-CapturedRecordAttr {{.*}} <<invalid sloc>> Implicit
// CHECK-NEXT: | | | `-FieldDecl {{.*}} <line:5:23> col:23 implicit 'int'
@@ -199,6 +201,7 @@ void test_five(int x, int y, int z) {
// CHECK-NEXT: | | | | | |-DeclRefExpr {{.*}} <line:11:23> 'int' lvalue ParmVar {{.*}} 'x' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} <line:12:25> 'int' lvalue ParmVar {{.*}} 'y' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | | | |-ImplicitParamDecl {{.*}} <line:10:1> col:1 implicit __context 'struct (unnamed at {{.*}}ast-dump-openmp-target-parallel-for-simd.c:10:1) *const restrict'
+// CHECK-NEXT: | | | | |-ImplicitParamDecl {{.*}} <col:1> col:1 implicit dyn_ptr 'void *const restrict'
// CHECK-NEXT: | | | | |-RecordDecl {{.*}} <col:1> col:1 implicit struct definition
// CHECK-NEXT: | | | | | |-CapturedRecordAttr {{.*}} <<invalid sloc>> Implicit
// CHECK-NEXT: | | | | | |-FieldDecl {{.*}} <line:11:23> col:23 implicit 'int'
@@ -291,6 +294,7 @@ void test_five(int x, int y, int z) {
// CHECK-NEXT: | | | |-DeclRefExpr {{.*}} <line:11:23> 'int' lvalue ParmVar {{.*}} 'x' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | | `-DeclRefExpr {{.*}} <line:12:25> 'int' lvalue ParmVar {{.*}} 'y' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} <line:10:1> col:1 implicit __context 'struct (unnamed at {{.*}}ast-dump-openmp-target-parallel-for-simd.c:10:1) *const restrict'
+// CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} <col:1> col:1 implicit dyn_ptr 'void *const restrict'
// CHECK-NEXT: | | |-RecordDecl {{.*}} <col:1> col:1 implicit struct definition
// CHECK-NEXT: | | | |-CapturedRecordAttr {{.*}} <<invalid sloc>> Implicit
// CHECK-NEXT: | | | |-FieldDecl {{.*}} <line:11:23> col:23 implicit 'int'
@@ -385,6 +389,7 @@ void test_five(int x, int y, int z) {
// CHECK-NEXT: | | | | | |-DeclRefExpr {{.*}} <line:18:23> 'int' lvalue ParmVar {{.*}} 'x' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} <line:19:25> 'int' lvalue ParmVar {{.*}} 'y' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | | | |-ImplicitParamDecl {{.*}} <line:17:1> col:1 implicit __context 'struct (unnamed at {{.*}}ast-dump-openmp-target-parallel-for-simd.c:17:1) *const restrict'
+// CHECK-NEXT: | | | | |-ImplicitParamDecl {{.*}} <col:1> col:1 implicit dyn_ptr 'void *const restrict'
// CHECK-NEXT: | | | | |-RecordDecl {{.*}} <col:1> col:1 implicit struct definition
// CHECK-NEXT: | | | | | |-CapturedRecordAttr {{.*}} <<invalid sloc>> Implicit
// CHECK-NEXT: | | | | | |-FieldDecl {{.*}} <line:18:23> col:23 implicit 'int'
@@ -477,6 +482,7 @@ void test_five(int x, int y, int z) {
// CHECK-NEXT: | | | |-DeclRefExpr {{.*}} <line:18:23> 'int' lvalue ParmVar {{.*}} 'x' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | | `-DeclRefExpr {{.*}} <line:19:25> 'int' lvalue ParmVar {{.*}} 'y' 'int' refers_to_enclosing_variable_or_capture
// CHECK-NEXT: | | |-ImplicitParamDecl {{.*}} <line:17:1> col:1 implicit __context 'struct (unnamed at {{.*}}ast-dump-openmp-target-parallel-for-simd.c:17:1) *const restrict'
+// CHECK-NEXT: | | |-ImplicitParamDecl...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/186261
More information about the cfe-commits
mailing list