[clang] [clang][dataflow] Strengthen pointer comparison. (PR #75170)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon May 6 08:26:07 PDT 2024


Xazax-hun wrote:

> In summary, if the storage locations for two pointers are the same, we can return a true literal for the comparison, but if the storage locations are different, we need to return an atom.

I am wondering, if it would make sense to "fix up" the state when we discover aliasing? I.e., "merging" the two storage locations. Consider:

```
void f(MyBoolPair* a, MyBoolPair *b) {
  if (a == b && a->first && !b->second)
  {
    // Here, we should know: a->first == b->first == true and a->second == b->second == false
  } 
}
```

https://github.com/llvm/llvm-project/pull/75170


More information about the cfe-commits mailing list