[PATCH] D74700: [IR] Remove temporary const operator created in Value::getPointerAlignment()

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 12:30:49 PST 2020


efriedma added a comment.

> If we can cleanup instances after some unexpected changes why not to do so?

The big problem here is that getPointerAlignment could be used in places where not all uses of a constant are actual "Use" instances.  Then you have a really subtle use-after-free.  (This could happen in places with maps on the side, like frontends or complex transforms).

If you really want to avoid creating extra constants, probably the right strategy is to avoid calling getPtrToInt in the first place.  There aren't that many ways to construct a pointer that getPtrToInt can fold to a ConstantInt, anyway. (Off the top of my head, it would have to be null, an inttoptr, or a gep of one of those.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74700





More information about the llvm-commits mailing list