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
Aside from the inline comment about functions that don't return, this looks good to me. Simple code, heavily tested. Thanks
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?
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.