[PATCH] D74700: [IR] Remove temporary const operator created in Value::getPointerAlignment()
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 17 16:16:29 PST 2020
jdoerfert added a comment.
In D74700#1879625 <https://reviews.llvm.org/D74700#1879625>, @efriedma wrote:
> > 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.)
I was hoping that would be a viable solution. Maybe matching `null` explicitly and otherwise just dealing with the constant that we have. IIRC, @lebedev.ri mentioned that would not work well but I let him explain.
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