The main use for this patch is LTO. It is not (yet?) possible to set the size level (-Os, -Oz) in the linker, which means loops are still rotated even if -Oz is specified on the command line. Therefore, look at the function attribute instead of at the size level to determine whether to rotate loops for a given function.
For related discussion, see D72404.
I think we we add minsize handling here we should also drop the EnableHeaderDuplication flag set when instantiating the pass. This is more in line with what most other passes do.