Do not collect register usage information to be used by IPRA on functions that can be derefined.
If it is possible for a function to be replaced at link time with another version of the function, that has been optimized differently, we cannot assume the reg mask will be correct. For a more indepth explanation of de-refinement, see https://reviews.llvm.org/D18634.
This patch checks the isDefinitionExact method on the function to ensure the function cannot be redefined. If the definition is not exact, do not refine the register usage information during the collection phase of IPRA.
The isSafeForNoCSROpt method is also updated to ensure the function cannot be redefined. This is necessary because the isSafeForNoCSROpt relies on IPRA information, and if IPRA cannot be performed on a function, it consequently is not safe for NoCSROpt.
I believe this should rather be
F.hasAvailableExternallyLinkage() || F.isInterposable() || F.hasAddressTaken() || !F.hasFnAttribute(Attribute::NoRecurse).