================
@@ -44,6 +68,15 @@ void ComplexExprEmitter::emitStoreOfComplex(mlir::Location
loc, mlir::Value val,
builder.createStore(loc, val, destAddr);
}
+mlir::Value ComplexExprEmitter::VisitCallExpr(const CallExpr *e) {
+ if (e->getCallReturnType(cgf.getContext())->isReferenceType())
+ return emitLoadOfLValue(e);
+
+ mlir::Location loc = cgf.getLoc(e->getExprLoc());
+ auto complex = cgf.emitCallExpr(e).getComplexVal();
+ return builder.createComplexCreate(loc, complex.first, complex.second);
----------------
Lancern wrote:
Call to functions that returns a complex value should result in a single
`mlir::Value` that represents the complex value. #142779 modifies `RValue` and
uses two `mlir::Value`s to represent a complex rvalue, which could result in
unnecessary complex unpacking and packing operations.
I suggest we follow the incubator's approach and update the definition of
`RValue`. Instead of using two `mlir::Value`s to represent a complex rvalue,
use just one `mlir::Value` (just like how it represents a regular scalar value).
https://github.com/llvm/llvm-project/pull/144225
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits