Skip to content

Commit 3836559

Browse files
committed
[InstCombine] Test for regession with trunc in foldSelectICmpAnd
1 parent 92b0752 commit 3836559

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/test/Transforms/InstCombine/select-icmp-and.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,3 +900,15 @@ define i8 @neg_select_trunc_bittest_to_shl_extra_use(i8 %x) {
900900
%ret = select i1 %trunc, i8 4, i8 0
901901
ret i8 %ret
902902
}
903+
904+
define i16 @select_trunc_nuw_bittest_or(i8 %x) {
905+
; CHECK-LABEL: @select_trunc_nuw_bittest_or(
906+
; CHECK-NEXT: [[TMP1:%.*]] = trunc nuw i8 [[X:%.*]] to i1
907+
; CHECK-NEXT: [[RES:%.*]] = select i1 [[TMP1]], i16 20, i16 4
908+
; CHECK-NEXT: ret i16 [[RES]]
909+
;
910+
%trunc = trunc nuw i8 %x to i1
911+
%select = select i1 %trunc, i16 16, i16 0
912+
%res = or i16 4, %select
913+
ret i16 %res
914+
}

0 commit comments

Comments
 (0)