forked from OSchip/llvm-project
Re-add getSingleUndroppableUse API
The API was removed in 4ac4e52189
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.
This commit is contained in:
parent
7d437cf76e
commit
3273430406
|
@ -452,6 +452,13 @@ public:
|
|||
/// in the worst case, the whole use list of a value.
|
||||
bool hasOneUser() const;
|
||||
|
||||
/// Return true if there is exactly one use of this value that cannot be
|
||||
/// dropped.
|
||||
Use *getSingleUndroppableUse();
|
||||
const Use *getSingleUndroppableUse() const {
|
||||
return const_cast<Value *>(this)->getSingleUndroppableUse();
|
||||
}
|
||||
|
||||
/// Return true if there is exactly one unique user of this value that cannot be
|
||||
/// dropped (that user can have multiple uses of this value).
|
||||
User *getUniqueUndroppableUser();
|
||||
|
|
|
@ -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()) {
|
||||
|
|
Loading…
Reference in New Issue