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

Tobias Grosser tobias at grosser.es
Tue May 26 23:57:23 PDT 2015


On 05/27/2015 07:27 AM, David Blaikie wrote:
>
>
> On Tue, May 26, 2015 at 10:23 PM, Tobias Grosser <tobias at grosser.es
> <mailto: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.

r238294

Thank you,
Tobias



More information about the llvm-commits mailing list