I’m writing a loop pass that does dependency analysis and for a given load iterates over stores in the loop which may alias with the load. It then creates a Dependence object using the DependenceInfo class (DI) like so:
DI->depends(Store, Load, true)
I’ve noticed that if I pass a load and store to Dependence like this that have different types (for instance the store stores a pointer, but the load loads an i32), the resulting Dependence object is a null pointer. In some cases this doesn’t matter, as within defined behavior for C at least (which for now is all I’m concerned with), the example of storing a pointer and loading an i32 from the same address isn’t possible. However in some cases this is a concern, for instance storing to a struct field and then loading the entire struct. If I can’t create dependence objects out of such load/store pairs, how can I check for a possible ordered dependence between them?
I’ve also noticed the same behavior with vector types, even if they’re the same type - for instance load <2 x i32> and store <2 x i32>. Again, is this normal and can I get around it somehow?