Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt -instcombine -S < %s | FileCheck %s
      2 
      3 ; This used to crash opt
      4 
      5 @c = common global i32 0, align 4
      6 @b = common global i32 0, align 4
      7 @a = common global i16 0, align 2
      8 @d = common global i32 0, align 4
      9 
     10 define void @fn3() {
     11 ; CHECK: @fn3
     12 bb:
     13   %tmp = load i32, i32* @c, align 4
     14   %tmp1 = icmp eq i32 %tmp, 0
     15   br i1 %tmp1, label %bb2, label %bb6
     16 
     17 bb2:                                              ; preds = %bb
     18   %tmp3 = load i32, i32* @b, align 4
     19   %tmp.i = add nsw i32 255, %tmp3
     20   %tmp5 = icmp ugt i32 %tmp.i, 254
     21   br label %bb6
     22 
     23 bb6:                                              ; preds = %bb, %bb2
     24   %tmp7 = phi i1 [ true, %bb ], [ %tmp5, %bb2 ]
     25   %tmp8 = zext i1 %tmp7 to i32
     26   %tmp10 = icmp eq i32 %tmp8, 0
     27   %tmp12 = load i16, i16* @a, align 2
     28   %tmp14 = icmp ne i16 %tmp12, 0
     29   %tmp16 = select i1 %tmp10, i1 false, i1 %tmp14
     30   %tmp17 = zext i1 %tmp16 to i32
     31   store i32 %tmp17, i32* @d, align 4
     32   ret void
     33 }
     34