MCPcopy
hub / github.com/tinygo-org/tinygo / fuzzyEqualIR

Function fuzzyEqualIR

transform/transform_test.go:83–97  ·  view source on GitHub ↗

fuzzyEqualIR returns true if the two LLVM IR strings passed in are roughly equal. That means, only relevant lines are compared (excluding comments etc.).

(s1, s2 string)

Source from the content-addressed store, hash-verified

81// equal. That means, only relevant lines are compared (excluding comments
82// etc.).
83func fuzzyEqualIR(s1, s2 string) bool {
84 lines1 := filterIrrelevantIRLines(strings.Split(s1, "\n"))
85 lines2 := filterIrrelevantIRLines(strings.Split(s2, "\n"))
86 if len(lines1) != len(lines2) {
87 return false
88 }
89 for i, line1 := range lines1 {
90 line2 := lines2[i]
91 if line1 != line2 {
92 return false
93 }
94 }
95
96 return true
97}
98
99// filterIrrelevantIRLines removes lines from the input slice of strings that
100// are not relevant in comparing IR. For example, empty lines and comments are

Callers 1

testTransformFunction · 0.70

Calls 1

filterIrrelevantIRLinesFunction · 0.70

Tested by

no test coverage detected