If a parallel region is known to be read-only, e.g., after we removed
all dead write accesses in their, we can remove the parallel region as
well.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Aside from the inline comment about functions that don't return, this looks good to me. Simple code, heavily tested. Thanks
llvm/lib/Transforms/IPO/OpenMPOpt.cpp | ||
---|---|---|
139 | I'm not totally confident that onlyReadsMemory is sufficient here (concerned about I/O, functions that do not return). LICM hoists based on this so it's safe for I/O. Likewise malloc/free are fine. Please could you point me to the reason this is safe for functions that don't return? |
llvm/lib/Transforms/IPO/OpenMPOpt.cpp | ||
---|---|---|
139 |
It is not. I'll add the proper checks, we have the attribute (willreturn) so it is not a problem to look for it. I/O is not read only. Malloc/free are neither. |
It seems to be an openmp restriction that parallel regions can't exit/abort/return etc, so the current path looks fine. Perhaps an assertion on the attribute?
I'm not totally confident that onlyReadsMemory is sufficient here (concerned about I/O, functions that do not return).
LICM hoists based on this so it's safe for I/O. Likewise malloc/free are fine.
Please could you point me to the reason this is safe for functions that don't return?