================
@@ -781,9 +841,26 @@ class ScalarExprEmitter : public
StmtVisitor<ScalarExprEmitter, mlir::Value> {
return result;
}
+ mlir::Value foldUnaryOp(const UnaryOperator *e) {
+ Expr::EvalResult result;
+ if (!e->EvaluateAsRValue(result, cgf.getContext()))
----------------
andykaylor wrote:
Also, a question about your statement that doing it the way I currently am will
be slower.... The alternative is to visit the expression and emit the constant
(and possibly intermediate casts?) before we attempt to fold it, so that's
basically also walking the AST while also creating intermediate artifacts that
might be avoided by calling `EvaluateAsRValue`, right?
https://github.com/llvm/llvm-project/pull/174670
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits