[PATCH] D93523: [DSE] Use correct memory location for read clobber check
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 18 10:04:21 PST 2020
fhahn added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1944
// Find the next clobbering Mod access for DefLoc, starting at StartAccess.
+ Optional<MemoryLocation> CurrentLoc;
do {
----------------
nikic wrote:
> fhahn wrote:
> > nikic wrote:
> > > fhahn wrote:
> > > > Can this just be `MemoryLocation CurrentLoc`? We should skip the case when it would be `None` and it should always be `!= None` before after the loop.
> > > This uses Optional<MemoryLocation> because getLocForWriteEx() returns it that way. Should I copy it into a separate non-Optional variable after the check that it is not None?
> > I'd put the result of `getLocForWriteEx` into a new temprary and move the content to `CurrentLoc` after the check. Or have something like
> >
> > ```
> > if (auto Loc = getLocForWriteEx(....)) {
> > CurrentLoc = *Loc;
> > } else {
> > StepAgain = true;
> > ....
> > continue;
> > }
> > ```
> I liked your second suggestion. Does the new version look fine?
that looks good, thanks!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93523/new/
https://reviews.llvm.org/D93523
More information about the llvm-commits
mailing list