mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
[DWARF] Simplify DWARFAddressRange::contains
This transform is valid because the ranges have been validated (LowPC <= HighPC). Differential Revision: https://reviews.llvm.org/D44772 llvm-svn: 328655
This commit is contained in:
parent
034a0ba182
commit
a8a090c21a
@ -36,17 +36,17 @@ struct DWARFAddressRange {
|
||||
|
||||
/// Returns true if [LowPC, HighPC) intersects with [RHS.LowPC, RHS.HighPC).
|
||||
bool intersects(const DWARFAddressRange &RHS) const {
|
||||
assert(valid() && RHS.valid());
|
||||
// Empty ranges can't intersect.
|
||||
if (LowPC == HighPC || RHS.LowPC == RHS.HighPC)
|
||||
return false;
|
||||
return (LowPC < RHS.HighPC) && (HighPC > RHS.LowPC);
|
||||
return LowPC < RHS.HighPC && RHS.LowPC < HighPC;
|
||||
}
|
||||
|
||||
/// Returns true if [LowPC, HighPC) fully contains [RHS.LowPC, RHS.HighPC).
|
||||
bool contains(const DWARFAddressRange &RHS) const {
|
||||
if (LowPC <= RHS.LowPC && RHS.LowPC <= HighPC)
|
||||
return LowPC <= RHS.HighPC && RHS.HighPC <= HighPC;
|
||||
return false;
|
||||
assert(valid() && RHS.valid());
|
||||
return LowPC <= RHS.LowPC && RHS.HighPC <= HighPC;
|
||||
}
|
||||
|
||||
void dump(raw_ostream &OS, uint32_t AddressSize,
|
||||
|
Loading…
Reference in New Issue
Block a user