Skip to content

Commit

Permalink
transform: run OptimizeMaps during package optimizations
Browse files Browse the repository at this point in the history
This shrinks transform.Optimize() a little bit, working towards the goal
of tinygo-org#2870. I ran the smoke
tests and there is no practical downside: one test got smaller (??) and
one had a different .hex hash, but other than that there was no
difference.

This should also make TinyGo a liiitle bit faster but it's probably not
even measurable.
  • Loading branch information
aykevl authored and deadprogram committed May 30, 2022
1 parent 9246899 commit 97842b3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion transform/optimizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func OptimizePackage(mod llvm.Module, config *compileopts.Config) {
funcPasses.RunFunc(fn)
}
funcPasses.FinalizeFunc()

// Run TinyGo-specific optimization passes.
if optLevel > 0 {
OptimizeMaps(mod)
}
}

// Optimize runs a number of optimization and transformation passes over the
Expand Down Expand Up @@ -92,7 +97,6 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
goPasses.Run(mod)

// Run TinyGo-specific optimization passes.
OptimizeMaps(mod)
OptimizeStringToBytes(mod)
OptimizeReflectImplements(mod)
OptimizeAllocs(mod, nil, nil)
Expand Down

0 comments on commit 97842b3

Please sign in to comment.