On 4/30/20 9:17 AM, Jakub Jelinek wrote:
I'll try to do something about that early in stage1 and eventually backport, we need to follow OpenMP rules anyway and those require auto-discovery of referenced functions (if they are definitions rather than just declarations), and similarly in some cases for variables. And the same code then could, if something shouldn't be marked for offloading by the standard, complain loudly rather than leaving it up for later (lto1 of the offloading compiler).
Just as cross reference: * PR 94320 – is about automatically marking functions as offloading; that's mostly relevant for C++ templates where using std::vector<> for instance might require that operator[] is marked for offloading. * PR 94848 – is about the discussion in this thread, where a local static variable in a target function is partially optimized away. In principle, that could be solved by writing out the LTO stream consistently, i.e. either with the variable fully optimized away or being fully present (e.g. with "proper" function cloning). However, as done in other cases (see PR) – and alluded by Jakub above, is can also be solved by ensuring the variable is written out, i.e. by marking it for offloading. Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter