aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2025-11-04 21:11:03 -0800
committerGitHub <noreply@github.com>2025-11-05 05:11:03 +0000
commit044e0f041d5c02ae3b4e44bab4647008ff497d9f (patch)
tree92d39475344de692583030cd0f4d4cb3203e0512 /llvm/lib
parent849038cad16f18d77b5cd277980c93e8efbf1bbc (diff)
downloadllvm-044e0f041d5c02ae3b4e44bab4647008ff497d9f.zip
llvm-044e0f041d5c02ae3b4e44bab4647008ff497d9f.tar.gz
llvm-044e0f041d5c02ae3b4e44bab4647008ff497d9f.tar.bz2
Revert "IR: Remove null UseList checks in hasNUses methods (#165929)" (#166500)
This reverts commit 93e860e694770f52a9eeecda88ba11173c291ef8. hasOneUse still has the null check, and it seems bad to be logically inconsistent across multiple of these predicate functions.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Value.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 95d61a9..b775cbb 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -148,10 +148,18 @@ void Value::destroyValueName() {
}
bool Value::hasNUses(unsigned N) const {
+ if (!UseList)
+ return N == 0;
+
+ // TODO: Disallow for ConstantData and remove !UseList check?
return hasNItems(use_begin(), use_end(), N);
}
bool Value::hasNUsesOrMore(unsigned N) const {
+ // TODO: Disallow for ConstantData and remove !UseList check?
+ if (!UseList)
+ return N == 0;
+
return hasNItemsOrMore(use_begin(), use_end(), N);
}