brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 5afcc8d Raw
48 lines · plain
1; Check that differences are reported in the BB processing order2; following the control flow, independent on whether the diff was depending3; on an assumption or not.4;5; Replace %newvar1 with %newvar2 in the phi node. This can only6; be detected to be different once BB2 has been processed, so leads to a assumption7; and is detected to diff later on.8; Also, replace the 1000 by 2000 in BB1, which is detected directly.9;10; RUN: rm -f %t.ll11; RUN: cat %s | sed -e 's/ %newvar1, %BB2 / %newvar2, %BB2 /' | sed -e 's/1000/2000/' > %t.ll12; RUN: not llvm-diff %s %t.ll 2>&1 | FileCheck %s13 14; CHECK:      in function func:15; CHECK-NEXT:   in block %BB0:16; CHECK-NEXT:     >   %var = phi i32 [ 0, %ENTRY ], [ %newvar2, %BB2 ]17; CHECK-NEXT:     <   %var = phi i32 [ 0, %ENTRY ], [ %newvar1, %BB2 ]18; CHECK-NEXT:   in block %BB1:19; CHECK-NEXT:     >   %diffvar = add i32 %var, 200020; CHECK-NEXT:     <   %diffvar = add i32 %var, 100021 22define i32 @func() {23ENTRY:24  br label %BB025 26BB0:27  ; When diffing this phi node, we need to detect whether28  ; %newvar1 is equivalent, which is not known until BB2 has been processed.29  %var = phi i32 [ 0, %ENTRY ], [ %newvar1, %BB2 ]30  %cnd = icmp eq i32 %var, 031  br i1 %cnd, label %BB1, label %END32 33BB1:34  %diffvar = add i32 %var, 100035  br label %BB136 37BB2:38  %newvar1 = add i32 %var, 139  %newvar2 = add i32 %var, 240  br label %BB041 42END:43  ; Equivalence of the ret depends on equivalence of %var.44  ; Even if %var differs, we do not report a diff here, because45  ; this is an indirect diff caused by another diff.46  ret i32 %var47}48