How to relate Instructions during vs. after runOnModule for AA?

Hi all,

I’m playing around with flow-sensitive AA, and it does a hefty amount of work in its runOnModule(…) method. So I need a reliable way of relating the Value parameters supplied to the alias-query methods, back to the corresponding objects (Instructions, etc.) available when the runOnModule(…) method ran. I really don’t want to redo the analysis for a given IR instruction if I don’t need to.

But I’m not finding much info as to whether or not I can count on my runOnModule(…) and my alias(…) methods being shown the same set of Instruction and Function objects as each other, in cases where the IR hasn’t been modified.

It seems like LLVM IR basic blocks and instructions are only meant to be identified in one way: by the memory address of whatever BasicBlock or Instruction object is currently models it. I.e., I haven’t come across any other canonical way people use to refer to a given BB or instruction in the IR, assuming the IR hasn’t been modified by any pass in the mean time.

The documentation for WeakVH sounds like it may be designed to force the kind of consistency I’m looking for, but I couldn’t quite be sure.

I imagine I could dream up a stable naming scheme for each BB and instruction in a given function. But if no one else has found a need to do that, it seems fishy that I would.

Thanks, Christian