[Mlir-commits] [mlir] Unify handling of operations which are emitted in a deferred way (PR #97804)

Gil Rapaport llvmlistbot at llvm.org
Fri Jul 5 13:09:01 PDT 2024


================
@@ -1001,7 +993,8 @@ static LogicalResult printFunctionBody(CppEmitter &emitter,
       // trailing semicolon is handled within the printOperation function.
       bool trailingSemicolon =
           !isa<cf::CondBranchOp, emitc::DeclareFuncOp, emitc::ForOp,
-               emitc::IfOp, emitc::LiteralOp, emitc::VerbatimOp>(op);
+               emitc::IfOp, emitc::VerbatimOp>(op) ||
+          hasDeferredEmission(&op);
----------------
aniragil wrote:

- Shouldn't the call to `hasDeferredEmission` be negated here to preserve existing logic?
- `hasDeferredEmission` causes an early exit before `trailingSemicolon` is checked, isn't this check redundant? (checking `emitc::LiteralOp` seems to have been redundant before this change as well)

https://github.com/llvm/llvm-project/pull/97804


More information about the Mlir-commits mailing list