transform: run OptimizeMaps during package optimizations

This shrinks transform.Optimize() a little bit, working towards the goal
of https://github.com/tinygo-org/tinygo/issues/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.
Этот коммит содержится в:
Ayke van Laethem 2022-05-30 14:55:14 +02:00 коммит произвёл Ron Evans
родитель 9246899b30
коммит 97842b367c

Просмотреть файл

@ -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
@ -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)