Inserted a Value in a Transform-Pass, where to store it for later use?

I have a set of Analysis and Transform-passes. In one Function-Transform-pass I’m inserting instructions and a value (so a Value * value) based on some information in that function’s BB.

I’d like to use this value later on in other Transformation-passes working on the same BB (basically as an argument for newly inserted function calls?) How and where to store the value to easily retrieve it? Do I need to create another analysis pass, which finds the value and stores it in its result?

1 Like

If you can’t remember outside your passes, tie the instructions to a uninterpreted call to make it easy to find them.

BB:
  %newInst = ...
  %anchor = call void @__pseudo(<type> %newInst, <type> %newVal)

So to find them all, look for the users of @__pseudo.