Skip to content

Commit d3cb3ee

Browse files
Ericschweitzpgi
authored andcommitted
Fix issue #510
1 parent ba6505a commit d3cb3ee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

flang/lib/Optimizer/CodeGen/TargetRewrite.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class TargetRewrite : public TargetRewriteBase<TargetRewrite> {
109109
rewriteCallComplexResultType(A ty, B &newResTys, B &newInTys, C &newOpers) {
110110
auto m = specifics->complexReturnType(ty.getElementType());
111111
// Currently targets mandate COMPLEX is a single aggregate or packed
112-
// scalar, included the sret case.
112+
// scalar, including the sret case.
113113
assert(m.size() == 1 && "target lowering of complex return not supported");
114114
auto resTy = std::get<mlir::Type>(m[0]);
115115
auto attr = std::get<CodeGenSpecifics::Attributes>(m[0]);
@@ -299,6 +299,7 @@ class TargetRewrite : public TargetRewriteBase<TargetRewrite> {
299299

300300
/// Taking the address of a function. Modify the signature as needed.
301301
void convertAddrOp(AddrOfOp addrOp) {
302+
rewriter->setInsertionPoint(addrOp);
302303
auto addrTy = addrOp.getType().cast<mlir::FunctionType>();
303304
llvm::SmallVector<mlir::Type, 8> newResTys;
304305
llvm::SmallVector<mlir::Type, 8> newInTys;
@@ -341,7 +342,9 @@ class TargetRewrite : public TargetRewriteBase<TargetRewrite> {
341342
auto newTy = rewriter->getFunctionType(newInTys, newResTys);
342343
auto newOp =
343344
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());
345348
}
346349

347350
/// Convert the type signatures on all the functions present in the module.

0 commit comments

Comments
 (0)