Instrumenting IR being transformed for debugging


Is there a simple way to insert printf calls into the IR to print an LLVM Value at run time?

I am looking for something like TraceValues that has long been deprecated.

Such a utility would be useful when writing/debugging transformation passes. To see if a Value contains the value we expect it to at run time, we could add a call to printf, that prints the value.

Would writing such a utility be useful to the community?