aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-04-14 22:43:32 +0200
committerRon Evans <[email protected]>2020-10-13 20:23:50 +0200
commitb40f250530769330cec4a2ae0a9ba6e0c6ce058a (patch)
tree83736ddcb5df3c00ef0b95bb41482c9e77133c86 /interp
parent184175378f56e8ad03b6048fb40f5138e9710adb (diff)
downloadtinygo-b40f250530769330cec4a2ae0a9ba6e0c6ce058a.tar.gz
tinygo-b40f250530769330cec4a2ae0a9ba6e0c6ce058a.zip
main: add initial support for (in-development) LLVM 11
This can be useful to test improvements in LLVM master and to make it possible to support LLVM 11 for the most part already before the next release. That also allows catching LLVM bugs early to fix them upstream. Note that tests do not yet pass for this LLVM version, but the TinyGo compiler can be built with the binaries from apt.llvm.org (at the time of making this commit).
Diffstat (limited to 'interp')
-rw-r--r--interp/interp_test.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/interp/interp_test.go b/interp/interp_test.go
index 6b0cc38f2..dba738718 100644
--- a/interp/interp_test.go
+++ b/interp/interp_test.go
@@ -3,6 +3,7 @@ package interp
import (
"io/ioutil"
"os"
+ "regexp"
"strings"
"testing"
@@ -66,6 +67,8 @@ func runTest(t *testing.T, pathPrefix string) {
}
}
+var alignRegexp = regexp.MustCompile(", align [0-9]+$")
+
// fuzzyEqualIR returns true if the two LLVM IR strings passed in are roughly
// equal. That means, only relevant lines are compared (excluding comments
// etc.).
@@ -75,8 +78,18 @@ func fuzzyEqualIR(s1, s2 string) bool {
if len(lines1) != len(lines2) {
return false
}
- for i, line := range lines1 {
- if line != lines2[i] {
+ for i, line1 := range lines1 {
+ line2 := lines2[i]
+ match1 := alignRegexp.MatchString(line1)
+ match2 := alignRegexp.MatchString(line2)
+ if match1 != match2 {
+ // Only one of the lines has the align keyword. Remove it.
+ // This is a change to make the test work in both LLVM 10 and LLVM
+ // 11 (LLVM 11 appears to automatically add alignment everywhere).
+ line1 = alignRegexp.ReplaceAllString(line1, "")
+ line2 = alignRegexp.ReplaceAllString(line2, "")
+ }
+ if line1 != line2 {
return false
}
}