Replace AMDGPUMachineModuleInfo to have per-module
information available before MF is created.
Details
Diff Detail
Unit Tests
Event Timeline
llvm/lib/Target/AMDGPU/AMDGPUModuleInfo.cpp | ||
---|---|---|
58 | Why does this need to store a module? The context may be used by multiple modules. It shouldn't matter since this just needs the context IDs |
llvm/lib/Target/AMDGPU/AMDGPUModuleInfo.cpp | ||
---|---|---|
58 | It could remember context, but since it is named ModuleInfo I am keeping track of a module. Probably it can be renamed as AMDGPUContextInfo and track the context. |
llvm/lib/Target/AMDGPU/AMDGPUModuleInfo.cpp | ||
---|---|---|
58 | It's not tracking anything about the module either. It's purely a context extension |
llvm/lib/Target/AMDGPU/AMDGPUModuleInfo.cpp | ||
---|---|---|
58 | At least not so far. I will rename it tomorrow and will track the context. It will have to stay a module pass though, but I guess it is cheap. I will just have to check context didn't change before I reset it. |
Ugh, that's the problem: I cannot tell if a context is the same as an old one. I can tell it for module as I can create a module pass. Every time module changes I can reset the context. I cannot create a context pass though.
Now I cannot compare context address as well since the same memory can be reused. This is exactly the same problem as with a module, its address can be the same, but the module different. I.e. there is no reliable way to identify a module, but there is a module pass, and there is no reliable way to identify a context, but there are no context passes.
Effectively even though this is a context extension I need to reset it for every new module. Well, unless you tell me there is a way to reliably identify a context.
Is there any guarantee that a pointer to LLVMContext remains valid through the whole TM life time?
clang-format: please reformat the code