[polly] r238090 - Use unique_ptr to clarify ownership of ScopStmt

Johannes Doerfert doerfert at cs.uni-saarland.de
Tue May 26 11:59:04 PDT 2015

On 05/26, David Blaikie wrote:
> On Fri, May 22, 2015 at 10:14 PM, Tobias Grosser <tobias at grosser.es> wrote:
> > vector.
> > -  Stmts.push_back(Stmt);
> > +  Stmts.push_back(std::move(Stmt));
> >
> It looks like these objects aren't polymorphic (it's not like Stmts
> contains pointers to heterogenous derived objects). If that's the case, you
> might want to consider whether you can use value rather than pointer
> semantics.
> Either a std::vector<ScopStmt> or, if you need object pointer identity, a
> std::forward_list<ScopStmt> or std::list<ScopStmt>
> This makes the semantics even simpler - no extra pointer chasing, etc, and
> can reduce the memory footprint (forward_list reduces the memory footprint
> a tiny bit (compared to a vector of unique_ptr) but std::list actually
> increases it because it needs two pointers per node instead of one (a
> vector of unique_ptrs only has one pointer per node, etc))
I would really like to change to References or if not possible to
std::forward_list<Reference>. (I actually did so in the Scalar Codegen
path with MemoryAcccesses.)

So if we all agree that's a good way to write code we should change
both, our owning raw_pointers as well as the newly introduced smart

> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Johannes Doerfert
Researcher / PhD Student

Compiler Design Lab (Prof. Hack)
Saarland University, Computer Science
Building E1.3, Room 4.31

Tel. +49 (0)681 302-57521 : doerfert at cs.uni-saarland.de
Fax. +49 (0)681 302-3065  : http://www.cdl.uni-saarland.de/people/doerfert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150526/1d8fadb7/attachment.sig>

More information about the llvm-commits mailing list