Next: Arithmetic on `poly_int`s, Previous: Consequences of using `poly_int`, Up: poly_int [Contents][Index]

### 10.3 Comparisons involving `poly_int`

In general we need to compare sizes and offsets in two situations: those in which the values need to be ordered, and those in which the values can be unordered. More loosely, the distinction is often between values that have a definite link (usually because they refer to the same underlying register or memory location) and values that have no definite link. An example of the former is the relationship between the inner and outer sizes of a subreg, where we must know at compile time whether the subreg is paradoxical, partial, or complete. An example of the latter is alias analysis: we might want to check whether two arbitrary memory references overlap.

Referring back to the examples in the previous section, it makes sense to ask whether a memory reference of size ‘`3 + 4x`’ overlaps one of size ‘`1 + 5x`’, but it does not make sense to have a subreg in which the outer mode has ‘`3 + 4x`’ bytes and the inner mode has ‘`1 + 5x`’ bytes (or vice versa). Such subregs are always invalid and should trigger an internal compiler error if formed.

The underlying operators are the same in both cases, but the distinction affects how they are used.

Next: Arithmetic on `poly_int`s, Previous: Consequences of using `poly_int`, Up: poly_int [Contents][Index]