projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4cea2ec
)
[APInt] Add a fastpath for the single word case of isOneValue to match isNullValue...
author
Craig Topper
<craig.topper@intel.com>
Fri, 7 Jul 2017 19:56:18 +0000
(19:56 +0000)
committer
Craig Topper
<craig.topper@intel.com>
Fri, 7 Jul 2017 19:56:18 +0000
(19:56 +0000)
llvm-svn: 307430
llvm/include/llvm/ADT/APInt.h
patch
|
blob
|
history
diff --git
a/llvm/include/llvm/ADT/APInt.h
b/llvm/include/llvm/ADT/APInt.h
index
e5f0c35
..
a1cce6e
100644
(file)
--- a/
llvm/include/llvm/ADT/APInt.h
+++ b/
llvm/include/llvm/ADT/APInt.h
@@
-401,7
+401,11
@@
public:
/// \brief Determine if this is a value of 1.
///
/// This checks to see if the value of this APInt is one.
- bool isOneValue() const { return getActiveBits() == 1; }
+ bool isOneValue() const {
+ if (isSingleWord())
+ return U.VAL == 1;
+ return countLeadingZerosSlowCase() == BitWidth - 1;
+ }
/// \brief Determine if this is the largest unsigned value.
///