aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorHassnaa Hamdi <hassnaa.hamdi@arm.com>2025-05-06 11:25:37 +0100
committerGitHub <noreply@github.com>2025-05-06 11:25:37 +0100
commit0159a26744dd3ca332973c0e1cd8f6ccbace2927 (patch)
treedb976cfbd2a276edb6b370587d41cad050736dbb /flang/lib/Frontend/CompilerInvocation.cpp
parent8ea5eacea263ed5c2c4b0950a4d1d6ef863444bc (diff)
downloadllvm-0159a26744dd3ca332973c0e1cd8f6ccbace2927.zip
llvm-0159a26744dd3ca332973c0e1cd8f6ccbace2927.tar.gz
llvm-0159a26744dd3ca332973c0e1cd8f6ccbace2927.tar.bz2
[InlineCost]: Add a new heuristic to branch folding for better inlining decisions.
Recursive functions are generally not inlined to avoid issues like infinite inlining or excessive code expansion. However, this conservative approach misses opportunities for optimization in cases where a recursive call is guaranteed to execute only once. This patch detects a scenario where a guarding branch condition of a recursive call will become false after the first iteration of the recursive function. If such a condition is met, and the recursion depth is confirmed to be one, the Inliner will now consider this recursive function for inlining. A new test case (`test/Transforms/Inline/inline-recursive-fn.ll`) has been added to verify this behaviour.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions