[PATCH] D55007: [Analyzer] Constraint Manager - Calculate Effective Range for Differences

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 4 05:32:23 PST 2018


baloghadamsoftware added a comment.

My original idea was that once we ony store either A - B or B - A. Thus if we already have A - B stored then do not store range for B - A but negate both the difference and the range. I can think on two ways to implement this:

1. Create a separate function e.g. `setRange()` to store the range. This function checks whether the symbol is a difference and whether we already have a range for its negated. If so, then negate the difference and the range as well. ( We do not need to intersect them because the caller already did it.) However, in this case we negate twice: once in `getRange()` then once in `setRange()`.

2. Move the negation out of `getRange()` and call check for a stored negated difference before calling it. If it exist then call the appropriate assume function for the negated difference (for `==` and `!=` it is the same function, but reverse the operator for the rest).

Your idea (store either `A - B` or `B - A` based on their symbol ID is also feasible but then we also face the same question. So 1) or 2)?


Repository:
  rC Clang

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

https://reviews.llvm.org/D55007





More information about the cfe-commits mailing list