-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.RefactoringIssues related to refactoring toolsIssues related to refactoring toolsToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
Description
@lfolger reported a suboptimal inliner result of this form:
var g = foo()
func f(x, y any) { f2(x, y) }
// before
f(complicated(), g)
// after
var ( x = complicated(); y = g )
f2(x, y)
In this case, the inliner's effects analysis assumed conservatively that the read from global var g would not commute with the call to complicated(). However, the variable g is not address-taken and is assigned only in its declaration.
The inliner's effects analysis should enumerate all non-address-taken variables (non-exported variables that appear in an lvalue position only in their own declaration) and allow reads of them to commute with global effects such as complicated(), resulting in this more optimal inlining: f2(g, complicated())
.
Metadata
Metadata
Assignees
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.RefactoringIssues related to refactoring toolsIssues related to refactoring toolsToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.