The issue is when restoring LR when there are no available low registers after popping the callee-saves and we try to find a temporary register before the pop. In the testcase, we are in front of a pop {r7}, however r7 is not in the pop-friendly set (since it's used as a frame pointer), whereas the code assumes that at least one register in the pop is in that set.
This patch allows r7 to be used, regardless of its use as a frame pointer, and also just falls back to using a high register if, for some reason,
we weren't able to find a suitable temporary reg among the popped ones.