[PATCH] D67870: DSE miscompile when store is clobbered across loop iterations

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 00:56:22 PDT 2019


efriedma added subscribers: llvm-commits, efriedma.
efriedma added a comment.

It looks like you forgot to CC llvm-commits?  Please post a new differential so the patch is sent to the list.

In some sense, the alias() method of AliasAnalysis really has three parameters: the two memory locations are explicit, and the implicit third parameter is a position in the source code where both locations are valid.  Given that context, you can prove "obvious" identities like aliasing between x and x+1, aliasing with restrict pointers, etc.  This is generally useful for a lot of transforms.  In contexts where that doesn't work, we use some other mechanism, like LoopAccessAnalysis.  BasicAA does look through PHI nodes in certain cases, but when it does, it's very careful to use a different set of assumptions (although we've had bugs with this in the past).

This is specifically a hole in the calloc() handling, right?  This case can't come up in regular load->store no-op stores: the address of the load dominates the load, so the address dominates all the operations between the load and the store, so alias() does the right thing.


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

https://reviews.llvm.org/D67870





More information about the llvm-commits mailing list