Has there been any change in the way the index type gets converted to i64 type? Should this now be explicitly performed by a cast operation?
Previously an FIR to LLVM conversion pattern worked. The constants 3
and 5
are of index type in the input FIR code. The conversion llvm.sub
operation in the pattern expects i64 type. The conversion produced LLVM dialect code like the following.
%2 = llvm.mlir.constant(3 : index) : i64
%4 = llvm.mlir.constant(5 : index) : i64
%57 = llvm.sub %4, %2 : i64
%58 = llvm.mul %57, %37 : i64
But now I get the following error.
error: ‘llvm.sub’ op requires the same type for all operands and results
note: see current operation: %63 = “llvm.sub”(%8, %4) : (index, index) → i64
%3 = "llvm.mlir.constant"() {value = 3 : index} : () -> i64
%4 = "builtin.unrealized_conversion_cast"(%3) : (i64) -> index
%7 = "llvm.mlir.constant"() {value = 5 : index} : () -> i64
%8 = "builtin.unrealized_conversion_cast"(%7) : (i64) -> index
...
%63 = "llvm.sub"(%8, %4) : (index, index) -> i64
%64 = "llvm.mul"(%63, %43) : (i64, i64) -> i64
Any suggestions? Should we use an index_cast or unrealized_conversion_cast explicitly for these kinds of conversions? Is there any utility function that does this?