Thanks @ftynse for the reply.
While using mlir-opt to convert std to llvm, a type mismatch error was hit for basic block arguments. Error and mlir code given below. Also observed that when the basic blocks are without arguments the conversion happens fine. Looking through the code, it seems the basic block arguments are not being converted in the OpenMP parallel region. Also saw in the dialect conversion document that block arguments are special and a custom hook (convertRegionTypes) should be called for dialect conversion. Does that mean that we have to write a dialect conversion? Or can mlir-opt be invoked with some options to convert the basic block arguments in the OpenMP region.
(Note: we keep the OpenMP operations along with llvm dialect and translate them along with llvm dialect ops).
./bin/mlir-opt -convert-std-to-llvm t30.mlir
t30.mlir:11:7: error: type mismatch for bb argument #0 of successor #0
br ^bb1(%c1: index)
^
t30.mlir:11:7: note: see current operation: "llvm.br"(%19)[^bb1] : (!llvm.i64) -> ()
module {
func @main() {
%0 = alloc() : memref<100000xi32>
%c0 = constant 0 : index
%c100 = constant 100 : index
%c1 = constant 1 : index
%c2 = constant 2 : index
omp.parallel {
br ^bb1(%c1: index)
^bb1(%a: index) :
%1 = index_cast %a : index to i32
call @print_i32(%1) : (i32) -> ()
br ^bb3
^bb3:
omp.terminator
}
return
}
func @print_i32(i32)
}