1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 target datalayout = "e-m:e-i64:64-n8:16:32:64"
5 ; Although i1 is not in the datalayout, we should treat it
6 ; as a legal type because it is a fundamental type in IR.
7 ; This means we should shrink the phi (sink the zexts).
9 define i64 @sink_i1_casts(i1 %cond1, i1 %cond2) {
10 ; CHECK-LABEL: @sink_i1_casts(
12 ; CHECK-NEXT: br i1 %cond1, label %if, label %end
14 ; CHECK-NEXT: br label %end
16 ; CHECK-NEXT: [[PHI_IN:%.*]] = phi i1 [ %cond1, %entry ], [ %cond2, %if ]
17 ; CHECK-NEXT: [[PHI:%.*]] = zext i1 [[PHI_IN]] to i64
18 ; CHECK-NEXT: ret i64 [[PHI]]
21 %z1 = zext i1 %cond1 to i64
22 br i1 %cond1, label %if, label %end
25 %z2 = zext i1 %cond2 to i64
29 %phi = phi i64 [ %z1, %entry ], [ %z2, %if ]