Use *CheckUse = nullptr;
static bool parseRangeCheckICmp(Loop *L, ICmpInst *ICI, ScalarEvolution &SE,
- Value *&Index, Value *&Length,
- bool &IsSigned);
+ Value *&Index, Value *&Length);
static void
extractRangeChecksFromCond(Loop *L, ScalarEvolution &SE, Use &ConditionUse,
bool
InductiveRangeCheck::parseRangeCheckICmp(Loop *L, ICmpInst *ICI,
ScalarEvolution &SE, Value *&Index,
- Value *&Length, bool &IsSigned) {
+ Value *&Length) {
auto IsLoopInvariant = [&SE, L](Value *V) {
return SE.isLoopInvariant(SE.getSCEV(V), L);
};
std::swap(LHS, RHS);
[[fallthrough]];
case ICmpInst::ICMP_SGE:
- IsSigned = true;
if (match(RHS, m_ConstantInt<0>())) {
Index = LHS;
return true; // Lower.
std::swap(LHS, RHS);
[[fallthrough]];
case ICmpInst::ICMP_SGT:
- IsSigned = true;
if (match(RHS, m_ConstantInt<-1>())) {
Index = LHS;
return true; // Lower.
std::swap(LHS, RHS);
[[fallthrough]];
case ICmpInst::ICMP_UGT:
- IsSigned = false;
if (IsLoopInvariant(LHS)) {
Index = RHS;
Length = LHS;
return;
Value *Length = nullptr, *Index;
- bool IsSigned;
- if (!parseRangeCheckICmp(L, ICI, SE, Index, Length, IsSigned))
+ if (!parseRangeCheckICmp(L, ICI, SE, Index, Length))
return;
const auto *IndexAddRec = dyn_cast<SCEVAddRecExpr>(SE.getSCEV(Index));