This is an archive of the discontinued LLVM Phabricator instance.

Make MemorySSA::dominates/locallydominates constant time
ClosedPublic

Authored by dberlin on Jul 19 2016, 12:49 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

dberlin retitled this revision from to Make MemorySSA::dominates/locallydominates constant time.
dberlin updated this object.
dberlin added a reviewer: gbiv.
dberlin added a subscriber: llvm-commits.
  • Update comment
george.burgess.iv edited edge metadata.

LGTM with a few comments; thanks for the patch!

include/llvm/Transforms/Utils/MemorySSA.h
635 ↗(On Diff #64549)

Given that we only ever store true for the value, can this be a DenseSet instead?

lib/Transforms/Utils/MemorySSA.cpp
1205 ↗(On Diff #64549)

Do we need to invalidate numbering here, as well? (Alternatively, we could start all counts from 2, and always give a newly-created phi a value of 1, but that could also be done later as a part of the "number with a stride of N" optimization)

1582 ↗(On Diff #64549)

Nit: Please remove braces

This revision is now accepted and ready to land.Jul 19 2016, 1:52 PM
dberlin marked 3 inline comments as done.Jul 19 2016, 3:51 PM
dberlin added inline comments.
include/llvm/Transforms/Utils/MemorySSA.h
635 ↗(On Diff #64549)

Replaced with SmallPtrSet

lib/Transforms/Utils/MemorySSA.cpp
1205 ↗(On Diff #64549)

Fixed.
We can actually just answer PHI queries without ever numbering, them ever.
There is only ever one phi. It always must be first :)

so after the equality/etc checks in dominates, you could do

if (isa<MemoryPhi>(Dominator))
  return true;
if (isa<MemoryPhi>(Dominatee))
  return false;

But we can do this in a followup if it matters.

This revision was automatically updated to reflect the committed changes.