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)
| 81 | // equal. That means, only relevant lines are compared (excluding comments |
| 82 | // etc.). |
| 83 | func 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 |
no test coverage detected