[Mlir-commits] [mlir] b90d496 - [mlir][SPIR-V] Fix swapped GL/CL SAbs ops in arith.remsi lowering (#202959)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 10 06:06:44 PDT 2026


Author: Arseniy Obolenskiy
Date: 2026-06-10T15:06:39+02:00
New Revision: b90d496353e34f82dfde430990246fa3c43aecd3

URL: https://github.com/llvm/llvm-project/commit/b90d496353e34f82dfde430990246fa3c43aecd3
DIFF: https://github.com/llvm/llvm-project/commit/b90d496353e34f82dfde430990246fa3c43aecd3.diff

LOG: [mlir][SPIR-V] Fix swapped GL/CL SAbs ops in arith.remsi lowering (#202959)

Could be treated as NFC:

The GL/CL template args were confused but in fact it did not affect the
actual result, so no test modification is required. The reason is that
driver legalizes ops by target env capabilities and rewriter that
created the unsupported variant of the op is dropped and another one is
picked

Added: 
    

Modified: 
    mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp b/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
index 63f84bc1ceb60..54e9176068b88 100644
--- a/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
+++ b/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
@@ -471,7 +471,7 @@ struct RemSIOpGLPattern final : public OpConversionPattern<arith::RemSIOp> {
   LogicalResult
   matchAndRewrite(arith::RemSIOp op, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
-    Value result = emulateSignedRemainder<spirv::CLSAbsOp>(
+    Value result = emulateSignedRemainder<spirv::GLSAbsOp>(
         op.getLoc(), adaptor.getOperands()[0], adaptor.getOperands()[1],
         adaptor.getOperands()[0], rewriter);
     rewriter.replaceOp(op, result);
@@ -487,7 +487,7 @@ struct RemSIOpCLPattern final : public OpConversionPattern<arith::RemSIOp> {
   LogicalResult
   matchAndRewrite(arith::RemSIOp op, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
-    Value result = emulateSignedRemainder<spirv::GLSAbsOp>(
+    Value result = emulateSignedRemainder<spirv::CLSAbsOp>(
         op.getLoc(), adaptor.getOperands()[0], adaptor.getOperands()[1],
         adaptor.getOperands()[0], rewriter);
     rewriter.replaceOp(op, result);


        


More information about the Mlir-commits mailing list