This question is rooted in Branch Prediction Modelsbranch prediction models on CPUs. I'd recommend reading this paper:
Increasing the Instruction Fetch Rate via Multiple Branch Prediction and a Branch Address Cache
When you have sorted elements, IR couldthe IR can not be bothered to fetch all CPU instructions, again and again,. It fetches them from the cache.