aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Value.cpp
diff options
context:
space:
mode:
authorAnna Thomas <anna@azul.com>2021-09-15 17:06:18 -0400
committerAnna Thomas <anna@azul.com>2021-09-15 17:06:20 -0400
commit3273430406c186f1f2af597adeedf21d4fa52b18 (patch)
treee8b3a815d2f509fa1d7e4f39dfe1ee766d39094e /llvm/lib/IR/Value.cpp
parent7d437cf76e3ac38d84b5d82e5412dd1b6746daa1 (diff)
downloadllvm-3273430406c186f1f2af597adeedf21d4fa52b18.zip
llvm-3273430406c186f1f2af597adeedf21d4fa52b18.tar.gz
llvm-3273430406c186f1f2af597adeedf21d4fa52b18.tar.bz2
Re-add getSingleUndroppableUse API
The API was removed in 4ac4e52189aa in favor of getUniqueUndroppableUser. However, this caused a buildbot failure in AbstractCallSiteTest.cpp, which uses the API and the AbstractCallSite class requires a "use" rather than a user. Retain the API so that the unittest compiles and passes.
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r--llvm/lib/IR/Value.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index a47ab68..7d2d73a 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -164,6 +164,18 @@ bool Value::hasOneUser() const {
static bool isUnDroppableUser(const User *U) { return !U->isDroppable(); }
+Use *Value::getSingleUndroppableUse() {
+ Use *Result = nullptr;
+ for (Use &U : uses()) {
+ if (!U.getUser()->isDroppable()) {
+ if (Result)
+ return nullptr;
+ Result = &U;
+ }
+ }
+ return Result;
+}
+
User *Value::getUniqueUndroppableUser() {
User *Result = nullptr;
for (auto *U : users()) {