argotorg / argotorg/solidity

Inlining heuristics for `FunctionSpecializer`

Open
#13,787 4 comments 2 reactions 0 assignees View on GitHub
annoys users :cry: high impact must have optimizer
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Abstract and Motivation

This mainly came up in https://twitter.com/d1ll0nk/status/1600472867661295616. In short, for code where function pointers are used as arguments, `FunctionSpecializer` would end up specializing the function (because the function pointers would be constants). This may lead to code that's not ideal.

## Specification

Use a similar heuristic to the `FullInliner` in the `FunctionSpecializer`. The original context for `FunctionSpecializer` was to handle cases that the `FullInliner` couldn't do. So we have to rethink and benchmark this again, especially since the inline heuristics were changed after the new Yul code transform.

Contributor guide

Open the contributing guide

Research direction

Locate the FunctionSpecializer and FullInliner implementations and compare their current inlining heuristics. Review how the heuristics changed with the new Yul code transform, then benchmark function-pointer cases and confirm that specialization no longer produces undesirable code.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.