[all-commits] [llvm/llvm-project] 0ba595: [flang] Optimize assignments of multidimensional a...
Leandro Lupori via All-commits
all-commits at lists.llvm.org
Fri Jul 4 04:50:13 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0ba59587fa98849ed5107fee4134e810e84b69a3
https://github.com/llvm/llvm-project/commit/0ba59587fa98849ed5107fee4134e810e84b69a3
Author: Leandro Lupori <leandro.lupori at linaro.org>
Date: 2025-07-04 (Fri, 04 Jul 2025)
Changed paths:
M flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
M flang/test/HLFIR/opt-scalar-assign.fir
Log Message:
-----------
[flang] Optimize assignments of multidimensional arrays (#146408)
Assignments of n-dimensional arrays, with trivial RHS, were
always being converted to n nested loops. For contiguous arrays,
it's possible to flatten them and use a single loop, that can
usually be better optimized by LLVM.
In a test program, using a 3-dimensional array and varying its
size, the resulting speedup was as follows (measured on Graviton4):
16K 1.09
64K 1.40
128K 1.90
256K 1.91
512K 1.00
For sizes above or equal to 512K no improvement was observed.
It looks like LLVM stops trying to perform aggressive loop
unrolling at a certain threshold and just uses nested loops
instead. Larger sizes won't fit on L1 and L2 caches too.
This was noticed while profiling 527.cam4_r. This optimization
makes aer_rad_props_sw slightly faster, but unfortunately it
practically doesn't change 527.cam4_r total execution time.
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