[llvm] [IR][NVVM] Fixed null pointer deference in AsmWriter pretty printer (PR #207223)

Stefan Mada via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 10:57:09 PDT 2026


smada3 wrote:

> Q: why does an invalid intrinsic call return null for "Function *CalledFunc = CI->getCalledFunction();"?

This is because getCalledFunction checks for a matching function symbol AND a matching function type. If there is a valid intrinsic name with an invalid set of arguments, you will have CI be a valid pointer while CalledFunc returns nullptr due the mismatched arguments compared to the intrinsic definition. This will lead to a null dereference at `Intrinsic::ID IID = CalledFunc->getIntrinsicID();`

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


More information about the llvm-commits mailing list