[all-commits] [llvm/llvm-project] 0caa8f: Reland "[flang] Set LLVM specific attributes to fi...
Slava Zakharin via All-commits
all-commits at lists.llvm.org
Mon Feb 24 14:18:42 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0caa8f42be0b2d00527ad2d94144dcbb2a427605
https://github.com/llvm/llvm-project/commit/0caa8f42be0b2d00527ad2d94144dcbb2a427605
Author: Slava Zakharin <szakharin at nvidia.com>
Date: 2025-02-24 (Mon, 24 Feb 2025)
Changed paths:
M flang/include/flang/Optimizer/Builder/FIRBuilder.h
M flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h
M flang/include/flang/Optimizer/Dialect/FIRDialect.td
M flang/include/flang/Optimizer/Transforms/Passes.h
M flang/include/flang/Optimizer/Transforms/Passes.td
A flang/include/flang/Optimizer/Transforms/RuntimeFunctions.inc
M flang/lib/Lower/IO.cpp
M flang/lib/Optimizer/Builder/FIRBuilder.cpp
M flang/lib/Optimizer/CodeGen/CodeGen.cpp
M flang/lib/Optimizer/Passes/Pipelines.cpp
M flang/lib/Optimizer/Transforms/CMakeLists.txt
A flang/lib/Optimizer/Transforms/GenRuntimeCallsForTest.cpp
A flang/lib/Optimizer/Transforms/SetRuntimeCallAttributes.cpp
M flang/test/Driver/mlir-pass-pipeline.f90
M flang/test/Fir/basic-program.fir
M flang/test/Lower/array-temp.f90
A flang/test/Transforms/set-runtime-call-attributes.fir
A flang/test/Transforms/verify-known-runtime-functions.fir
A flang/test/Utils/generate-checks-for-runtime-funcs.py
Log Message:
-----------
Reland "[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.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list