compiler: move OptimizeStringToBytes to transform package

Unfortunately, while doing this I found that it doesn't actually apply
in any real-world programs (tested with `make smoketest`), apparently
because nil pointer checking messes with the functionattrs pass. I hope
to fix that after moving to LLVM 9, which has an optimization that makes
nil pointer checking easier to implement.
This commit is contained in:
Ayke van Laethem
2019-09-21 18:05:23 +02:00
committed by Ron Evans
parent cea0d9f864
commit 65beddafe8
6 changed files with 151 additions and 102 deletions
+15
View File
@@ -0,0 +1,15 @@
package transform
import (
"testing"
"tinygo.org/x/go-llvm"
)
func TestOptimizeStringToBytes(t *testing.T) {
t.Parallel()
testTransform(t, "testdata/stringtobytes", func(mod llvm.Module) {
// Run optimization pass.
OptimizeStringToBytes(mod)
})
}