aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorSlava Zakharin <szakharin@nvidia.com>2025-02-24 09:27:48 -0800
committerGitHub <noreply@github.com>2025-02-24 09:27:48 -0800
commit36fdeb2aded08a776fcffefa73cb7667e7fc6c2d (patch)
treeaf6de1cf6d39d94453b6b562e18752e70a94e77b /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parentcc7f22ee6ccb2c1ad79834e06d5b18d8f014d140 (diff)
downloadllvm-36fdeb2aded08a776fcffefa73cb7667e7fc6c2d.zip
llvm-36fdeb2aded08a776fcffefa73cb7667e7fc6c2d.tar.gz
llvm-36fdeb2aded08a776fcffefa73cb7667e7fc6c2d.tar.bz2
[flang] Set LLVM specific attributes to fir.call's of Fortran runtime. (#128093)
This change is inspired by a case in facerec benchmark, where performance of scalar code may improve by about 6%@aarch64 due to getting rid of redundant loads from Fortran descriptors. These descriptors are corresponding to subroutine local ALLOCATABLE, SAVE variables. The scalar loop nest in LocalMove subroutine contains call to Fortran runtime IO functions, and LLVM globals-aa analysis cannot prove that these calls do not modify the globalized descriptors with internal linkage. This patch sets and propagates llvm.memory_effects attribute for fir.call operations calling Fortran runtime functions. In particular, it tries to set the Other memory effect to NoModRef. The Other memory effect includes accesses to globals and captured pointers, so we cannot set it for functions taking Fortran descriptors with one exception for calls where the Fortran descriptor arguments are all null. As long as different calls to the same Fortran runtime function may have different attributes, I decided to attach the attributes to the calls rather than functions. Moreover, attaching the attributes to func.func will require propagating these attributes to llvm.func, which is not happening right now. In addition to llvm.memory_effects, the new pass sets llvm.nosync and llvm.nocallback attributes that may also help LLVM alias analysis (e.g. see #127707). These attributes are ignored currently. I will support them in LLVM IR dialect in a separate patch. I also added another pass for developers to be able to print declarations/calls of all Fortran runtime functions that are recognized by the attributes setting pass. It should help with maintenance of the LIT tests.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions