Skip to content

Improve indirect call effects in GlobalEffects#8644

Open
stevenfontanella wants to merge 3 commits intoindirect-effects-sccfrom
indirect-effects-address
Open

Improve indirect call effects in GlobalEffects#8644
stevenfontanella wants to merge 3 commits intoindirect-effects-sccfrom
indirect-effects-address

Conversation

@stevenfontanella
Copy link
Copy Markdown
Member

@stevenfontanella stevenfontanella commented Apr 23, 2026

Part of #8615. We currently union the effects of all functions of a given type when computing the effects for indirect calls. Make this more precise by excluding effects of functions that never have their address taken.

Continued from #8628 which was accidentally merged.

@stevenfontanella stevenfontanella changed the title Indirect effects address Improve indirect call effects in GlobalEffects Apr 23, 2026
@stevenfontanella stevenfontanella marked this pull request as ready for review April 23, 2026 20:01
@stevenfontanella stevenfontanella requested a review from a team as a code owner April 23, 2026 20:01
Comment on lines +93 to +96
ElementUtils::iterAllElementFunctionNames(
&module, [&addressedFuncs, &module](Name func) {
addressedFuncs.insert(module.getFunction(func));
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to do this separately. Walking the module code will already walk all the element segments and find the RefFunc expressions inside them.

an indirect call and we don't need to include its effects in indirect calls.
*/
std::unordered_set<Function*> getAddressedFuncs(Module& module) {
struct AddressedFuncsWalker : PostWalker<AddressedFuncsWalker> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well make this a WalkerPass so it can be run on all the functions in parallel. Then instead of walkModule below, you would use walkModuleCode. Alternatively you could use ModuleUtils::ParallelFunctionAnalysis + walkModuleCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants