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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Please can you add examples of its use (either in this patch or a follow child patch)?
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.
llvm/lib/IR/Instruction.cpp | ||
---|---|---|
753 | Thanks, good catch. I've plugged this into LoopStrengthReduce, which seems to have made the same mistake, so this patch is no longer NFC. |
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | ||
---|---|---|
920 | Is the drop of the MemTy assignment here intentional? |
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | ||
---|---|---|
920 | Doesn't look like it. I've removed the unnecessary diffs, sorry about that. |
getPointerOperand()