[PATCH] D59386: [ValueTracking] ConstantRange based overflow detection for unsigned add/sub

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 17 03:17:12 PDT 2019


nikic added a comment.

> Are there any concerns of performance impact of using ConstantRange() here ?

Right now the `computeConstantRange()` function only looks at one instruction to determine the constant range, so it should be rather cheap compared to the computeKnownBits() call (and in the signed case, additionally ComputeNumSignBits()).

For the longer-term future, I think it would make sense to turn the computeConstantRange() function into a recursive computation, in which case it could subsume both computeKnownBits and ComputeNumSignBits for the purpose of overflow checks (which are, in the end, purely range based). But getting to that point would be quite a bit of work...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59386/new/

https://reviews.llvm.org/D59386





More information about the llvm-commits mailing list