[all-commits] [llvm/llvm-project] 6aa9d9: [mlir][spirv] Add pattern matching for arith.index...

Ian Li via All-commits all-commits at lists.llvm.org
Wed Sep 3 11:04:57 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6aa9d928a86019ab8997fa9fb7c5533a67ed1a8d
      https://github.com/llvm/llvm-project/commit/6aa9d928a86019ab8997fa9fb7c5533a67ed1a8d
  Author: Ian Li <ian.li at intel.com>
  Date:   2025-09-03 (Wed, 03 Sep 2025)

  Changed paths:
    M mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
    M mlir/test/Conversion/ArithToSPIRV/arith-to-spirv.mlir

  Log Message:
  -----------
  [mlir][spirv] Add pattern matching for arith.index_cast i1 to index for ArithToSPIRV (#155729)

Currently, `arith.index_cast` gets converted to `OpSConvert`:
https://github.com/llvm/llvm-project/blob/9bf5bf3baf3c7aec82cdd235c6a2fd57b4dd55ab/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp#L1331
[OpSConvert requires its operands to be of integer
type](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpSConvert),
which poses an issue for `i1` since SPIRV distinguishes between booleans
and integers. As a result, the following example doesn't get converted,
leaving behind illegal ops:
```
%0 = arith.index_cast %arg0 : i1 to index
```
This PR adds additional logic to convert `arith.index_casts` to SPIRV
dialect when casting from `i1` to `index`. Converting `index_cast`s from
`index` to `i1` is a part of
https://github.com/llvm/llvm-project/pull/156031.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list