[llvm] [llvm] Fix potential null dereference in IR/Verifier (PR #157458)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 11:21:40 PDT 2025


https://github.com/artagnon commented:

I don't think DISubprogram::getSubprogram can return null:

```cpp
DISubprogram *DILocalScope::getSubprogram() const {
  if (auto *Block = dyn_cast<DILexicalBlockBase>(this))
    return Block->getScope()->getSubprogram();
  return const_cast<DISubprogram *>(cast<DISubprogram>(this));
}
```

So, the check `SP &&` preceding your patch should probably be stripped, as it is dead?

https://github.com/llvm/llvm-project/pull/157458


More information about the llvm-commits mailing list