diff options
author | Joseph Huber <jhuber6@vols.utk.edu> | 2023-06-20 12:03:48 -0500 |
---|---|---|
committer | Joseph Huber <jhuber6@vols.utk.edu> | 2023-06-27 09:15:03 -0500 |
commit | 1d699bf2664d2a9e64024fd9eb87451d6360ea8c (patch) | |
tree | 6d6753ced406bbfca01db6eb2e95bce338ba0ffb /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 3254623d73fb7252385817d8057640c9d5d5ffd1 (diff) | |
download | llvm-1d699bf2664d2a9e64024fd9eb87451d6360ea8c.zip llvm-1d699bf2664d2a9e64024fd9eb87451d6360ea8c.tar.gz llvm-1d699bf2664d2a9e64024fd9eb87451d6360ea8c.tar.bz2 |
[OpenMP] Always apply target declarations to canonical definitions
This patch changes the handling of OpenMP to add the device attributes
to the canonical definitions when we encounter a non-canonical
definition. Previously, the following code would not work because it
would find the non-canonical definition first which would then not be
used anywhere else.
```
int x;
extern int x;
```
This patch now adds the attribute to both of them. This allows us to
perform the following operation if, for example, there were an
implementation of `stderr` on the device.
```
#include <stdio.h>
// List of libc symbols supported on the device.
extern FILE *stderr;
```
Unfortunately I cannot think of an equivalent solution to HIP / CUDA
device declarations as those are done with simple attributes. Attributes
themselves cannot be used to affect a definition once its canonical
definition has already been seen. Some help on that front would be
appreciated.
Fixes https://github.com/llvm/llvm-project/issues/63355
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D153369
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions