<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64835>64835</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
-print-changed=cdiff does not work on macOS 13
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
winocm
</td>
</tr>
</table>
<pre>
I was trying to debug an ISel related bug when I noticed that "-print-changed=cdiff" is now completely broken on macOS 13. It used to work in previous versions of the OS as diff(1) was based on GNU diff, but it seems like macOS 13 includes a version of diff(1) based on FreeBSD. As such, this ends up happening:
```
*** IR Dump After Lazy Machine Block Frequency Analysis (lazy-machine-block-freq) on main omitted because no change ***
*** IR Dump After Machine Optimization Remark Emitter (machine-opt-remark-emitter) on main omitted because no change ***
*** IR Dump After Prologue/Epilogue Insertion & Frame Finalization (prologepilog) on main ***
diff: unrecognized option `--old-line-format=\033[31m-%l\033[0m
'
usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
[--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
[-I pattern] [-F pattern] [-L label] file1 file2
diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
[--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
[-F pattern] -C number file1 file2
diff [-aBbdiltw] [-I pattern] [--ignore-case] [--no-ignore-case]
[--normal] [--strip-trailing-cr] [--tabsize] -D string file1 file2
diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
[--no-ignore-case] [--normal] [--tabsize] [--strip-trailing-cr]
[-F pattern] -U number file1 file2
diff [-aBbdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
[--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]
[-F pattern] [-S name] [-X file] [-x pattern] dir1 dir2
diff [-aBbditwW] [--expand-tabs] [--ignore-all-blanks]
[--ignore-blank-lines] [--ignore-case] [--minimal]
[--no-ignore-file-name-case] [--strip-trailing-cr]
[--suppress-common-lines] [--tabsize] [--text] [--width]
-y | --side-by-side file1 file2
diff [--help] [--version]
*** IR Dump After Post-RA pseudo instruction expansion pass (postrapseudos) on main ***
diff: unrecognized option `--old-line-format=\033[31m-%l\033[0m
'
usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
[--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
[-I pattern] [-F pattern] [-L label] file1 file2
diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
[--no-ignore-case] [--normal] [--strip-trailing-cr] [--tabsize]
[-F pattern] -C number file1 file2
diff [-aBbdiltw] [-I pattern] [--ignore-case] [--no-ignore-case]
[--normal] [--strip-trailing-cr] [--tabsize] -D string file1 file2
diff [-aBbdilpTtw] [-I pattern] [-L label] [--ignore-case]
[--no-ignore-case] [--normal] [--tabsize] [--strip-trailing-cr]
[-F pattern] -U number file1 file2
diff [-aBbdilNPprsTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case]
[--no-ignore-case] [--normal] [--tabsize] [-I pattern] [-L label]
[-F pattern] [-S name] [-X file] [-x pattern] dir1 dir2
diff [-aBbditwW] [--expand-tabs] [--ignore-all-blanks]
[--ignore-blank-lines] [--ignore-case] [--minimal]
[--no-ignore-file-name-case] [--strip-trailing-cr]
[--suppress-common-lines] [--tabsize] [--text] [--width]
-y | --side-by-side file1 file2
diff [--help] [--version]
```
This makes debugging (M)IR passes rather difficult. The version of diff(1) does accept the `diff --changed-group-format=` argument though, so replacing the system diff invocation inside `llvm/lib/IR/PrintPasses.cpp` should suffice.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWF1v2zoS_TX0y4CGTEWO_eCHJK4XBvoRJC12XylqLHFNkSw_4jq_fkEq9jpuk5sC96HATWCIEjk8c-aMlJGGey9bjbgg1TWpliMeQ2fcYie1Ef2oNs1-sYYd9xDcXuoWgo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