This is an archive of the discontinued LLVM Phabricator instance.

[flang][openacc] Fix function name resolution in acc routine
ClosedPublic

Authored by clementval on Aug 25 2023, 10:56 AM.

Details

Summary

When acc routine is in a function, the first symbol resolved
was the function result and not the function name itself. It was
then failing the deferred attachment because the mangled name
had the entity attach to it. This patch fix the name resolution
for the function name in acc routine directive.

Diff Detail

Event Timeline

clementval created this revision.Aug 25 2023, 10:56 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
clementval requested review of this revision.Aug 25 2023, 10:56 AM

Remove comment

razvanlupusoru accepted this revision.Aug 25 2023, 1:00 PM

Looks good. The comment is simply about not checking for compiler generated symbol.

flang/test/Lower/OpenACC/acc-routine.f90
5

I wonder if we should relax this part which check's acc.routine's symbol name - this name is not something guaranteed since it is synthetic name from compiler.

This revision is now accepted and ready to land.Aug 25 2023, 1:00 PM
clementval added inline comments.Aug 25 2023, 1:18 PM
flang/test/Lower/OpenACC/acc-routine.f90
5

Do you mean the mangled name (_QPacc_routine10) or the acc.routine name _QPacc_routine10. The mangled name is guaranteed in flang and it's the only way to attach the acc.routine to the actual function. For the acc_routine_9 it is indeed also generated but since the attribute has it on the function I feel it is a nice check to have to make sure we attach the correct information to the correct routine.