Is there some way to identify when or where an LLVM object was created which is still used after being deleted?

I’ve got this assertion firing by and then and I’m at loss how to identify where or when this object was created or who is still using it.
Usually in such cases I attach a unique & immutable ID to every object so that one can set a breakpoint at when it is being created.

Using a time-travelling debugger like rr (https://rr-project.org/) is probably the most general way to debug a use-after-free.

If it’s related to code you’ve written, I would hazard a guess that you did something like eraseFromParent without first doing a replaceAllUsesWith.