<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60993>60993</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm-diff claims file is different from itself
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rptb1
</td>
</tr>
</table>
<pre>
The [llvm-diff tool](https://www.llvm.org/docs/CommandGuide/llvm-diff.html) produces a false positive result when comparing some files with themselves. That is, `llvm-diff X X` outputs differences and exits with code 1.
I have observed this in both version 14 and 15.
Here is a quick repro and example, including detailed version info.
```
rb@plover:~/tmp$ llvm-diff-15 --version
Ubuntu LLVM version 15.0.6
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: znver1
rb@plover:~/tmp$ clang-15 --version
Ubuntu clang version 15.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
rb@plover:~/tmp$ uname -a
Linux plover 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
rb@plover:~/tmp$ clang-15 -dumpmachine
x86_64-pc-linux-gnu
rb@plover:~/tmp$ git clone --depth=1 https://github.com/Ravenbrook/mps.git
rb@plover:~/tmp$ cd mps/code
rb@plover:~/tmp/mps/code$ git log --oneline -n 1
142999b (grafted, HEAD -> master, origin/master, origin/HEAD) Merging branch/2023-02-16/manual-xrefs for GitHub pull request #159 <https://github.com/Ravenbrook/mps/pull/159>.
rb@plover:~/tmp/mps/code$ clang-15 -S -emit-llvm trace.c
rb@plover:~/tmp/mps/code$ llvm-diff-15 trace.ll trace.ll
in function ScanStateCheck:
in block %14 / %14:
> %15 = phi i1 [ false, %6 ], [ %13, %9 ]
> %16 = zext i1 %15 to i32
> %17 = icmp ne i32 %16, 0
> %18 = zext i1 %17 to i32
> %19 = sext i32 %18 to i64
> %20 = icmp ne i64 %19, 0
> br i1 %20, label %21, label %24
< %15 = phi i1 [ false, %6 ], [ %13, %9 ]
< %16 = zext i1 %15 to i32
< %17 = icmp ne i32 %16, 0
< %18 = zext i1 %17 to i32
< %19 = sext i32 %18 to i64
< %20 = icmp ne i64 %19, 0
< br i1 %20, label %21, label %24
in function TraceCheck:
in block %11 / %11:
> %12 = phi i1 [ false, %3 ], [ %10, %6 ]
> %13 = zext i1 %12 to i32
> %14 = icmp ne i32 %13, 0
> %15 = zext i1 %14 to i32
> %16 = sext i32 %15 to i64
> %17 = icmp ne i64 %16, 0
> br i1 %17, label %18, label %21
< %12 = phi i1 [ false, %3 ], [ %10, %6 ]
< %13 = zext i1 %12 to i32
< %14 = icmp ne i32 %13, 0
< %15 = zext i1 %14 to i32
< %16 = sext i32 %15 to i64
< %17 = icmp ne i64 %16, 0
< br i1 %17, label %18, label %21
in function TraceAddWhite:
in block %174 / %174:
> %175 = phi i1 [ false, %161 ], [ false, %158 ], [ %173, %166 ]
> %176 = zext i1 %175 to i32
> %177 = icmp ne i32 %176, 0
> %178 = zext i1 %177 to i32
> %179 = sext i32 %178 to i64
> %180 = icmp ne i64 %179, 0
> br i1 %180, label %182, label %181
< %175 = phi i1 [ false, %161 ], [ false, %158 ], [ %173, %166 ]
< %176 = zext i1 %175 to i32
< %177 = icmp ne i32 %176, 0
< %178 = zext i1 %177 to i32
< %179 = sext i32 %178 to i64
< %180 = icmp ne i64 %179, 0
< br i1 %180, label %182, label %181
in block %227 / %227:
> %228 = phi i1 [ false, %182 ], [ false, %151 ], [ %226, %215 ]
> %229 = zext i1 %228 to i32
> %230 = icmp ne i32 %229, 0
> %231 = zext i1 %230 to i32
> %232 = sext i32 %231 to i64
> %233 = icmp ne i64 %232, 0
> br i1 %233, label %235, label %234
< %228 = phi i1 [ false, %182 ], [ false, %151 ], [ %226, %215 ]
< %229 = zext i1 %228 to i32
< %230 = icmp ne i32 %229, 0
< %231 = zext i1 %230 to i32
< %232 = sext i32 %231 to i64
< %233 = icmp ne i64 %232, 0
< br i1 %233, label %235, label %234
in function TraceRankForAccess:
in block %49 / %49:
> %50 = phi i1 [ false, %40 ], [ %48, %43 ]
> %51 = zext i1 %50 to i32
> %52 = icmp ne i32 %51, 0
> %53 = zext i1 %52 to i32
> %54 = sext i32 %53 to i64
> %55 = icmp ne i64 %54, 0
> br i1 %55, label %56, label %59
< %50 = phi i1 [ false, %40 ], [ %48, %43 ]
< %51 = zext i1 %50 to i32
< %52 = icmp ne i32 %51, 0
< %53 = zext i1 %52 to i32
< %54 = sext i32 %53 to i64
< %55 = icmp ne i64 %54, 0
< br i1 %55, label %56, label %59
in function TraceSegAccess:
in block %84 / %84:
> %85 = phi i1 [ true, %70 ], [ %83, %73 ]
> %86 = zext i1 %85 to i32
> %87 = icmp ne i32 %86, 0
> %88 = zext i1 %87 to i32
> %89 = sext i32 %88 to i64
> %90 = icmp ne i64 %89, 0
> br i1 %90, label %91, label %94
< %85 = phi i1 [ true, %70 ], [ %83, %73 ]
< %86 = zext i1 %85 to i32
< %87 = icmp ne i32 %86, 0
< %88 = zext i1 %87 to i32
< %89 = sext i32 %88 to i64
< %90 = icmp ne i64 %89, 0
< br i1 %90, label %91, label %94
in function TraceStart:
in block %201 / %201:
> %202 = phi i1 [ false, %180 ], [ false, %173 ], [ %200, %189 ]
> %203 = zext i1 %202 to i32
> %204 = icmp ne i32 %203, 0
> %205 = zext i1 %204 to i32
> %206 = sext i32 %205 to i64
> %207 = icmp ne i64 %206, 0
> br i1 %207, label %209, label %208
< %202 = phi i1 [ false, %180 ], [ false, %173 ], [ %200, %189 ]
< %203 = zext i1 %202 to i32
< %204 = icmp ne i32 %203, 0
< %205 = zext i1 %204 to i32
< %206 = sext i32 %205 to i64
< %207 = icmp ne i64 %206, 0
< br i1 %207, label %209, label %208
in function TracePoll:
in block %97 / %97:
> %98 = phi i1 [ false, %82 ], [ %96, %87 ]
> br i1 %98, label %80, label %99, !llvm.loop !6
< %98 = phi i1 [ false, %82 ], [ %96, %87 ]
< br i1 %98, label %80, label %99, !llvm.loop !6
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WVtv2zoS_jX0y0AGRYm6PPghh6naXbS7xUm6e94WutAWN9TlUFSS7cP-9gPKjh1Zl5RFUKBoTHE4HH0fv-FQTLtOHGrOd4j-hujtJu112aidanXmbrKm-N_uvuSA6G9SPlZOIfZ70E0jEb1FJCq1bjvk3SCSIJI8PT1tjdW2UQdEkqLJO0QS1lRVWhcfe1FwRJKzm22pK4lIDK1qij7nHaSwT2XHoW06ocUjB8W7Xmp4KnkNeVO1qRL1Abqm4rAXknfwJHQJuuRVx-Uj77YA92WqQXSIMEABvsT8B_yBAgxNr9ted2CeccXrYdq6AP4s9Mld3hQc3C3CtwjfHP__G5TpI4cm67h65AXoUnQgasgaXcIjV51oanD9wZNLR0M_ccVBmHf7sxf5AyjequY0ZVq1kptIRZ3LvjDvVnCdCsmLs1dR75uRQxTg07-hqTLk41Y2j1wh7-b_iCS6ahHx4fzqjkvBcU7-joO-ZX2te_j8-V9fLuHTLd4Gx36Af7ZaVOI7LyDrhSy2L89v-T41lOhUHbhG3g08R8F_At9pc0eKun92DnX_Yvyp6TSwr9-M2ff6kSv3jZhzmdaH5XiH7tmA798O575UPC2gagoujaFZZM8neutOp1Ly4laYgACRpO8UIkkm6jci7uu04uCkR7PPZko42gHdmgidADsHXnMlckDECwLn9DJ3X75CogT8Pa2BYHB95N2QGHk3fgzf7hkQTLzT21z9-fiPb4gkw1w_jGfRV22V5qWo-XHMIk6Lzg5CQy6bmoPjFLzVJfJuXRhngIPQZZ9t86ZCJPk9feR1pprmAZGkarvtQei3Ai6gak3SMCJctU1e2Z2Ck80BHKepuRQmyBpOy831SRzHGSASHVS617wwmvv04eYWHOR9gCrtNFfmWaPEQdTG-fSRsTfZ6gtXB6PUTKV1XiKSGKIcTBw3GAbWfSqdZ8X3HewbBR-F_tRn0PZSguJ_9rzTZh24NAbkMQv0EEmME0QSl8bI-7C1gee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