<div dir="ltr">Value::dump() just calls Value::print(raw_ostream &OS), which you can call with a raw_string_ostream or raw_svector_ostream, but it's a pretty expensive operation (O(instructions + BB's)) meant for debugging. Printing a single instruction like that essentially requires a linear scan of the entire function to calculate the numbers. The AsmWriter doesn't use Value::print to generate the names (it's actually the other way around: Value::print essentially instantiates a complete AsmWriter just to get the name of a single Value).<div>
<br></div><div>Like it says at that FAQ, the numbers are not stored explicitly in the in-memory IR. Look in lib/IR/AsmWriter.cpp. especially Value::print() and the SlotTracker class (which is what actually calculates the numbers).</div>
<div><br></div><div style>Also, be aware that the numbers can change if you insert instructions/BB's into the function.</div><div><br></div><div style>-- Sean Silva </div></div>