mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[llvm] Use llvm::lower_bound and llvm::upper_bound (NFC)
This commit is contained in:
parent
04422f73a1
commit
95dfb94fbd
@ -487,7 +487,7 @@ bool LiveRange::overlaps(const LiveRange &Other, const CoalescerPair &CP,
|
|||||||
/// by [Start, End).
|
/// by [Start, End).
|
||||||
bool LiveRange::overlaps(SlotIndex Start, SlotIndex End) const {
|
bool LiveRange::overlaps(SlotIndex Start, SlotIndex End) const {
|
||||||
assert(Start < End && "Invalid range");
|
assert(Start < End && "Invalid range");
|
||||||
const_iterator I = std::lower_bound(begin(), end(), End);
|
const_iterator I = lower_bound(*this, End);
|
||||||
return I != begin() && (--I)->end > Start;
|
return I != begin() && (--I)->end > Start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +158,7 @@ bool LiveRangeCalc::isDefOnEntry(LiveRange &LR, ArrayRef<SlotIndex> Undefs,
|
|||||||
// If LR has a segment S that starts at the next block, i.e. [End, ...),
|
// If LR has a segment S that starts at the next block, i.e. [End, ...),
|
||||||
// std::upper_bound will return the segment following S. Instead,
|
// std::upper_bound will return the segment following S. Instead,
|
||||||
// S should be treated as the first segment that does not overlap B.
|
// S should be treated as the first segment that does not overlap B.
|
||||||
LiveRange::iterator UB = std::upper_bound(LR.begin(), LR.end(),
|
LiveRange::iterator UB = upper_bound(LR, End.getPrevSlot());
|
||||||
End.getPrevSlot());
|
|
||||||
if (UB != LR.begin()) {
|
if (UB != LR.begin()) {
|
||||||
LiveRange::Segment &Seg = *std::prev(UB);
|
LiveRange::Segment &Seg = *std::prev(UB);
|
||||||
if (Seg.end > Begin) {
|
if (Seg.end > Begin) {
|
||||||
|
@ -60,10 +60,8 @@ MCSection::getSubsectionInsertionPoint(unsigned Subsection) {
|
|||||||
if (Subsection == 0 && SubsectionFragmentMap.empty())
|
if (Subsection == 0 && SubsectionFragmentMap.empty())
|
||||||
return end();
|
return end();
|
||||||
|
|
||||||
SmallVectorImpl<std::pair<unsigned, MCFragment *>>::iterator MI =
|
SmallVectorImpl<std::pair<unsigned, MCFragment *>>::iterator MI = lower_bound(
|
||||||
std::lower_bound(SubsectionFragmentMap.begin(),
|
SubsectionFragmentMap, std::make_pair(Subsection, (MCFragment *)nullptr));
|
||||||
SubsectionFragmentMap.end(),
|
|
||||||
std::make_pair(Subsection, (MCFragment *)nullptr));
|
|
||||||
bool ExactMatch = false;
|
bool ExactMatch = false;
|
||||||
if (MI != SubsectionFragmentMap.end()) {
|
if (MI != SubsectionFragmentMap.end()) {
|
||||||
ExactMatch = MI->first == Subsection;
|
ExactMatch = MI->first == Subsection;
|
||||||
|
@ -324,9 +324,7 @@ static const IntrinsicData IntrinsicsWithChain[] = {
|
|||||||
* Find Intrinsic data by intrinsic ID
|
* Find Intrinsic data by intrinsic ID
|
||||||
*/
|
*/
|
||||||
static const IntrinsicData* getIntrinsicWithChain(unsigned IntNo) {
|
static const IntrinsicData* getIntrinsicWithChain(unsigned IntNo) {
|
||||||
const IntrinsicData *Data = std::lower_bound(std::begin(IntrinsicsWithChain),
|
const IntrinsicData *Data = lower_bound(IntrinsicsWithChain, IntNo);
|
||||||
std::end(IntrinsicsWithChain),
|
|
||||||
IntNo);
|
|
||||||
if (Data != std::end(IntrinsicsWithChain) && Data->Id == IntNo)
|
if (Data != std::end(IntrinsicsWithChain) && Data->Id == IntNo)
|
||||||
return Data;
|
return Data;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1152,9 +1150,7 @@ static const IntrinsicData IntrinsicsWithoutChain[] = {
|
|||||||
* Return nullptr if intrinsic is not defined in the table.
|
* Return nullptr if intrinsic is not defined in the table.
|
||||||
*/
|
*/
|
||||||
static const IntrinsicData* getIntrinsicWithoutChain(unsigned IntNo) {
|
static const IntrinsicData* getIntrinsicWithoutChain(unsigned IntNo) {
|
||||||
const IntrinsicData *Data = std::lower_bound(std::begin(IntrinsicsWithoutChain),
|
const IntrinsicData *Data = lower_bound(IntrinsicsWithoutChain, IntNo);
|
||||||
std::end(IntrinsicsWithoutChain),
|
|
||||||
IntNo);
|
|
||||||
if (Data != std::end(IntrinsicsWithoutChain) && Data->Id == IntNo)
|
if (Data != std::end(IntrinsicsWithoutChain) && Data->Id == IntNo)
|
||||||
return Data;
|
return Data;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -613,8 +613,7 @@ bool DwarfLinkerForBinary::AddressManager::findValidRelocsInDebugSections(
|
|||||||
|
|
||||||
bool DwarfLinkerForBinary::AddressManager::hasValidDebugAddrRelocationAt(
|
bool DwarfLinkerForBinary::AddressManager::hasValidDebugAddrRelocationAt(
|
||||||
uint64_t Offset) {
|
uint64_t Offset) {
|
||||||
auto It = std::lower_bound(ValidDebugAddrRelocs.begin(),
|
auto It = lower_bound(ValidDebugAddrRelocs, Offset);
|
||||||
ValidDebugAddrRelocs.end(), Offset);
|
|
||||||
return It != ValidDebugAddrRelocs.end();
|
return It != ValidDebugAddrRelocs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,8 +768,7 @@ bool DwarfLinkerForBinary::AddressManager::applyValidRelocs(
|
|||||||
|
|
||||||
llvm::Expected<uint64_t>
|
llvm::Expected<uint64_t>
|
||||||
DwarfLinkerForBinary::AddressManager::relocateIndexedAddr(uint64_t Offset) {
|
DwarfLinkerForBinary::AddressManager::relocateIndexedAddr(uint64_t Offset) {
|
||||||
auto It = std::lower_bound(ValidDebugAddrRelocs.begin(),
|
auto It = lower_bound(ValidDebugAddrRelocs, Offset);
|
||||||
ValidDebugAddrRelocs.end(), Offset);
|
|
||||||
if (It == ValidDebugAddrRelocs.end())
|
if (It == ValidDebugAddrRelocs.end())
|
||||||
return createStringError(
|
return createStringError(
|
||||||
std::make_error_code(std::errc::invalid_argument),
|
std::make_error_code(std::errc::invalid_argument),
|
||||||
|
Loading…
Reference in New Issue
Block a user