Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt -S -instcombine < %s | FileCheck %s
      2 
      3 @c = common global i8 0, align 1
      4 @a = common global i8 0, align 1
      5 @b = common global i8 0, align 1
      6 
      7 define void @func() nounwind uwtable ssp {
      8 entry:
      9   %0 = load i8, i8* @c, align 1
     10   %conv = zext i8 %0 to i32
     11   %or = or i32 %conv, 1
     12   %conv1 = trunc i32 %or to i8
     13   store i8 %conv1, i8* @a, align 1
     14   %conv2 = zext i8 %conv1 to i32
     15   %neg = xor i32 %conv2, -1
     16   %and = and i32 1, %neg
     17   %conv3 = trunc i32 %and to i8
     18   store i8 %conv3, i8* @b, align 1
     19   %1 = load i8, i8* @a, align 1
     20   %conv4 = zext i8 %1 to i32
     21   %conv5 = zext i8 %conv3 to i32
     22   %tobool = icmp ne i32 %conv4, 0
     23   br i1 %tobool, label %land.rhs, label %land.end
     24 
     25 land.rhs:                                         ; preds = %entry
     26   %tobool8 = icmp ne i32 %conv5, 0
     27   br label %land.end
     28 
     29 land.end:                                         ; preds = %land.rhs, %entry
     30   %2 = phi i1 [ false, %entry ], [ %tobool8, %land.rhs ]
     31   %land.ext = zext i1 %2 to i32
     32   %mul = mul nsw i32 3, %land.ext
     33   %conv9 = trunc i32 %mul to i8
     34   store i8 %conv9, i8* @a, align 1
     35   ret void
     36 
     37 ; CHECK-LABEL: @func(
     38 ; CHECK-NOT: select
     39 }
     40