[llvm] ccf1038 - [VectorCombine] Add tests where the index is guaranteed non-poison.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 3 08:42:46 PDT 2021
Author: Florian Hahn
Date: 2021-08-03T16:42:30+01:00
New Revision: ccf1038a92971d9f3faa9b7940430d3891bab2b8
URL: https://github.com/llvm/llvm-project/commit/ccf1038a92971d9f3faa9b7940430d3891bab2b8
DIFF: https://github.com/llvm/llvm-project/commit/ccf1038a92971d9f3faa9b7940430d3891bab2b8.diff
LOG: [VectorCombine] Add tests where the index is guaranteed non-poison.
Tests for PR50949.
Added:
Modified:
llvm/test/Transforms/VectorCombine/load-insert-store.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/VectorCombine/load-insert-store.ll b/llvm/test/Transforms/VectorCombine/load-insert-store.ll
index 39893b4298bd..d8fb7e77e2b5 100644
--- a/llvm/test/Transforms/VectorCombine/load-insert-store.ll
+++ b/llvm/test/Transforms/VectorCombine/load-insert-store.ll
@@ -254,8 +254,24 @@ entry:
declare void @llvm.assume(i1)
-define void @insert_store_nonconst_index_known_valid_by_and(<16 x i8>* %q, i8 zeroext %s, i32 %idx) {
-; CHECK-LABEL: @insert_store_nonconst_index_known_valid_by_and(
+define void @insert_store_nonconst_index_known_noundef_and_valid_by_and(<16 x i8>* %q, i8 zeroext %s, i32 noundef %idx) {
+; CHECK-LABEL: @insert_store_nonconst_index_known_noundef_and_valid_by_and(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[IDX_CLAMPED:%.*]] = and i32 [[IDX:%.*]], 7
+; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds <16 x i8>, <16 x i8>* [[Q:%.*]], i32 0, i32 [[IDX_CLAMPED]]
+; CHECK-NEXT: store i8 [[S:%.*]], i8* [[TMP0]], align 1
+; CHECK-NEXT: ret void
+;
+entry:
+ %0 = load <16 x i8>, <16 x i8>* %q
+ %idx.clamped = and i32 %idx, 7
+ %vecins = insertelement <16 x i8> %0, i8 %s, i32 %idx.clamped
+ store <16 x i8> %vecins, <16 x i8>* %q
+ ret void
+}
+
+define void @insert_store_nonconst_index_known_valid_by_and_but_may_be_poison(<16 x i8>* %q, i8 zeroext %s, i32 %idx) {
+; CHECK-LABEL: @insert_store_nonconst_index_known_valid_by_and_but_may_be_poison(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[IDX_CLAMPED:%.*]] = and i32 [[IDX:%.*]], 7
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds <16 x i8>, <16 x i8>* [[Q:%.*]], i32 0, i32 [[IDX_CLAMPED]]
@@ -287,8 +303,24 @@ entry:
ret void
}
-define void @insert_store_nonconst_index_known_valid_by_urem(<16 x i8>* %q, i8 zeroext %s, i32 %idx) {
-; CHECK-LABEL: @insert_store_nonconst_index_known_valid_by_urem(
+define void @insert_store_nonconst_index_known_noundef_and_valid_by_urem(<16 x i8>* %q, i8 zeroext %s, i32 noundef %idx) {
+; CHECK-LABEL: @insert_store_nonconst_index_known_noundef_and_valid_by_urem(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[IDX_CLAMPED:%.*]] = urem i32 [[IDX:%.*]], 16
+; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds <16 x i8>, <16 x i8>* [[Q:%.*]], i32 0, i32 [[IDX_CLAMPED]]
+; CHECK-NEXT: store i8 [[S:%.*]], i8* [[TMP0]], align 1
+; CHECK-NEXT: ret void
+;
+entry:
+ %0 = load <16 x i8>, <16 x i8>* %q
+ %idx.clamped = urem i32 %idx, 16
+ %vecins = insertelement <16 x i8> %0, i8 %s, i32 %idx.clamped
+ store <16 x i8> %vecins, <16 x i8>* %q
+ ret void
+}
+
+define void @insert_store_nonconst_index_known_valid_by_urem_but_may_be_poison(<16 x i8>* %q, i8 zeroext %s, i32 %idx) {
+; CHECK-LABEL: @insert_store_nonconst_index_known_valid_by_urem_but_may_be_poison(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[IDX_CLAMPED:%.*]] = urem i32 [[IDX:%.*]], 16
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds <16 x i8>, <16 x i8>* [[Q:%.*]], i32 0, i32 [[IDX_CLAMPED]]
More information about the llvm-commits
mailing list