llvm.org GIT mirror llvm / ada33d7
[SCEV] Reduce possible APInt allocations a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302769 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 3 years ago
1 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
73767376 const APInt &N = NC->getAPInt();
73777377 APInt Two(BitWidth, 2);
73787378
7379 const APInt& C = L;
73807379 // Convert from chrec coefficients to polynomial coefficients AX^2+BX+C
7380
7381 // The A coefficient is N/2
7382 APInt A(N.sdiv(Two));
7383
73817384 // The B coefficient is M-N/2
73827385 APInt B(M);
7383 B -= N.sdiv(Two);
7384
7385 // The A coefficient is N/2
7386 APInt A(N.sdiv(Two));
7386 B -= A; // A is the same as N/2.
7387
7388 // The C coefficient is L.
7389 const APInt& C = L;
73877390
73887391 // Compute the B^2-4ac term.
73897392 APInt SqrtTerm(B);
74017404
74027405 // Compute the two solutions for the quadratic formula.
74037406 // The divisions must be performed as signed divisions.
7404 APInt NegB(-B);
7405 APInt TwoA(A << 1);
7406 if (TwoA.isMinValue())
7407 APInt NegB(-std::move(B));
7408 APInt TwoA(std::move(A));
7409 TwoA <<= 1;
7410 if (TwoA.isNullValue())
74077411 return None;
74087412
74097413 LLVMContext &Context = SE.getContext();