This is another take on PR33900: the patch replaces the cut-off based
fix introduced in r308891 with Use::moveToFrontOfUseList() calls
that keep memory uses resulting in early exits from FindAllMemoryUses
in the beginning of the use list, reducing the overall number of iterations
over the users.
The performance impact is measured on the Function.cpp from
PR33900 compiled with -O3:
|Fix||# of iterations||CodeGenPrepare, s||Wall Time, s|
|No (r308891 reverted)||367,047,160||13.28||25.17|
|Before this patch||1,521,619||0.08||11.96|
|After this patch||76,733||0.05||11.71|
where number of iterations is the number of iterations over the
users in the FindAllMemoryUses function only.