Order of sidhistory cleanup and re-ACL


I just want to know whether I should do re-ACL first on resources and then cleanup Sidhistory OR first I should cleanup of sidhistory and then re-ACL on resources? What is the correct order of these post migration tasks? Please explain what is the technical reason for the correct order?

Thanks in advance!