all: move OptimizeMaps to transforms and add tests

This commit is contained in:
Ayke van Laethem
2019-08-17 17:36:07 +02:00
committed by Ron Evans
parent d905476231
commit 8cd2c7502e
5 changed files with 159 additions and 43 deletions
+22
View File
@@ -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)
})
}