forked from OSchip/llvm-project
![]() When a phi node references a variable defined in a basic block dominated by the the basic block containing the phi node, llvm-diff currently cannot determine whether the variable is equivalent, and thus treats the phi node as different and reports a difference. This leads to false positive differences as demonstrated by the loop.ll diff, for which llvm-diff reports a diff when comparing the file with itself. Fix that issue by adding the concept of *equivalence assumptions*. When encountering a pair of values which can neither be proven to be equivalent nor to be non-equivalent, instead optimistically assume equivalence, and store somewhere that the equivalence of the currently compared basic blocks depends on this assumption. Later, once all BBs have been processed, check all made assumptions and report blocks as different whose equivalence was depending on an incorrect assumption, or an assumption we could not prove to be correct. In order to preserve the original diff report order, also schedule diffs of blocks already known to be different using the same mechanism, so all block diffs are now generated at the very end of function diffing. In case an incorrect assumption was made, all further shown equivalences between old and new values implictly depend on the incorrect assumption. Some of these may in fact be not equivalent, but these are neither reverted nor reported, because they are considered indirect diffs caused by an earlier direct diff. See inline comments for an argument why we do not run into issues caused by circular proof dependencies. Differential Revision: https://reviews.llvm.org/D137318 |
||
---|---|---|
.. | ||
lib | ||
CMakeLists.txt | ||
llvm-diff.cpp |