[ThinLTO] Refactor function body scan during importing into helper (NFC)