[PATCH] D106589: [GlobalOpt] support ConstantExpr use of global address for OptimizeGlobalAddressOfMalloc
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 30 14:53:50 PDT 2021
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:735
+ // Ignore stores to the global.
+ if (SI->getPointerOperand() != P)
+ return false;
----------------
scui wrote:
> efriedma wrote:
> > scui wrote:
> > > efriedma wrote:
> > > > Instead of `SI->getPointerOperand() != P`, should be `SI->getValueOperand() == P`?
> > > SI->getPointerOperand() != P is alright. It's ok to store into global (actually the StoredOnce).
> > My concern is that with opaque pointers, it will become possible to write something like `store ptr @g, ptr @g`, at which point the difference between `SI->getPointerOperand() != P` and `SI->getValueOperand() == P` will start to matter.
> When this function is called, we know there is only one store to the global, and it is from malloc. There are no other stores to the global. So we don't need to worry about "store @g @g".
Okay, I guess.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106589/new/
https://reviews.llvm.org/D106589
More information about the llvm-commits
mailing list