martinboehme wrote: > An alternative approach would be to do [hash > consing](https://en.wikipedia.org/wiki/Hash_consing). Since pointer values > are completely determined by the pointee (for some definition of the pointee, > e.g., we might have `void*` and `int*` pointers pointing to the same storage > location), we could have a single representation for all of the equal pointer > values and continue to rely on identity. This can also be beneficial for > memory consumption, but we have to pay for that by making value creation a > bit more expensive (and the pointer values needs to be immutable). > > That being said, this would be a bit of a departure from the current > architecture, so I think even if we want to do this, it should be a separate > PR.
Thanks, these are good points. I think we may want to revisit multiple aspects of pointer values and storage locations at some point. For example, storage locations always have a type, and so storage locations of different types necessarily compare different. For example: ```cxx struct Base {}; struct Derived : public Base {}; Derived d; Derived *p_derived = &d; Base *p_base = d; // `p_derived == p_base` should hold, but the framework assumes `p_derived != p_base`. ``` It's probably a good thing for storage locations to have types (because we want to be able to model the dynamic type of an object), but this probably means that we want to model addresses separately from storage locations. This would then also help in other cases, such as union members and pointer interconvertibility. But all of this would be a major undertaking, I think. https://github.com/llvm/llvm-project/pull/75170 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits