Currently there is no way to lazy-load an in-memory IR module without first writing it to disk. This patch just exposes the existing implementation of getLazyIRModule.
This is effectively a revert of rL212364; I don't have all of the context for the original change, but I don't see why this function can't be exposed now, especially with the stronger type signature it currently has.
Please add a comment that this takes ownership of the Buffer. That is one important change since the original modification that made this static.