The changes introduced in D97680 create a simpler interface to code that needs to be globalized. This interface is used to simplify the globalization calls in the middle end. We can check any globalization call that is only called by a single thread in the team and replace it with a static shared memory buffer.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
some initial comments.
llvm/lib/Transforms/IPO/OpenMPOpt.cpp | ||
---|---|---|
991 | ||
994 | No cast needed | |
999 | prefer early exit, if (!...) return false; | |
1002 | No need for it to be a constant | |
1006 | Don't assume an order. Check all users, one should be a free, others can be whatever. If you find bitcast users, remember the type, if they all agree, use that for the alloca. | |
1708 | no need to go over the free calls. they need to be users of the alloc and we remove them with the alloc. | |
1715 | No need, use *CI below. |
Changing this optimization to replace the globalization calls with shared memory. Removing them will be done by the attributor using HeapToStack once we add the allocation calls and improve the attributor.
llvm/lib/Transforms/IPO/OpenMPOpt.cpp | ||
---|---|---|
68 | I don't think we need this after all. | |
1010 | For now, check isKernel(F) and only do this for kernel functions. Later we can be more aggressive but for now that should limit it properly, also with regards to the lifetime of those allocations. | |
1068 | You cannot recollect while looping. | |
1072 | return true; |
Changing the test to simply check if we are in a non-SPMD kernel function. A more advanced approach can be used in the future.
LGTM, one nit.
llvm/lib/Transforms/IPO/OpenMPOpt.cpp | ||
---|---|---|
1031 | Can you use a enum here or variable instead of "3". |