[PATCH] Use value semantics for list of ScopStmt(s) instead of std::owningptr

David Blaikie dblaikie at gmail.com
Tue May 26 22:27:20 PDT 2015


On Tue, May 26, 2015 at 10:23 PM, Tobias Grosser <tobias at grosser.es> wrote:

> In http://reviews.llvm.org/D10041#179021, @jdoerfert wrote:
>
> > If you do only worry about the order but you would like to use a list,
> define the begin()/end() function of a Scop as rbegin()/rend() of the
> underlying list of scopstmts, that should give us the same order but avoid
> the deque (which isn't that bad I guess).
>
>
> I decided to stay with the deque as the use of rbegin()/rend() is
> possible, but would (only slightly) increase complexity. As I doubt this
> has any performance effect, I decided to minimize complexity.
>
>
> REPOSITORY
>   rL LLVM
>
> ================
> Comment at: lib/Analysis/ScopInfo.cpp:2024
> @@ -2030,3 +2023,3 @@
>  ScopStmt *Scop::getStmtForBasicBlock(BasicBlock *BB) const {
> -  const auto &StmtMapIt = StmtMap.find(BB);
> +  auto StmtMapIt = StmtMap.find(BB);
>    if (StmtMapIt == StmtMap.end())
> ----------------
> jdoerfert wrote:
> > Why no const &?
> Changed.
>

I think your change to drop const ref was correct here - find returns an
iterator by value, so it's just added complexity/strangeness to then use
reference lifetime extension to give it the same semantics as if you'd used
a value type instead of a reference type.


>
> http://reviews.llvm.org/D10041
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150526/cfe48263/attachment.html>


More information about the llvm-commits mailing list