This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Delay more diagnostics of potentially non-emitted code
ClosedPublic

Authored by jdoerfert on Feb 2 2021, 10:57 PM.

Details

Summary

Even code in target and declare target regions might not be emitted.
With this patch we delay more diagnostics and use laziness and linkage
to determine if a function is emitted (for the device). Note that we
still eagerly emit diagnostics for target regions, unfortunately, see
the TODO for the reason.

This hopefully fixes PR48933.

Diff Detail

Event Timeline

jdoerfert created this revision.Feb 2 2021, 10:57 PM
jdoerfert requested review of this revision.Feb 2 2021, 10:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2021, 10:57 PM
Herald added a subscriber: sstefan1. · View Herald Transcript
clang/lib/Sema/SemaDecl.cpp
18348

What catches a static function whose address is taken?

18379

Does LangOpts.HIP imply LandOpts.CUDA? I think it is intended to. I think I've seen this pattern (is openmp and is not cuda) elsewhere, perhaps we're missing a predicate.

jdoerfert marked 2 inline comments as done.Feb 15 2021, 11:03 AM
jdoerfert added inline comments.
clang/lib/Sema/SemaDecl.cpp
18348

I don't know where but the existing logic in GetGVALinkageForFunction seems to handle this just fine. I marked the tests I introduced for such cases below.

18379

I don't know. This is a reinterpretation of the conditional we had, which checked this in a different way but the intention is the same. There we also never looked for HIP, IIRC.

clang/test/OpenMP/nvptx_unsupported_type_messages.cpp
164

Here we test static/inline function with taken address.

This revision is now accepted and ready to land.Feb 15 2021, 11:08 AM
This revision was landed with ongoing or failed builds.Feb 15 2021, 11:17 AM
This revision was automatically updated to reflect the committed changes.
jdoerfert marked 2 inline comments as done.