This addresses https://github.com/llvm/llvm-project/issues/56076
llvm-diff was reporting a false alarm on the %res PHI node of the following module, comparing with itself by running llvm-diff a.ll a.ll:
define double @foo() { entry: br i1 true, label %else, label %exit else: %0 = extractelement <2 x double> zeroinitializer, i64 0 br label %exit exit: %res = phi double [ 0.000000e+00, %entry ], [ %0, %else ] ret double 0.000000e+00 }
The reason was that:
- The exit block is processed before the else block.
- When comparing against the PHI node, its operand %0 is not visited yet. So the fake difference is reported because %0 is neither mapped nor tentative.
Fixed by calling diff() on instructions when checking the operand equivalence.
Signed-off-by: Yilong Guo <yilong.guo@intel.com>
I think this also needs a FileCheck call to check that llvm-diff handles the case as expected? Please see other tests like llvm/test/tools/llvm-diff/anon-func.ll for example.