diff options
author | Ayke van Laethem <[email protected]> | 2022-05-30 14:55:14 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-05-30 20:39:42 +0200 |
commit | 97842b367c0fc92499f73b9b63014247906f9190 (patch) | |
tree | 12de5a509bcb66002452ea7fc08abe1a8fd092e9 /transform/optimizer.go | |
parent | 9246899b309110a1fea87abbe5b4d12bb8a71fa4 (diff) | |
download | tinygo-97842b367c0fc92499f73b9b63014247906f9190.tar.gz tinygo-97842b367c0fc92499f73b9b63014247906f9190.zip |
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.
Diffstat (limited to 'transform/optimizer.go')
-rw-r--r-- | transform/optimizer.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/transform/optimizer.go b/transform/optimizer.go index 66ad43f4b..e688a5394 100644 --- a/transform/optimizer.go +++ b/transform/optimizer.go @@ -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) |