[Util] Fix OptimizeIntArithmetic pattern failure condition (#19731)
The condition is wrong and leads to infinite loops if the input is i32
and output is index type.
diff --git a/compiler/src/iree/compiler/Dialect/Util/Transforms/OptimizeIntArithmetic.cpp b/compiler/src/iree/compiler/Dialect/Util/Transforms/OptimizeIntArithmetic.cpp
index fdee32e..9b17288 100644
--- a/compiler/src/iree/compiler/Dialect/Util/Transforms/OptimizeIntArithmetic.cpp
+++ b/compiler/src/iree/compiler/Dialect/Util/Transforms/OptimizeIntArithmetic.cpp
@@ -135,7 +135,7 @@
PatternRewriter &rewriter) const override {
Type inType = origIndexOp.getIn().getType();
Type outType = origIndexOp.getOut().getType();
- if (!inType.isSignlessInteger(64) && isa<IndexType>(outType))
+ if (!inType.isSignlessInteger(64) || !isa<IndexType>(outType))
return failure();
Operation *producer = origIndexOp.getIn().getDefiningOp();