[PATCH] D131251: [EarlyCSE][OpaquePointers]Replace assert with return for mask type check.
Denis Antrushin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 06:15:16 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG36cc533471cb: [EarlyCSE][OpaquePointers]Replace assert with return for mask type check. (authored by dantrushin).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131251/new/
https://reviews.llvm.org/D131251
Files:
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/test/Transforms/EarlyCSE/opaque-ptr.ll
Index: llvm/test/Transforms/EarlyCSE/opaque-ptr.ll
===================================================================
--- llvm/test/Transforms/EarlyCSE/opaque-ptr.ll
+++ llvm/test/Transforms/EarlyCSE/opaque-ptr.ll
@@ -16,6 +16,23 @@
ret i32 %sub
}
+define i32 @different_types_vector_load(ptr %p) {
+; CHECK-LABEL: @different_types_vector_load(
+; CHECK-NEXT: [[V1:%.*]] = call <4 x i32> @llvm.masked.load.v4i32.p0(ptr [[P:%.*]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 false>, <4 x i32> poison)
+; CHECK-NEXT: [[V2:%.*]] = call <8 x i32> @llvm.masked.load.v8i32.p0(ptr [[P]], i32 4, <8 x i1> <i1 true, i1 true, i1 true, i1 true, i1 false, i1 false, i1 false, i1 false>, <8 x i32> poison)
+; CHECK-NEXT: [[E1:%.*]] = extractelement <4 x i32> [[V1]], i32 0
+; CHECK-NEXT: [[E2:%.*]] = extractelement <8 x i32> [[V2]], i32 6
+; CHECK-NEXT: [[SUM:%.*]] = add i32 [[E1]], [[E2]]
+; CHECK-NEXT: ret i32 [[SUM]]
+;
+ %v1 = call <4 x i32> @llvm.masked.load.v4i32.p(ptr %p, i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 false>, <4 x i32> poison)
+ %v2 = call <8 x i32> @llvm.masked.load.v8i32.p(ptr %p, i32 4, <8 x i1> <i1 true, i1 true, i1 true, i1 true, i1 false, i1 false, i1 false, i1 false>, <8 x i32> poison)
+ %e1 = extractelement <4 x i32> %v1, i32 0
+ %e2 = extractelement <8 x i32> %v2, i32 6
+ %sum = add i32 %e1, %e2
+ ret i32 %sum
+}
+
define i32 @different_types_store(ptr %p, i32 %a) {
; CHECK-LABEL: @different_types_store(
; CHECK-NEXT: store i32 [[A:%.*]], ptr [[P:%.*]], align 4
@@ -41,3 +58,6 @@
store i8 %i2, ptr %p
ret void
}
+
+declare <4 x i32> @llvm.masked.load.v4i32.p(ptr, i32 immarg, <4 x i1>, <4 x i32>)
+declare <8 x i32> @llvm.masked.load.v8i32.p(ptr, i32 immarg, <8 x i1>, <8 x i32>)
Index: llvm/lib/Transforms/Scalar/EarlyCSE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+++ llvm/lib/Transforms/Scalar/EarlyCSE.cpp
@@ -881,8 +881,8 @@
auto *Vec1 = dyn_cast<ConstantVector>(Mask1);
if (!Vec0 || !Vec1)
return false;
- assert(Vec0->getType() == Vec1->getType() &&
- "Masks should have the same type");
+ if (Vec0->getType() != Vec1->getType())
+ return false;
for (int i = 0, e = Vec0->getNumOperands(); i != e; ++i) {
Constant *Elem0 = Vec0->getOperand(i);
Constant *Elem1 = Vec1->getOperand(i);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131251.450780.patch
Type: text/x-patch
Size: 2420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220808/27377be0/attachment.bin>
More information about the llvm-commits
mailing list