diff options
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r-- | llvm/lib/IR/Value.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index a13380b..0f11bf61 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -176,6 +176,18 @@ Use *Value::getSingleUndroppableUse() { return Result; } +User *Value::getUniqueUndroppableUser() { + User *Result = nullptr; + for (auto *U : users()) { + if (!U->isDroppable()) { + if (Result && Result != U) + return nullptr; + Result = U; + } + } + return Result; +} + bool Value::hasNUndroppableUses(unsigned int N) const { return hasNItems(user_begin(), user_end(), N, isUnDroppableUser); } |