[PATCH] D66595: [INSTRUCTIONS] Add support of const for getLoadStorePointerOperand() and getLoadStorePointerOperand().
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 30 09:40:30 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370486: [INSTRUCTIONS] Add support of const for getLoadStorePointerOperand() and (authored by whitneyt, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D66595?vs=216622&id=218119#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66595/new/
https://reviews.llvm.org/D66595
Files:
llvm/trunk/include/llvm/IR/Instructions.h
Index: llvm/trunk/include/llvm/IR/Instructions.h
===================================================================
--- llvm/trunk/include/llvm/IR/Instructions.h
+++ llvm/trunk/include/llvm/IR/Instructions.h
@@ -5255,23 +5255,30 @@
/// A helper function that returns the pointer operand of a load or store
/// instruction. Returns nullptr if not load or store.
-inline Value *getLoadStorePointerOperand(Value *V) {
+inline const Value *getLoadStorePointerOperand(const Value *V) {
if (auto *Load = dyn_cast<LoadInst>(V))
return Load->getPointerOperand();
if (auto *Store = dyn_cast<StoreInst>(V))
return Store->getPointerOperand();
return nullptr;
}
+inline Value *getLoadStorePointerOperand(Value *V) {
+ return const_cast<Value *>(
+ getLoadStorePointerOperand(static_cast<const Value *>(V)));
+}
/// A helper function that returns the pointer operand of a load, store
/// or GEP instruction. Returns nullptr if not load, store, or GEP.
-inline Value *getPointerOperand(Value *V) {
+inline const Value *getPointerOperand(const Value *V) {
if (auto *Ptr = getLoadStorePointerOperand(V))
return Ptr;
if (auto *Gep = dyn_cast<GetElementPtrInst>(V))
return Gep->getPointerOperand();
return nullptr;
}
+inline Value *getPointerOperand(Value *V) {
+ return const_cast<Value *>(getPointerOperand(static_cast<const Value *>(V)));
+}
/// A helper function that returns the alignment of load or store instruction.
inline unsigned getLoadStoreAlignment(Value *I) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66595.218119.patch
Type: text/x-patch
Size: 1516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190830/f2a9fd00/attachment.bin>
More information about the llvm-commits
mailing list