This is a minimal fix for issue #56403. We need to avoid creating a libcall to the libcall itself, or we get an infinite loop.
As noted in the bug report, this is not a complete solution. We should be guarding all intrinsic transforms like this with some kind of check to ensure we are not lowering to a libcall, but I don't think that query exists in IR.
I drafted an alternate patch that would move this transform to AggressiveInstCombine and check TTI.isTypeLegal(), but that might go beyond what we want (for example: don't do the transform for i8 types on AArch64?).
The comment here should more specifically call out the possibility of a recursive call. If we have a non-legal divide, we're probably generating a libcall anyway...