add GetElementPtrInst::hasAllZeroIndices, a long-overdue helper method.
Writing it twice in the same day was too much for me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35978 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 8f3b24a..2387739 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -408,6 +408,11 @@
inline bool hasIndices() const {
return getNumOperands() > 1;
}
+
+ /// hasAllZeroIndices - Return true if all of the indices of this GEP are
+ /// zeros. If so, the result pointer and the first operand have the same
+ /// value, just potentially different types.
+ bool hasAllZeroIndices() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const GetElementPtrInst *) { return true; }