Closes #63174. Implements this transformation pattern, which is currently only applied to scalars, for vectors: ``` %1 = "spirv.UMod"(%0, %CONST_32) : (i32, i32) -> i32 %2 = "spirv.UMod"(%1, %CONST_4) : (i32, i32) -> i32 ``` to ``` %1 = "spirv.UMod"(%0, %CONST_32) : (i32, i32) -> i32 %2 = "spirv.UMod"(%0, %CONST_4) : (i32, i32) -> i32 ``` Additionally fixes and issue where patterns like this: ``` %1 = "spirv.UMod"(%0, %CONST_4) : (i32, i32) -> i32 %2 = "spirv.UMod"(%1, %CONST_32) : (i32, i32) -> i32 ``` were incorrectly canonicalized to: ``` %1 = "spirv.UMod"(%0, %CONST_4) : (i32, i32) -> i32 %2 = "spirv.UMod"(%0, %CONST_32) : (i32, i32) -> i32 ``` which is incorrect since `(X % A) % B` == `(X % B)` IFF A is a multiple of B, i.e., B divides A.
Multi-Level Intermediate Representation
See https://mlir.llvm.org/ for more information.