To be used in ConstantRange::shlWithNoOverflow(),
may in future be useful for when saturating shift/mul ops are added.
Unlike ConstantRange::shl(), these are precise.
Differential D69960
[ConstantRange] Add `ushl_sat()`/`sshl_sat()` methods. lebedev.ri on Nov 7 2019, 12:16 PM. Authored by
Details To be used in ConstantRange::shlWithNoOverflow(), Unlike ConstantRange::shl(), these are precise.
Diff Detail
Event TimelineComment Actions
At least when modelling the APInt semantics. If we treat too large shifts as poison, then we could produce empty sets in more cases. But this seems like a reasonable starting point...
Comment Actions Cleanup sshl_sat() with ternaries as suggested. Yeah, i think this might be a good thing to do, but later, more globally.
This comment was removed by lebedev.ri.
Comment Actions LGTM
|
Mild preference for using Min.isNonNegative() and Max.isNegative() here, because it makes the relationship to the shifted value clear. Also fine as-is though.