I’m writing a pass and I need to know if, given a load and store instruction of different pointer operands, if their base pointers have had a runtime check generated to see if they alias. My pass may be comparing a load from the true branch of such a check against a store of the false branch, and I want to use the API to figure out if I’m in such a situation or not.
The immediate approach would be to try and traverse the DT and compare conditional checks etc, but I’ve found the RuntimePointerChecker class (LLVM: llvm::RuntimePointerChecking Class Reference) which seems like it should have what I need, but I’m unsure how to use it.
You can retrieve the pointer checks for a given loop which gives you an array of pairs of RuntimeCheckingPtrGroup structs (LLVM: llvm::RuntimeCheckingPtrGroup Struct Reference). These structs don’t have a reference to the IR value of the pointers themselves, just SCEV expressions upper and lower bounds of the pointers in the group. I’m unsure what this means though - is anyone able to elaborate how I could use this information to do what I need?
My impression is that I may be able to compare these bounds against the SCEV expressions for the specific load/stores I’m checking, and if they fall within the bounds then I know I’m dealing with a pointer that has been checked. Is this correct? If so, how can I use the API to do this?
Thanks.