1; RUN: opt < %s -instcombine -S | FileCheck %s
2; rdar://11748024
3
4define i32 @a(i1 zeroext %x, i1 zeroext %y) {
5entry:
6; CHECK-LABEL: @a(
7; CHECK: [[TMP1:%.*]] = sext i1 %y to i32
8; CHECK: [[TMP2:%.*]] = select i1 %x, i32 2, i32 1
9; CHECK-NEXT: add nsw i32 [[TMP2]], [[TMP1]]
10  %conv = zext i1 %x to i32
11  %conv3 = zext i1 %y to i32
12  %conv3.neg = sub i32 0, %conv3
13  %sub = add i32 %conv, 1
14  %add = add i32 %sub, %conv3.neg
15  ret i32 %add
16}
17