[Mlir-commits] [mlir] [mlir][arith] Restrict mulsi_extended(x, 1) rewrite to integer types (PR #233234)
Prakhar Dixit
llvmlistbot at llvm.org
Mon Oct 19 12:50:55 PDT 2026
Prakhar-Dixit wrote:
> I think we should consider disabling extended ops with index types in the first place -- I can't imagine how this could be used correctly
That makes complete sense. Because the width of index is unknown until lowering, computing a high half or a carry/overflow bit at the IR level is inherently ambiguous.
This causes silent miscompiles today. The folder assumes a 64-bit index, so:
```
%c = arith.constant 65536 : index
%low, %high = arith.mului_extended %c, %c : index
```
folds to high = 0 with --canonicalize. But lowering the same IR to SPIR-V first, where index becomes i32 by default, gives high = 1 (--convert-arith-to-spirv --canonicalize).
Disallowing index here would also be consistent with #121455, which removed index support from arith.bitcast, another op that is only defined for a fixed bit width.
https://github.com/llvm/llvm-project/pull/233234
More information about the Mlir-commits
mailing list