brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 78b273b Raw
36 lines · plain
1; Diff file with itself, assert no difference by return code2; RUN: llvm-diff %s %s3 4; Replace %newvar1 with %newvar2 in the phi node. This can only5; be detected to be different once BB1 has been processed.6; RUN: rm -f %t.ll7; RUN: cat %s | sed -e 's/ %newvar1, %BB1 / %newvar2, %BB1 /' > %t.ll8; RUN: not llvm-diff %s %t.ll 2>&1 | FileCheck --check-prefix DIFFERENT-VAR %s9 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 %BB017 18BB0:19  ; When diffing this phi node, we need to detect whether20  ; %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, 023  br i1 %cnd, label %BB1, label %END24 25BB1:26  %newvar1 = add i32 %var, 127  %newvar2 = add i32 %var, 228  br label %BB029 30END:31  ; Equivalence of the ret depends on equivalence of %var.32  ; Even if %var differs, we do not report a diff here, because33  ; this is an indirect diff caused by another diff.34  ret i32 %var35}36