Issue 75613
Summary Value Range: clang cannot know `(a >> 3 == -2)` means `a` in [ -16, -9]
Labels clang
Assignees
Reporter k-arrows
    Test case:
https://godbolt.org/z/daYcYhxad
```cpp
bool foo(int a)
{
  if ((a >> 3) + 2 == 0) return true;
  else return (a < -16 || a > -9);
}
```

Some generalizations will be necessary, but this is motivated from the following gcc testsuite:
https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.dg/tree-ssa/vrp76.c

Clang13 can optimize the above function `foo`, but it cannot the original `f3`. Therefore, there may be problems that differ from the value range. Sorry if my example is inappropriate.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to