Fix an infinite loop bug that Vladimir Prus identified.
[oota-llvm.git] / include / llvm / User.h
index b38c516d147811a7b37cdb955534a5d777d41af8..b0ecf75d8606aba93e69146cb3212cbd362a550b 100644 (file)
@@ -112,6 +112,13 @@ template<> struct simplify_type<User::const_op_iterator> {
 template<> struct simplify_type<const User::const_op_iterator>
   : public simplify_type<User::const_op_iterator> {};
 
+
+// value_use_iterator::getOperandNo - Requires the definition of the User class.
+template<typename UserTy>
+unsigned value_use_iterator<UserTy>::getOperandNo() const {
+  return U - U->getUser()->op_begin();
+}
+
 } // End llvm namespace
 
 #endif