If no alignment is specified we try to find the datalayout by using the insert position to get the module so we can get the datalayout. But if those are null, then we deference a null pointer.
This patch adds asserts to make the failure a little more obvious than just seg faulting.
Maybe also assert BB->getParent() is non-null? Someone mentioned an issue in some downstream code where the function was null.