I was wondering whether it is possible to use the result of an LLVM IR pass in a MIR pass. The reason I’m doing this is because I need to compute some information in the IR that is only consumed later in the back end. Using metadata doesn’t work, since that isn’t carried forward. I’m now wondering whether it would be best to use intrinsics or whether it is somehow possible to use the IR pass in the MIR pass.
The only real example of this is AliasAnalysis, where the underlying value is tracked in the memory operands. A few other simple analyses are used during the initial lowering from IR, but not preserved. In summary there’s no general mechanism for doing this and it depends on what you’re trying to accomplish.