Home | History | Annotate | Download | only in InstCombine
      1 ; Check that we fold the condition of branches of the
      2 ; form: br <condition> dest1, dest2, where dest1 == dest2.
      3 ; RUN: opt -instcombine -S < %s | FileCheck %s
      4 
      5 define i32 @test(i32 %x) {
      6 ; CHECK-LABEL: @test
      7 entry:
      8 ; CHECK-NOT: icmp
      9 ; CHECK: br i1 false
     10   %cmp = icmp ult i32 %x, 7
     11   br i1 %cmp, label %merge, label %merge
     12 merge:
     13 ; CHECK-LABEL: merge:
     14 ; CHECK: ret i32 %x
     15   ret i32 %x
     16 }
     17 
     18 @global = global i8 0
     19 
     20 define i32 @pat(i32 %x) {
     21 ; CHECK-NOT: icmp false
     22 ; CHECK: br i1 false
     23   %y = icmp eq i32 27, ptrtoint(i8* @global to i32)
     24   br i1 %y, label %patatino, label %patatino
     25 patatino:
     26   ret i32 %x
     27 }
     28