Skip to content

Commit 0778b5d

Browse files
committed
[InstCombine] Add test for computeConstantRange() with non-splat poison (NFC)
1 parent 6461b92 commit 0778b5d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

llvm/test/Transforms/InstCombine/saturating-add-sub.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,17 @@ define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat1(<2 x i8> %a) {
10621062
ret <2 x i8> %r
10631063
}
10641064

1065+
define <3 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat1_poison(<3 x i8> %a) {
1066+
; CHECK-LABEL: @test_vector_usub_add_nuw_no_ov_nonsplat1_poison(
1067+
; CHECK-NEXT: [[B:%.*]] = add nuw <3 x i8> [[A:%.*]], <i8 10, i8 10, i8 10>
1068+
; CHECK-NEXT: [[R:%.*]] = call <3 x i8> @llvm.usub.sat.v3i8(<3 x i8> [[B]], <3 x i8> <i8 10, i8 9, i8 poison>)
1069+
; CHECK-NEXT: ret <3 x i8> [[R]]
1070+
;
1071+
%b = add nuw <3 x i8> %a, <i8 10, i8 10, i8 10>
1072+
%r = call <3 x i8> @llvm.usub.sat.v3i8(<3 x i8> %b, <3 x i8> <i8 10, i8 9, i8 poison>)
1073+
ret <3 x i8> %r
1074+
}
1075+
10651076
; Can be optimized if the add nuw RHS constant range handles non-splat vectors.
10661077
define <2 x i8> @test_vector_usub_add_nuw_no_ov_nonsplat2(<2 x i8> %a) {
10671078
; CHECK-LABEL: @test_vector_usub_add_nuw_no_ov_nonsplat2(

0 commit comments

Comments
 (0)