[Mlir-commits] [mlir] [mlir][vector] Prevent folding non memref-type gather into maskedload (PR #135371)

Sagar Kulkarni llvmlistbot at llvm.org
Fri Apr 11 13:53:00 PDT 2025


================
@@ -3149,6 +3149,18 @@ func.func @contiguous_gather_step(%base: memref<?xf32>,
 
 // -----
 
+// CHECK-LABEL: @dont_fold_tensor_type_contiguous_gather
+func.func @dont_fold_tensor_type_contiguous_gather(%base: tensor<8xf32>, %mask: vector<4xi1>, %pass_thru: vector<4xf32>) -> vector<4xf32> {
+  %c0 = arith.constant 0 : index
+  %indices = arith.constant dense<[0, 1, 2, 3]> : vector<4xindex>
+  // CHECK: vector.gather
+  // CHECK-NOT: vector.maskedload
+  %0 = vector.gather %base[%c0][%indices], %mask, %pass_thru : tensor<8xf32>, vector<4xindex>, vector<4xi1>, vector<4xf32> into vector<4xf32>
----------------
sagarkulkarni19 wrote:

Done.

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


More information about the Mlir-commits mailing list