diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-08-23 19:01:24 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-08-23 19:01:24 +0000 |
commit | 726ebd6ff3178499e8455ce8433a4310badefe26 (patch) | |
tree | 755b3a74a0992a55eac0621eb38f7dd694239c73 /lib/Target/X86/X86ISelLowering.cpp | |
parent | 743c0fa7791c1451016a469bb0a5f57d56cd986a (diff) |
PerformSubCombine to work on integers larger than i128. Fixes a crasher.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index dd78aa943f..d2b7690489 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -13293,20 +13293,18 @@ static SDValue PerformSubCombine(SDNode *N, SelectionDAG &DAG) { // X86 can't encode an immediate LHS of a sub. See if we can push the // negation into a preceding instruction. if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op0)) { - uint64_t Op0C = C->getSExtValue(); - // If the RHS of the sub is a XOR with one use and a constant, invert the // immediate. Then add one to the LHS of the sub so we can turn // X-Y -> X+~Y+1, saving one register. if (Op1->hasOneUse() && Op1.getOpcode() == ISD::XOR && isa<ConstantSDNode>(Op1.getOperand(1))) { - uint64_t XorC = cast<ConstantSDNode>(Op1.getOperand(1))->getSExtValue(); + APInt XorC = cast<ConstantSDNode>(Op1.getOperand(1))->getAPIntValue(); EVT VT = Op0.getValueType(); SDValue NewXor = DAG.getNode(ISD::XOR, Op1.getDebugLoc(), VT, Op1.getOperand(0), DAG.getConstant(~XorC, VT)); return DAG.getNode(ISD::ADD, N->getDebugLoc(), VT, NewXor, - DAG.getConstant(Op0C+1, VT)); + DAG.getConstant(C->getAPIntValue()+1, VT)); } } |