File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
lib/Dialect/Arith/Transforms Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -748,6 +748,12 @@ struct ArithIntNarrowingPass final
748
748
using ArithIntNarrowingBase::ArithIntNarrowingBase;
749
749
750
750
void runOnOperation () override {
751
+ if (bitwidthsSupported.empty () ||
752
+ llvm::is_contained (bitwidthsSupported, 0 )) {
753
+ // Invalid pass options.
754
+ return signalPassFailure ();
755
+ }
756
+
751
757
Operation *op = getOperation ();
752
758
MLIRContext *ctx = op->getContext ();
753
759
RewritePatternSet patterns (ctx);
Original file line number Diff line number Diff line change
1
+ // RUN: not mlir-opt %s --arith-int-narrowing --mlir-print-ir-after-failure 2>&1 \
2
+ // RUN: | FileCheck %s
3
+
4
+ // RUN: not mlir-opt %s --arith-int-narrowing="int-bitwidths-supported=0" \
5
+ // RUN: --mlir-print-ir-after-failure 2>&1 | FileCheck %s
6
+
7
+ // Make sure we do not crash on invalid pass options.
8
+
9
+ // CHECK: IR Dump After ArithIntNarrowing Failed (arith-int-narrowing)
10
+ // CHECK-LABEL: func.func @addi_extsi_i8
11
+ func.func @addi_extsi_i8 (%lhs: i8 , %rhs: i8 ) -> i32 {
12
+ %a = arith.extsi %lhs : i8 to i32
13
+ %b = arith.extsi %rhs : i8 to i32
14
+ %r = arith.addi %a , %b : i32
15
+ return %r : i32
16
+ }
You can’t perform that action at this time.
0 commit comments