diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GuardWidening.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GuardWidening.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp index a3eba27a4d90..61eb4ce0ed46 100644 --- a/llvm/lib/Transforms/Scalar/GuardWidening.cpp +++ b/llvm/lib/Transforms/Scalar/GuardWidening.cpp @@ -347,9 +347,8 @@ bool GuardWideningImpl::eliminateInstrViaWidening( const auto &GuardsInCurBB = GuardsInBlock.find(CurBB)->second; auto I = GuardsInCurBB.begin(); - auto E = Instr->getParent() == CurBB - ? std::find(GuardsInCurBB.begin(), GuardsInCurBB.end(), Instr) - : GuardsInCurBB.end(); + auto E = Instr->getParent() == CurBB ? find(GuardsInCurBB, Instr) + : GuardsInCurBB.end(); #ifndef NDEBUG { @@ -666,13 +665,12 @@ bool GuardWideningImpl::combineRangeChecks( }; copy_if(Checks, std::back_inserter(CurrentChecks), IsCurrentCheck); - Checks.erase(remove_if(Checks, IsCurrentCheck), Checks.end()); + erase_if(Checks, IsCurrentCheck); assert(CurrentChecks.size() != 0 && "We know we have at least one!"); if (CurrentChecks.size() < 3) { - RangeChecksOut.insert(RangeChecksOut.end(), CurrentChecks.begin(), - CurrentChecks.end()); + llvm::append_range(RangeChecksOut, CurrentChecks); continue; } @@ -700,9 +698,7 @@ bool GuardWideningImpl::combineRangeChecks( return (HighOffset - RC.getOffsetValue()).ult(MaxDiff); }; - if (MaxDiff.isMinValue() || - !std::all_of(std::next(CurrentChecks.begin()), CurrentChecks.end(), - OffsetOK)) + if (MaxDiff.isMinValue() || !all_of(drop_begin(CurrentChecks), OffsetOK)) return false; // We have a series of f+1 checks as: |
