mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-12 13:48:45 +00:00
[ConstantRange] Use ternary operator instead of 'if' to avoid copying an APInt and then possibly copying over it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301741 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9a418e88ed
commit
5529b11227
@ -431,11 +431,8 @@ ConstantRange ConstantRange::unionWith(const ConstantRange &CR) const {
|
||||
return ConstantRange(CR.Lower, Upper);
|
||||
}
|
||||
|
||||
APInt L = Lower, U = Upper;
|
||||
if (CR.Lower.ult(L))
|
||||
L = CR.Lower;
|
||||
if ((CR.Upper - 1).ugt(U - 1))
|
||||
U = CR.Upper;
|
||||
APInt L = CR.Lower.ult(Lower) ? CR.Lower : Lower;
|
||||
APInt U = (CR.Upper - 1).ugt(Upper - 1) ? CR.Upper : Upper;
|
||||
|
||||
if (L == 0 && U == 0)
|
||||
return ConstantRange(getBitWidth());
|
||||
@ -481,11 +478,8 @@ ConstantRange ConstantRange::unionWith(const ConstantRange &CR) const {
|
||||
if (CR.Lower.ule(Upper) || Lower.ule(CR.Upper))
|
||||
return ConstantRange(getBitWidth());
|
||||
|
||||
APInt L = Lower, U = Upper;
|
||||
if (CR.Upper.ugt(U))
|
||||
U = CR.Upper;
|
||||
if (CR.Lower.ult(L))
|
||||
L = CR.Lower;
|
||||
APInt L = CR.Lower.ult(Lower) ? CR.Lower : Lower;
|
||||
APInt U = CR.Upper.ugt(Upper) ? CR.Upper : Upper;
|
||||
|
||||
return ConstantRange(std::move(L), std::move(U));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user