@@ -109,7 +109,7 @@ class TargetRewrite : public TargetRewriteBase<TargetRewrite> {
109
109
rewriteCallComplexResultType (A ty, B &newResTys, B &newInTys, C &newOpers) {
110
110
auto m = specifics->complexReturnType (ty.getElementType ());
111
111
// Currently targets mandate COMPLEX is a single aggregate or packed
112
- // scalar, included the sret case.
112
+ // scalar, including the sret case.
113
113
assert (m.size () == 1 && " target lowering of complex return not supported" );
114
114
auto resTy = std::get<mlir::Type>(m[0 ]);
115
115
auto attr = std::get<CodeGenSpecifics::Attributes>(m[0 ]);
@@ -299,6 +299,7 @@ class TargetRewrite : public TargetRewriteBase<TargetRewrite> {
299
299
300
300
// / Taking the address of a function. Modify the signature as needed.
301
301
void convertAddrOp (AddrOfOp addrOp) {
302
+ rewriter->setInsertionPoint (addrOp);
302
303
auto addrTy = addrOp.getType ().cast <mlir::FunctionType>();
303
304
llvm::SmallVector<mlir::Type, 8 > newResTys;
304
305
llvm::SmallVector<mlir::Type, 8 > newInTys;
@@ -341,7 +342,9 @@ class TargetRewrite : public TargetRewriteBase<TargetRewrite> {
341
342
auto newTy = rewriter->getFunctionType (newInTys, newResTys);
342
343
auto newOp =
343
344
rewriter->create <AddrOfOp>(addrOp.getLoc (), newTy, addrOp.symbol ());
344
- replaceOp (addrOp, newOp.getOperation ()->getResults ());
345
+ LLVM_DEBUG (llvm::dbgs ()
346
+ << " replacing " << addrOp << " with " << newOp << ' \n ' );
347
+ replaceOp (addrOp, newOp.getResult ());
345
348
}
346
349
347
350
// / Convert the type signatures on all the functions present in the module.
0 commit comments