1; Diff file with itself, assert no difference by return code 2; RUN: llvm-diff %s %s 3 4; Replace %newvar1 with %newvar2 in the phi node. This can only 5; be detected to be different once BB1 has been processed. 6; RUN: rm -f %t.ll 7; RUN: cat %s | sed -e 's/ %newvar1, %BB1 / %newvar2, %BB1 /' > %t.ll 8; RUN: not llvm-diff %s %t.ll 2>&1 | FileCheck --check-prefix DIFFERENT-VAR %s 9 10; DIFFERENT-VAR: in function func: 11; DIFFERENT-VAR-NEXT: in block %BB0: 12; DIFFERENT-VAR-NEXT: > %var = phi i32 [ 0, %ENTRY ], [ %newvar2, %BB1 ] 13; DIFFERENT-VAR-NEXT: < %var = phi i32 [ 0, %ENTRY ], [ %newvar1, %BB1 ] 14define i32 @func() { 15ENTRY: 16 br label %BB0 17 18BB0: 19 ; When diffing this phi node, we need to detect whether 20 ; %newvar1 is equivalent, which is not known until BB1 has been processed. 21 %var = phi i32 [ 0, %ENTRY ], [ %newvar1, %BB1 ] 22 %cnd = icmp eq i32 %var, 0 23 br i1 %cnd, label %BB1, label %END 24 25BB1: 26 %newvar1 = add i32 %var, 1 27 %newvar2 = add i32 %var, 2 28 br label %BB0 29 30END: 31 ; Equivalence of the ret depends on equivalence of %var. 32 ; Even if %var differs, we do not report a diff here, because 33 ; this is an indirect diff caused by another diff. 34 ret i32 %var 35} 36