Page MenuHomePhabricator

[ConstantRange] Add API for intrinsics (NFC)

Authored by nikic on Sat, Jul 25, 7:56 AM.



This adds a common API for compute constant ranges of intrinsics. The intention here is that
a) we can reuse the same code across different passes that handle constant ranges, i.e. this can be reused in SCCP
b) we only have to add knowledge about supported intrinsics to ConstantRange, not any consumers.

Diff Detail

Event Timeline

nikic created this revision.Sat, Jul 25, 7:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptSat, Jul 25, 7:56 AM
nikic retitled this revision from [ConstantRange] Add API for intrinsics to [ConstantRange] Add API for intrinsics (NFC).Sat, Jul 25, 7:56 AM
fhahn accepted this revision.Mon, Jul 27, 3:18 AM

LGTM, this makes sense to enable wider use and is in line with existing members like binaryOp. Thanks!


Nit: mentioning explicitly what is returned seems a bit clearer to me, .e.g Returns true if ConstantRange calculations are supported for intrinsic with \p IntrinsicID.


maybe we should assert(!isIntrinsicSupported(IntrinsicID)) here, to catch (some) inconsistencies between isIntrinsicSupported and intrinsic

This revision is now accepted and ready to land.Mon, Jul 27, 3:18 AM
This revision was landed with ongoing or failed builds.Wed, Jul 29, 1:16 PM
This revision was automatically updated to reflect the committed changes.
nikic marked 2 inline comments as done.