aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Lower/ConvertProcedureDesignator.cpp
diff options
context:
space:
mode:
authorjeanPerier <jperier@nvidia.com>2023-10-09 09:29:16 +0200
committerGitHub <noreply@github.com>2023-10-09 09:29:16 +0200
commit886843170621d11a775aaa72b9c1ad94b076fa16 (patch)
tree0998a4e92c05186ee7deda314fcebaf96b7942e7 /flang/lib/Lower/ConvertProcedureDesignator.cpp
parent87b2682ad22bdaa2d8a95cb94a24603cf39a4c1f (diff)
downloadllvm-886843170621d11a775aaa72b9c1ad94b076fa16.zip
llvm-886843170621d11a775aaa72b9c1ad94b076fa16.tar.gz
llvm-886843170621d11a775aaa72b9c1ad94b076fa16.tar.bz2
[flang] Set func.func arg attributes for procedure designators (#68420)
Currently, if the first usage of a procedure not defined in the file was inside a procedure designator reference (not a call to it), the lowered func.func lacked the argument attributes if any. Fix this by using `CallInterface<T>::declare` too in SignatureBuilder to create a new func.func instead of using custom code. Note: this problem was made worse by the fact that module variables fir.global are currently lowered before the module procedures func.func are created. I will try to fix that in a later patch (the debug location may still be wrong in certain cases) because there is quite some test fallout when changing the order of globals/funcop in the output.
Diffstat (limited to 'flang/lib/Lower/ConvertProcedureDesignator.cpp')
-rw-r--r--flang/lib/Lower/ConvertProcedureDesignator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/flang/lib/Lower/ConvertProcedureDesignator.cpp b/flang/lib/Lower/ConvertProcedureDesignator.cpp
index aa5a7fe..20ade1a 100644
--- a/flang/lib/Lower/ConvertProcedureDesignator.cpp
+++ b/flang/lib/Lower/ConvertProcedureDesignator.cpp
@@ -62,11 +62,11 @@ fir::ExtendedValue Fortran::lower::convertProcedureDesignator(
std::tie(funcPtr, funcPtrResultLength) =
fir::factory::extractCharacterProcedureTuple(builder, loc, funcPtr);
} else {
- std::string name = converter.mangleName(*symbol);
mlir::func::FuncOp func =
- Fortran::lower::getOrDeclareFunction(name, proc, converter);
- funcPtr = builder.create<fir::AddrOfOp>(loc, func.getFunctionType(),
- builder.getSymbolRefAttr(name));
+ Fortran::lower::getOrDeclareFunction(proc, converter);
+ mlir::SymbolRefAttr nameAttr = builder.getSymbolRefAttr(func.getSymName());
+ funcPtr =
+ builder.create<fir::AddrOfOp>(loc, func.getFunctionType(), nameAttr);
}
if (Fortran::lower::mustPassLengthWithDummyProcedure(proc, converter)) {
// The result length, if available here, must be propagated along the