llvm.org GIT mirror llvm / 2dfa410
[APInt] Fix a case where udivrem might delete and create a new allocation instead of reusing the original. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302882 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 3 years ago
1 changed file(s) with 5 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
16851685 // There is only one word to consider so use the native versions.
16861686 uint64_t lhsValue = LHS.U.pVal[0];
16871687 uint64_t rhsValue = RHS.U.pVal[0];
1688 Quotient = APInt(LHS.getBitWidth(), lhsValue / rhsValue);
1689 Remainder = APInt(LHS.getBitWidth(), lhsValue % rhsValue);
1688 // Make sure there is enough space to hold the results.
1689 Quotient.reallocate(LHS.BitWidth);
1690 Remainder.reallocate(LHS.BitWidth);
1691 Quotient = lhsValue / rhsValue;
1692 Remainder = lhsValue % rhsValue;
16901693 return;
16911694 }
16921695