[llvm-dev] Can GlobalAlias be null?

Nikita Popov via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 9 08:54:58 PST 2021


Hi,

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?

Regards,
Nikita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210309/0ebbf82b/attachment.html>


More information about the llvm-dev mailing list