[DialectConversion]standard dialect to llvm ir dialect

the source

func @test_index_cast_tensor(%arg0 : tensor<index>) -> tensor<i64> {
  %0 = index_cast %arg0 : tensor<index> to tensor<i64>
  return %0 : tensor<i64>
}

I try convert it to llvm ir dialect with
./mlir-opt --convert-std-to-llvm test.mlir

But the pass doesn’t seem to work about op index_cast and return.

module attributes {llvm.data_layout = ""}  {
  func @test_index_cast_tensor(%arg0: tensor<index>) -> tensor<i64> {
    %0 = index_cast %arg0 : tensor<index> to tensor<i64>
    return %0 : tensor<i64>
  }
}

The std-to-llvm conversion can’t convert from ops on tensor types to LLVM directly. Such input is too abstract for it. You’ll have to lower to memory/buffers (memrefs) before converting it to LLVM.

1 Like