ret <2 x i8> %tr
}
+; FIXME: If the select is narrowed based on the target's datalayout, we allow more optimizations.
+
+define i16 @PR44545(i32 %t0, i32 %data) {
+; CHECK-LABEL: @PR44545(
+; CHECK-NEXT: [[T1:%.*]] = add nuw nsw i32 [[T0:%.*]], 1
+; CHECK-NEXT: [[ISZERO:%.*]] = icmp eq i32 [[DATA:%.*]], 0
+; CHECK-NEXT: [[FFS:%.*]] = select i1 [[ISZERO]], i32 0, i32 [[T1]]
+; CHECK-NEXT: [[CAST:%.*]] = trunc i32 [[FFS]] to i16
+; CHECK-NEXT: [[SUB:%.*]] = add nsw i16 [[CAST]], -1
+; CHECK-NEXT: ret i16 [[SUB]]
+;
+ %t1 = add nuw nsw i32 %t0, 1
+ %iszero = icmp eq i32 %data, 0
+ %ffs = select i1 %iszero, i32 0, i32 %t1
+ %cast = trunc i32 %ffs to i16
+ %sub = add nsw i16 %cast, -1
+ ret i16 %sub
+}