There are multiple places in the code where the type of memory being accessed from an instruction needs to be obtained, including an upcoming patch to improve GEP cost modeling. This deduplicates the logic between them. It's not strictly NFC as EarlyCSE/LoopStrengthReduce may catch more intrinsics now.
Hi there, didn't expect a review so quickly :) the child patch should be attached now.
The other places that I've seen use this are loopstrengthreduce and earlyCSE.
There's also the question as to whether or not this should subsume Type *getLoadStoreType(Value *I), also defined in Instructions.h.