At the moment, Clang doesn’t verify LLVM IR modules, which can cause crashes in optimization passes due to the input module being invalid.
AFAIK Clang accepting LLVM IR files is mostly a convenience feature for LLVM developers, but recently we had a few of bug reports of crashes that were down to invalid modules.
- Crash in `llvm::RuntimePointerChecking::insert` · Issue #55828 · llvm/llvm-project · GitHub
- Clang crashes on a invalid Phi Instruction · Issue #55763 · llvm/llvm-project · GitHub
Those could be avoided if
clang would just run the IR verifier first, like
llc do. Should we just do that in
clang as well?