[OpenMP] Internalize functions in OpenMPOpt to improve IPO passes
authorJoseph Huber <jhuber6@vols.utk.edu>
Thu, 20 May 2021 02:57:24 +0000 (22:57 -0400)
committerHuber, Joseph <huberjn@ornl.gov>
Tue, 22 Jun 2021 16:38:10 +0000 (12:38 -0400)
commit03d7e61c87eb94083d22ff55cf30c0a378ab6824
tree09d4c88cbb8ace535fb01d49d9f859fdf80fda68
parentc747b7d1d9a2c9e4ba82ce93c9273c1662d6994a
[OpenMP] Internalize functions in OpenMPOpt to improve IPO passes

Summary:
Currently the attributor needs to give up if a function has external linkage.
This means that the optimization introduced in D97818 will only apply to static
functions. This change uses the Attributor to internalize OpenMP device
routines by making a copy of each function with private linkage and replacing
the uses in the module with it. This allows for the optimization to be applied
to any regular function.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D102824
clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/test/Transforms/OpenMP/replace_globalization.ll
llvm/test/Transforms/OpenMP/single_threaded_execution.ll