summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-02-24 10:00:20 +0000
committerCameron Zwarich <zwarich@apple.com>2011-02-24 10:00:20 +0000
commit3cf92802148655027d277940eafb1f38d4d6b1fb (patch)
treea13a69800ee4f3ccaf75082c850ae5c86e238655 /llvm/lib/CodeGen/SelectionDAG
parent97eb52da7b25467014e1bb99a82a2fb515461b37 (diff)
downloadbcm5719-llvm-3cf92802148655027d277940eafb1f38d4d6b1fb.tar.gz
bcm5719-llvm-3cf92802148655027d277940eafb1f38d4d6b1fb.zip
Add a getNumSignBits() method to APInt.
llvm-svn: 126379
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 2fb2f2d8aa1..0b7cbcc47e1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2088,12 +2088,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, unsigned Depth) const{
case ISD::Constant: {
const APInt &Val = cast<ConstantSDNode>(Op)->getAPIntValue();
- // If negative, return # leading ones.
- if (Val.isNegative())
- return Val.countLeadingOnes();
-
- // Return # leading zeros.
- return Val.countLeadingZeros();
+ return Val.getNumSignBits();
}
case ISD::SIGN_EXTEND:
OpenPOWER on IntegriCloud