[all-commits] [llvm/llvm-project] e21532: [flang][StackArrays] skip analysis of very large f...
Tom Eccles via All-commits
all-commits at lists.llvm.org
Fri Nov 3 03:29:46 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e21532418528f0cbcec4c811ce0ea41e8b3075fe
https://github.com/llvm/llvm-project/commit/e21532418528f0cbcec4c811ce0ea41e8b3075fe
Author: Tom Eccles <tom.eccles at arm.com>
Date: 2023-11-03 (Fri, 03 Nov 2023)
Changed paths:
M flang/lib/Optimizer/Transforms/StackArrays.cpp
Log Message:
-----------
[flang][StackArrays] skip analysis of very large functions (#71047)
The stack arrays pass uses data flow analysis to determine whether heap
allocations are freed on all paths out of the function.
`interp_domain_em_part2` in spec2017 wrf generates over 120k operations,
including almost 5k fir.if operations and over 200 fir.do_loop
operations, all in the same function. The MLIR data flow analysis
framework cannot provide reasonable performance for such cases because
there is a combinatorial explosion in the number of control flow paths
through the function, all of which must be checked to determine if the
heap allocations will be freed.
This patch skips the stack arrays pass for ridiculously large functions
(defined as having more than 1000 fir.allocmem operations). This
threshold is configurable at runtime with a command line argument.
With this patch, compiling this file is more than 80% faster.
More information about the All-commits
mailing list