[polly] Skip instructions of different function in isHoistableLoad. (#118963)

After patch 5ce47a5, some assert crashes occur in Polly. This issue
arises because an instruction from one function queries the Dominator
Tree (DT) of another function. To fix this, the `isHoistableLoad`
function now skips instructions that belong to different function while
iterating.

GitOrigin-RevId: 2e3d3903e624edd5bb32cdd9a9654c907d4f1744
2 files changed