[PATCH] D117180: [BasicAliasAnalysis] Switch from isMallocOrCallocLikeFn to onlyAccessesInaccessibleMemory

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 12:00:19 PST 2022


reames added a comment.

In D117180#3241427 <https://reviews.llvm.org/D117180#3241427>, @Bryce-MW wrote:

> I'll see what happens when removing that section. It does sound like that should be added to clang. I'll take a look at that before this is landed. I don't know enough about the standards to say if op new is required to only access inaccessible memory but that sounds reasonable since I think op new is supposed to not be observable.

Er, the discussion here has gone a bit off base.  A couple of points:

1. The existing code does *NOT* handle operator new.  It very specifically uses the accessor which does not include opnewlike.
2. The reason for this is that calls to the replaceable global allocator in C++ are *not* removable (i.e. are observable) *unless* they come from an new expression.  (See the comment in isAllocRemovable for pointers to relevant sections of the spec.)  Since we don't model this distinction, we must treat all as non-removable.

So, no, please do *not* mark opnew as inaccessiblememonly in clang.  That would be wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117180



More information about the llvm-commits mailing list