Firstly, each offloading entry must have a unique name or the
linker will complain if there are multiple files with target
regions. Secondly, the compiler must not introduce padding so
mark the struct with a PackedAttr.
Details
Diff Detail
Event Timeline
After some investigation, I think this whole code is incorrect. We should not rely on the fact that there is no padding on some architectures and should mix the type generated by the Clang and initial value, generated by LLVM.
I'm not sure I understand what you mean. Do you refer to auto Align = CharUnits::fromQuantity(1)?
Yes, this one too. But the main problem here is that we expect some layout of structure, though it may be different.
- Please, mark the record as packed.
- Tests
lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
3576–3579 | Use llvm::Twine here instead. |
Where and how do I need to do this? I found that PackedAttr is checked on FieldDecls but I'm not sure if we go through that code path and how I could add it...
I think it is applied to structure. You can do it in CGOpenMPRuntime::getTgtOffloadEntryQTy, after the RD->completeDefinition(); statement. Use RD->addAttr(PackedAttr::CreateImplicit(C));
Use llvm::Twine, add PackedAttr, and adjust regression tests to check the name of the generated constants.
Use llvm::Twine here instead.