[PATCH] D59193: [ConstantRange] Add overflow check helpers

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 10 14:17:22 PDT 2019


lebedev.ri added a subscriber: nlopes.
lebedev.ri added a comment.

In D59193#1424032 <https://reviews.llvm.org/D59193#1424032>, @nikic wrote:

> In D59193#1424028 <https://reviews.llvm.org/D59193#1424028>, @lebedev.ri wrote:
>
> > This looks extremely error prone.
> >  This needs to be verified (keywords: alive, SMT) somehow ideally.
>
>
> Maybe I can just include some exhaustive tests? I'm thinking on 4-bit numbers we have 16^2 possible ranges with less than 16^4 values contained in them in total. That's few enough to try all of them.


Sure, for one-time thing brute-force verification could work (how do you plan to produce the 'truth' you will be verifying against?)

Also, see @nlopes's `ConstantRange` section of https://llvm.org/devmtg/2013-11/slides/Lopes-SMT.pdf.
This is rather not suited for day-to-day use, but i'm not sure there are friendlier wrappers for such a rare use-case..


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59193





More information about the llvm-commits mailing list