[clang] [CIR] Upstream missing support for floating point unary operator (PR #193215)
Haocong Lu via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 27 23:33:32 PDT 2026
================
@@ -825,14 +818,23 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
return builder.createOrFold<cir::MinusOp>(loc, operand, nsw);
}
- mlir::Value emitIncOrDec(const UnaryOperator *e, mlir::Value input,
- bool nsw = false) {
+ mlir::Value emitIntIncOrDec(const UnaryOperator *e, mlir::Value input,
+ bool nsw = false) {
mlir::Location loc = cgf.getLoc(e->getSourceRange().getBegin());
return e->isIncrementOp()
? builder.createOrFold<cir::IncOp>(loc, input, nsw)
: builder.createOrFold<cir::DecOp>(loc, input, nsw);
}
+ mlir::Value emitFloatIncOrDec(const UnaryOperator *e, mlir::Value input) {
+ mlir::Location loc = cgf.getLoc(e->getSourceRange().getBegin());
+ auto fpType = mlir::cast<cir::FPTypeInterface>(input.getType());
----------------
Luhaocong wrote:
The third argument of `emitIncOrDec ` is `nsw`, which is only used for integer. I don't think this makes much sense for floating-point. Of course, it can also be merged into one.
https://github.com/llvm/llvm-project/pull/193215
More information about the cfe-commits
mailing list