mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 22:13:39 +00:00
all: move OptimizeMaps to transforms and add tests
This commit is contained in:
committed by
Ron Evans
parent
d905476231
commit
8cd2c7502e
@@ -0,0 +1,22 @@
|
||||
package transform
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"tinygo.org/x/go-llvm"
|
||||
)
|
||||
|
||||
func TestOptimizeMaps(t *testing.T) {
|
||||
t.Parallel()
|
||||
testTransform(t, "testdata/maps", func(mod llvm.Module) {
|
||||
// Run optimization pass.
|
||||
OptimizeMaps(mod)
|
||||
|
||||
// Run an optimization pass, to clean up the result.
|
||||
// This shows that all code related to the map is really eliminated.
|
||||
pm := llvm.NewPassManager()
|
||||
defer pm.Dispose()
|
||||
pm.AddDeadStoreEliminationPass()
|
||||
pm.Run(mod)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user