[Mlir-commits] [mlir] [mlir][Vector] Fold `vector.extract` from poison vector (PR #126122)

Jakub Kuderski llvmlistbot at llvm.org
Fri Feb 7 07:12:12 PST 2025


================
@@ -132,6 +132,28 @@ func.func @extract_from_create_mask_dynamic_position(%dim0: index, %index: index
 
 // -----
 
+// CHECK-LABEL: @extract_scalar_poison
+func.func @extract_scalar_poison() -> f32 {
+  // CHECK-NEXT: ub.poison : f32
+  //  CHECK-NOT: vector.extract
+  %0 = ub.poison : vector<4x8xf32>
+  %1 = vector.extract %0[2, 4] : f32 from vector<4x8xf32>
+  return %1 : f32
+}
+
+// -----
+
+// CHECK-LABEL: @extract_vector_poison
+func.func @extract_vector_poison() -> vector<8xf32> {
+  // CHECK-NEXT: ub.poison : vector<8xf32>
+  //  CHECK-NOT: vector.extract
----------------
kuhar wrote:

Also here

https://github.com/llvm/llvm-project/pull/126122


More information about the Mlir-commits mailing list