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.
Details
Details
- Reviewers
lebedev.ri fhahn - Commits
- rG897bdca4b81d: [ConstantRange] Add API for intrinsics (NFC)
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM, this makes sense to enable wider use and is in line with existing members like binaryOp. Thanks!
llvm/include/llvm/IR/ConstantRange.h | ||
---|---|---|
153 | 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. | |
llvm/lib/IR/ConstantRange.cpp | ||
863 | maybe we should assert(!isIntrinsicSupported(IntrinsicID)) here, to catch (some) inconsistencies between isIntrinsicSupported and intrinsic |
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.