mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Minor code cleanups. Do more of the work before the if statements
instead of within their controlling expressions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72007 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -806,8 +806,9 @@ SCEVHandle ScalarEvolution::getZeroExtendExpr(const SCEVHandle &Op,
|
|||||||
// the addrec's type. The count is always unsigned.
|
// the addrec's type. The count is always unsigned.
|
||||||
SCEVHandle CastedMaxBECount =
|
SCEVHandle CastedMaxBECount =
|
||||||
getTruncateOrZeroExtend(MaxBECount, Start->getType());
|
getTruncateOrZeroExtend(MaxBECount, Start->getType());
|
||||||
if (MaxBECount ==
|
SCEVHandle RecastedMaxBECount =
|
||||||
getTruncateOrZeroExtend(CastedMaxBECount, MaxBECount->getType())) {
|
getTruncateOrZeroExtend(CastedMaxBECount, MaxBECount->getType());
|
||||||
|
if (MaxBECount == RecastedMaxBECount) {
|
||||||
const Type *WideTy =
|
const Type *WideTy =
|
||||||
IntegerType::get(getTypeSizeInBits(Start->getType()) * 2);
|
IntegerType::get(getTypeSizeInBits(Start->getType()) * 2);
|
||||||
// Check whether Start+Step*MaxBECount has no unsigned overflow.
|
// Check whether Start+Step*MaxBECount has no unsigned overflow.
|
||||||
@@ -815,10 +816,11 @@ SCEVHandle ScalarEvolution::getZeroExtendExpr(const SCEVHandle &Op,
|
|||||||
getMulExpr(CastedMaxBECount,
|
getMulExpr(CastedMaxBECount,
|
||||||
getTruncateOrZeroExtend(Step, Start->getType()));
|
getTruncateOrZeroExtend(Step, Start->getType()));
|
||||||
SCEVHandle Add = getAddExpr(Start, ZMul);
|
SCEVHandle Add = getAddExpr(Start, ZMul);
|
||||||
if (getZeroExtendExpr(Add, WideTy) ==
|
SCEVHandle OperandExtendedAdd =
|
||||||
getAddExpr(getZeroExtendExpr(Start, WideTy),
|
getAddExpr(getZeroExtendExpr(Start, WideTy),
|
||||||
getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
|
getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
|
||||||
getZeroExtendExpr(Step, WideTy))))
|
getZeroExtendExpr(Step, WideTy)));
|
||||||
|
if (getZeroExtendExpr(Add, WideTy) == OperandExtendedAdd)
|
||||||
// Return the expression with the addrec on the outside.
|
// Return the expression with the addrec on the outside.
|
||||||
return getAddRecExpr(getZeroExtendExpr(Start, Ty),
|
return getAddRecExpr(getZeroExtendExpr(Start, Ty),
|
||||||
getZeroExtendExpr(Step, Ty),
|
getZeroExtendExpr(Step, Ty),
|
||||||
@@ -830,10 +832,11 @@ SCEVHandle ScalarEvolution::getZeroExtendExpr(const SCEVHandle &Op,
|
|||||||
getMulExpr(CastedMaxBECount,
|
getMulExpr(CastedMaxBECount,
|
||||||
getTruncateOrSignExtend(Step, Start->getType()));
|
getTruncateOrSignExtend(Step, Start->getType()));
|
||||||
Add = getAddExpr(Start, SMul);
|
Add = getAddExpr(Start, SMul);
|
||||||
if (getZeroExtendExpr(Add, WideTy) ==
|
OperandExtendedAdd =
|
||||||
getAddExpr(getZeroExtendExpr(Start, WideTy),
|
getAddExpr(getZeroExtendExpr(Start, WideTy),
|
||||||
getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
|
getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
|
||||||
getSignExtendExpr(Step, WideTy))))
|
getSignExtendExpr(Step, WideTy)));
|
||||||
|
if (getZeroExtendExpr(Add, WideTy) == OperandExtendedAdd)
|
||||||
// Return the expression with the addrec on the outside.
|
// Return the expression with the addrec on the outside.
|
||||||
return getAddRecExpr(getZeroExtendExpr(Start, Ty),
|
return getAddRecExpr(getZeroExtendExpr(Start, Ty),
|
||||||
getSignExtendExpr(Step, Ty),
|
getSignExtendExpr(Step, Ty),
|
||||||
@@ -891,8 +894,9 @@ SCEVHandle ScalarEvolution::getSignExtendExpr(const SCEVHandle &Op,
|
|||||||
// the addrec's type. The count is always unsigned.
|
// the addrec's type. The count is always unsigned.
|
||||||
SCEVHandle CastedMaxBECount =
|
SCEVHandle CastedMaxBECount =
|
||||||
getTruncateOrZeroExtend(MaxBECount, Start->getType());
|
getTruncateOrZeroExtend(MaxBECount, Start->getType());
|
||||||
if (MaxBECount ==
|
SCEVHandle RecastedMaxBECount =
|
||||||
getTruncateOrZeroExtend(CastedMaxBECount, MaxBECount->getType())) {
|
getTruncateOrZeroExtend(CastedMaxBECount, MaxBECount->getType());
|
||||||
|
if (MaxBECount == RecastedMaxBECount) {
|
||||||
const Type *WideTy =
|
const Type *WideTy =
|
||||||
IntegerType::get(getTypeSizeInBits(Start->getType()) * 2);
|
IntegerType::get(getTypeSizeInBits(Start->getType()) * 2);
|
||||||
// Check whether Start+Step*MaxBECount has no signed overflow.
|
// Check whether Start+Step*MaxBECount has no signed overflow.
|
||||||
@@ -900,10 +904,11 @@ SCEVHandle ScalarEvolution::getSignExtendExpr(const SCEVHandle &Op,
|
|||||||
getMulExpr(CastedMaxBECount,
|
getMulExpr(CastedMaxBECount,
|
||||||
getTruncateOrSignExtend(Step, Start->getType()));
|
getTruncateOrSignExtend(Step, Start->getType()));
|
||||||
SCEVHandle Add = getAddExpr(Start, SMul);
|
SCEVHandle Add = getAddExpr(Start, SMul);
|
||||||
if (getSignExtendExpr(Add, WideTy) ==
|
SCEVHandle OperandExtendedAdd =
|
||||||
getAddExpr(getSignExtendExpr(Start, WideTy),
|
getAddExpr(getSignExtendExpr(Start, WideTy),
|
||||||
getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
|
getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
|
||||||
getSignExtendExpr(Step, WideTy))))
|
getSignExtendExpr(Step, WideTy)));
|
||||||
|
if (getSignExtendExpr(Add, WideTy) == OperandExtendedAdd)
|
||||||
// Return the expression with the addrec on the outside.
|
// Return the expression with the addrec on the outside.
|
||||||
return getAddRecExpr(getSignExtendExpr(Start, Ty),
|
return getAddRecExpr(getSignExtendExpr(Start, Ty),
|
||||||
getSignExtendExpr(Step, Ty),
|
getSignExtendExpr(Step, Ty),
|
||||||
|
Reference in New Issue
Block a user