forked from OSchip/llvm-project
[NFC][SCEV] Add 'getMinusOne()' method
This commit is contained in:
parent
bd6d41f52e
commit
be1678bdb9
|
@ -591,6 +591,11 @@ public:
|
|||
/// Return a SCEV for the constant 1 of a specific type.
|
||||
const SCEV *getOne(Type *Ty) { return getConstant(Ty, 1); }
|
||||
|
||||
/// Return a SCEV for the constant -1 of a specific type.
|
||||
const SCEV *getMinusOne(Type *Ty) {
|
||||
return getConstant(Ty, -1, /*isSigned=*/true);
|
||||
}
|
||||
|
||||
/// Return an expression for sizeof AllocTy that is type IntTy
|
||||
const SCEV *getSizeOfExpr(Type *IntTy, Type *AllocTy);
|
||||
|
||||
|
|
|
@ -3746,8 +3746,7 @@ const SCEV *ScalarEvolution::getNegativeSCEV(const SCEV *V,
|
|||
|
||||
Type *Ty = V->getType();
|
||||
Ty = getEffectiveSCEVType(Ty);
|
||||
return getMulExpr(
|
||||
V, getConstant(cast<ConstantInt>(Constant::getAllOnesValue(Ty))), Flags);
|
||||
return getMulExpr(V, getMinusOne(Ty), Flags);
|
||||
}
|
||||
|
||||
/// If Expr computes ~A, return A else return nullptr
|
||||
|
@ -3791,9 +3790,7 @@ const SCEV *ScalarEvolution::getNotSCEV(const SCEV *V) {
|
|||
|
||||
Type *Ty = V->getType();
|
||||
Ty = getEffectiveSCEVType(Ty);
|
||||
const SCEV *AllOnes =
|
||||
getConstant(cast<ConstantInt>(Constant::getAllOnesValue(Ty)));
|
||||
return getMinusSCEV(AllOnes, V);
|
||||
return getMinusSCEV(getMinusOne(Ty), V);
|
||||
}
|
||||
|
||||
const SCEV *ScalarEvolution::getMinusSCEV(const SCEV *LHS, const SCEV *RHS,
|
||||
|
|
Loading…
Reference in New Issue