omp_is_initial_device() is marked as a built-in function in the current
compiler, and user code guarded by this call may be optimized away,
resulting in undesired behavior in some cases. This patch provides a
possible fix for such cases by defining the routine as a variant
function. Full fix also requires removal of the routine from the
built-in function list in the compiler.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Cool, can we get rid of the clang builtin while we are at it?
| openmp/runtime/src/include/omp.h.var | ||
|---|---|---|
| 479 | Do we want them to be static? I would have expected odr linkage instead. | |
Removed omp_is_initial_device() from clang built-ins.
Added a new test under openmp/libomptarget.
| openmp/runtime/src/include/omp.h.var | ||
|---|---|---|
| 479 | Current clang fails to link two files that include omp.h, so I think we need static here. | |
LG, thanks
| openmp/runtime/src/include/omp.h.var | ||
|---|---|---|
| 479 | I would expect this to cause "unused function" warnings if you include omp.h. | |
Nice, thanks! I think the function in the devicertl is dead with this change, maybe remove that too?
| openmp/runtime/src/include/omp.h.var | ||
|---|---|---|
| 479 | 'inline' is right for c++. Inline plus instantiation in library code right for c. Can we hit linkonce_odr from a clang attribute? | |
Added inline after static to avoid unused function warning.
Added a RUN line to the test to catch unused function warning.
Do we want them to be static? I would have expected odr linkage instead.