diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-09 20:22:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-09 20:22:18 +0000 |
commit | 12e5aa81e6d5fed4ec2a96f0fe69d42699139133 (patch) | |
tree | 32495159d8f885b56b421c48998c25689b913275 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 0f73fda8056d02aee9202d41875bbc6a5e14d38f (diff) | |
download | external_llvm-12e5aa81e6d5fed4ec2a96f0fe69d42699139133.zip external_llvm-12e5aa81e6d5fed4ec2a96f0fe69d42699139133.tar.gz external_llvm-12e5aa81e6d5fed4ec2a96f0fe69d42699139133.tar.bz2 |
Fix PR3763 by using proper APInt methods instead of uint64_t's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 407814c..b4e8592 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1311,14 +1311,15 @@ SDValue DAGCombiner::visitMUL(SDNode *N) { DAG.getConstant(N1C->getAPIntValue().logBase2(), getShiftAmountTy())); // fold (mul x, -(1 << c)) -> -(x << c) or (-x) << c - if (N1C && isPowerOf2_64(-N1C->getSExtValue())) + if (N1C && (-N1C->getAPIntValue()).isPowerOf2()) { + unsigned Log2Val = (-N1C->getAPIntValue()).logBase2(); // FIXME: If the input is something that is easily negated (e.g. a // single-use add), we should put the negate there. return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, DAG.getConstant(0, VT), DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0, - DAG.getConstant(Log2_64(-N1C->getSExtValue()), - getShiftAmountTy()))); + DAG.getConstant(Log2Val, getShiftAmountTy()))); + } // (mul (shl X, c1), c2) -> (mul X, c2 << c1) if (N1C && N0.getOpcode() == ISD::SHL && isa<ConstantSDNode>(N0.getOperand(1))) { |