Previously it was possible to create allocas/loads/stores in blocks
that had not previously been inserted in the function. A recent
change (https://reviews.llvm.org/D77984) uses getModule() on
the block to look up the DataLayout and automatically compute
an alignment in the cases where it isn't passed in. That results
in a crash in cases where the block hasn't already been inserted
into a function.
Instead, we'll now check that we successfully retrieved the
module before dereferencing it, and if we aren't able to retrieve
it we'll fall back on having no explicit alignment.
In one implementation of CreateAlloca we were also looking up
the default address space from the DataLayout. We don't have
have a way to avoid looking up the Module in order to get the
DataLayout, and don't have a way to otherwise default the address
space, so that implementation will still crash if called on
a block that hasn't yet been inserted into a function.