[Mlir-commits] [mlir] [MLIR][LLVMIR] Fix llvm.extractvalue folder (PR #201838)

Christian Ulmann llvmlistbot at llvm.org
Fri Jun 5 06:46:23 PDT 2026


================
@@ -185,6 +185,30 @@ llvm.func @fold_extract_sparse() -> f32 {
 
 // -----
 
+// CHECK-LABEL: no_fold_extract_splat_rank_mismatch
+llvm.func @no_fold_extract_splat_rank_mismatch() -> vector<2xi32> {
+  %0 = llvm.mlir.constant(dense<12> : vector<2xi32>) : vector<2xi32>
+  %1 = llvm.mlir.constant(dense<23> : vector<4x2xi32>) : !llvm.array<4 x vector<2xi32>>
+  // CHECK: extractvalue
+  %2 = llvm.extractvalue %1[0] : !llvm.array<4 x vector<2xi32>>
+  %3 = llvm.shl %0, %2 : vector<2xi32>
----------------
Dinistro wrote:

Nit: I'm not sure if we need the `llvm.shl` in the test. Can we not directly return the extracted value or does this struggle with materialization somehow?
I'm aware that the original issue showed up due to the shift, though. 

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


More information about the Mlir-commits mailing list