Skip to content

Conversation

@terapines-osc-cir
Copy link
Contributor

UnaryOpKind Inc, Dec, Plus and Minus can accept float operands, the lowering should also handle those situations.

Before this commit, the compiler crash when it met float operands.

UnaryOpKind Inc, Dec, Plus and Minus can accept float operands, the
lowering should also handle those situations.
auto One = mlir::arith::ConstantOp::create(
rewriter, op.getLoc(), mlir::IntegerAttr::get(type, 1));
rewriter.replaceOpWithNewOp<mlir::arith::SubIOp>(op, type, input, One);
addImmediate(op, type, input, -1, rewriter);
Copy link
Contributor

@bruteforceboy bruteforceboy Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while this is correct, should this emit mlir::arith::SubIOp/mlir::arith::SubFOp instead, since that was the case previously?

return rewriter.replaceOpWithNewOp<mlir::arith::AddFOp>(op, type, input,
imm);
}
auto imm = mlir::arith::ConstantOp::create(rewriter, op.getLoc(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add an assertion that checks if type is an IntegerType before this? not sure if it's a possible case though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants