[Mlir-commits] [mlir] [mlir][arith] Support bitcast with index type (PR #121455)

Longsheng Mou llvmlistbot at llvm.org
Wed Jan 1 23:44:32 PST 2025


================
@@ -1723,7 +1723,18 @@ bool arith::BitcastOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
   if (!srcType || !dstType)
     return false;
 
-  return srcType.getIntOrFloatBitWidth() == dstType.getIntOrFloatBitWidth();
+  unsigned srcWidth, dstWidth;
+  if (auto indexTy = dyn_cast<IndexType>(srcType))
+    srcWidth = IndexType::kInternalStorageBitWidth;
----------------
CoTinker wrote:

I am not sure the width should be natural machine word of the target or the storage bitwidth.

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


More information about the Mlir-commits mailing list