[llvm-commits] [llvm] r166454 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Julien Lerouge jlerouge at apple.com
Mon Oct 22 17:39:41 PDT 2012


On Mon, Oct 22, 2012 at 05:36:24PM -0700, Craig Topper wrote:
> On Mon, Oct 22, 2012 at 5:23 PM, Julien Lerouge <jlerouge at apple.com> wrote:
> 
> > Author: jlerouge
> > Date: Mon Oct 22 19:23:46 2012
> > New Revision: 166454
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=166454&view=rev
> > Log:
> > Explain why DenseMap is still used here instead of MapVector.
> >
> > Modified:
> >     llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
> >
> > Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
> > URL:
> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=166454&r1=166453&r2=166454&view=diff
> >
> > ==============================================================================
> > --- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
> > +++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Mon Oct 22
> > 19:23:46 2012
> > @@ -212,7 +212,11 @@
> >      ///
> >      DenseMap<AllocaInst*, unsigned>  AllocaLookup;
> >
> > -    /// NewPhiNodes - The PhiNodes we're adding.
> > +    /// NewPhiNodes - The PhiNodes we're adding.  That map is used to
> > simplify
> > +    /// some Phi nodes as we iterate over it, so it should have
> > deterministic
> > +    /// iterators.  We could use a MapVector, but since we already
> > maintain a
> > +    /// map from BasicBlock* to a stable numbering (BBNumbers), the
> > DenseMap is
> > +    /// more efficient (also supports removal).
> >      ///
> >      DenseMap<std::pair<unsigned, unsigned>, PHINode*> NewPhiNodes;
> >
> > @@ -588,6 +592,10 @@
> >    while (EliminatedAPHI) {
> >      EliminatedAPHI = false;
> >
> > +    // Iterating over NewPhiNodes is deterministic, so it is safe to try
> > to
> > +    // simplify and RUAW them as we go.  If it was not, we could add uses
> > to
> > +    // the values we replace with in a non deterministic order, thus
> > creating
> > +    // non deterministic def->use chains.
> >
> 
> Isn't the acronym RAUW not RUAW?

Right. Thx.

> 
> 
> >      for (DenseMap<std::pair<unsigned, unsigned>, PHINode*>::iterator I =
> >             NewPhiNodes.begin(), E = NewPhiNodes.end(); I != E;) {
> >        PHINode *PN = I->second;
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> 
> 
> 
> -- 
> ~Craig
-- 
Julien Lerouge
PGP Key Id: 0xB1964A62
PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62
PGP Public Key from: keyserver.pgp.com



More information about the llvm-commits mailing list