Skip to content

Commit 3273430

Browse files
committed
Re-add getSingleUndroppableUse API
The API was removed in 4ac4e52 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.
1 parent 7d437cf commit 3273430

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

llvm/include/llvm/IR/Value.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,13 @@ class Value {
452452
/// in the worst case, the whole use list of a value.
453453
bool hasOneUser() const;
454454

455+
/// Return true if there is exactly one use of this value that cannot be
456+
/// dropped.
457+
Use *getSingleUndroppableUse();
458+
const Use *getSingleUndroppableUse() const {
459+
return const_cast<Value *>(this)->getSingleUndroppableUse();
460+
}
461+
455462
/// Return true if there is exactly one unique user of this value that cannot be
456463
/// dropped (that user can have multiple uses of this value).
457464
User *getUniqueUndroppableUser();

llvm/lib/IR/Value.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ bool Value::hasOneUser() const {
164164

165165
static bool isUnDroppableUser(const User *U) { return !U->isDroppable(); }
166166

167+
Use *Value::getSingleUndroppableUse() {
168+
Use *Result = nullptr;
169+
for (Use &U : uses()) {
170+
if (!U.getUser()->isDroppable()) {
171+
if (Result)
172+
return nullptr;
173+
Result = &U;
174+
}
175+
}
176+
return Result;
177+
}
178+
167179
User *Value::getUniqueUndroppableUser() {
168180
User *Result = nullptr;
169181
for (auto *U : users()) {

0 commit comments

Comments
 (0)