usx95 wrote: > but isn't the whole point of the first dyn_cast that it can return nullptr if it fails No. It should not fail. If it fails, it is a bug and `cast` would correctly assert fail in this case. https://github.com/llvm/llvm-project/pull/193520