Looking through constant folding code, we currently have an assumption that GlobalAliases may be null: https://github.com/llvm/llvm-project/blob/df69c69427dea7f5b3b3a4d4564bc77b0926ec88/llvm/lib/IR/ConstantFold.cpp#L1764
However, it’s not really clear to me under which circumstances this can happen. LLVM only allows aliases to definitions, not declarations, so an alias to an extern_weak symbol is not possible. LLVM supports weak aliases, but as far as I understand, these also cannot be null (as at least the aliased symbol is definitely defined, and will be used if there is no definition of the alias itself).
Is this an outdated check, or am I missing something?