Home | History | Annotate | Download | only in JumpThreading
      1 ; RUN: opt -jump-threading -S < %s | FileCheck %s
      2 @global = external global i8*, align 8
      3 
      4 define i32 @foo(i32 %arg) {
      5 ; CHECK-LABEL: @foo
      6 ; CHECK-LABEL: bb:
      7 ; CHECK: icmp eq
      8 ; CHECK-NEXT: br i1 %tmp1, label %bb7, label %bb7
      9 bb:
     10   %tmp = load i8*, i8** @global, align 8
     11   %tmp1 = icmp eq i8* %tmp, null
     12   br i1 %tmp1, label %bb3, label %bb2
     13 
     14 ; CHECK-NOT: bb2:
     15 bb2:
     16   br label %bb3
     17 
     18 ; CHECK-NOT: bb3:
     19 bb3:
     20   %tmp4 = phi i8 [ 1, %bb2 ], [ 0, %bb ]
     21   %tmp5 = icmp eq i8 %tmp4, 0
     22   br i1 %tmp5, label %bb7, label %bb6
     23 
     24 ; CHECK-NOT: bb6:
     25 bb6:
     26   br label %bb7
     27 
     28 ; CHECK-LABEL: bb7:
     29 bb7:
     30   %tmp8 = icmp eq i32 %arg, -1
     31   br i1 %tmp8, label %bb9, label %bb10
     32 
     33 ; CHECK-LABEL: bb9:
     34 bb9:
     35   ret i32 0
     36 
     37 ; CHECK-LABEL: bb10:
     38 bb10:
     39   %tmp11 = icmp sgt i32 %arg, -1
     40   call void @llvm.assume(i1 %tmp11)
     41   ret i32 1
     42 }
     43 
     44 declare void @llvm.assume(i1)
     45