[Mlir-commits] [mlir] [mlir][EmitC] Add an `emitc.conditional` operator (PR #84883)
Marius Brehler
llvmlistbot at llvm.org
Tue Mar 12 02:15:41 PDT 2024
================
@@ -54,6 +54,26 @@ class ArithOpConversion final : public OpConversionPattern<ArithOp> {
return success();
}
};
+
+class SelectOpConversion : public OpConversionPattern<arith::SelectOp> {
+public:
+ using OpConversionPattern<arith::SelectOp>::OpConversionPattern;
+
+ LogicalResult
+ matchAndRewrite(arith::SelectOp selectOp, OpAdaptor adaptor,
+ ConversionPatternRewriter &rewriter) const override {
+
+ if (!selectOp.getCondition().getType().isInteger())
+ return rewriter.notifyMatchFailure(
+ selectOp, "can only converted if condition is a scalar of type i1");
----------------
marbre wrote:
I assume such a change should not land as it breaks upstream's lit tests due to the illegal EmitC op. Anyway, this is a fair point and checking for `isInteger(1)` is what I had before. Will re-introduce that check, thanks.
https://github.com/llvm/llvm-project/pull/84883
More information about the Mlir-commits
mailing list