Skip to content

Commit 97842b3

Browse files
aykevldeadprogram
authored andcommitted
transform: run OptimizeMaps during package optimizations
This shrinks transform.Optimize() a little bit, working towards the goal of #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.
1 parent 9246899 commit 97842b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

transform/optimizer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ func OptimizePackage(mod llvm.Module, config *compileopts.Config) {
3737
funcPasses.RunFunc(fn)
3838
}
3939
funcPasses.FinalizeFunc()
40+
41+
// Run TinyGo-specific optimization passes.
42+
if optLevel > 0 {
43+
OptimizeMaps(mod)
44+
}
4045
}
4146

4247
// 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
9297
goPasses.Run(mod)
9398

9499
// Run TinyGo-specific optimization passes.
95-
OptimizeMaps(mod)
96100
OptimizeStringToBytes(mod)
97101
OptimizeReflectImplements(mod)
98102
OptimizeAllocs(mod, nil, nil)

0 commit comments

Comments
 (0)