[all-commits] [llvm/llvm-project] 0159a2: [InlineCost]: Add a new heuristic to branch foldin...
Hassnaa Hamdi via All-commits
all-commits at lists.llvm.org
Tue May 6 03:25:59 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0159a26744dd3ca332973c0e1cd8f6ccbace2927
https://github.com/llvm/llvm-project/commit/0159a26744dd3ca332973c0e1cd8f6ccbace2927
Author: Hassnaa Hamdi <hassnaa.hamdi at arm.com>
Date: 2025-05-06 (Tue, 06 May 2025)
Changed paths:
M llvm/lib/Analysis/InlineCost.cpp
A llvm/test/Transforms/Inline/inline-recursive-fn.ll
Log Message:
-----------
[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.
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