[polly] r273855 - This patch updates memory management of ScopBuilder class.

Utpal Bora via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 08:06:50 PDT 2016


Hello Michael,

The changes in ScopBuilder that we had planned are complete and as of now I
am not working on it. You could proceed with your changes.

Regards,

Utpal Bora
Ph.D. Scholar
Computer Science & Engineering
IIT Hyderabad
http://utpalbora.com


On Mon, Jun 27, 2016 at 6:40 PM, Michael Kruse <llvm-commits at meinersbur.de>
wrote:

> Hi,
>
> I previously mentioned that I would move ScopBuilder to its own file
> after this patch. Would it be OK now or are there currently other
> patches in the works that would make a rebase necessary?
>
> Michael
>
>
>
> 2016-06-27 11:25 GMT+02:00 Johannes Doerfert via llvm-commits
> <llvm-commits at lists.llvm.org>:
> > Author: jdoerfert
> > Date: Mon Jun 27 04:25:40 2016
> > New Revision: 273855
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=273855&view=rev
> > Log:
> > This patch updates memory management of ScopBuilder class.
> >
> >   1. SCoP object is not owned by ScopBuilder. It just creates a SCoP and
> >      hand over ownership through getScop() method.
> >   2. ScopInfoRegionPass owns the SCoP object for a given region.
> >
> > Patch by Utpal Bora <cs14mtech11017 at iith.ac.in>
> >
> > Differential Revision: http://reviews.llvm.org/D20912
> >
> > Modified:
> >     polly/trunk/include/polly/ScopInfo.h
> >     polly/trunk/lib/Analysis/ScopInfo.cpp
> >
> > Modified: polly/trunk/include/polly/ScopInfo.h
> > URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=273855&r1=273854&r2=273855&view=diff
> >
> ==============================================================================
> > --- polly/trunk/include/polly/ScopInfo.h (original)
> > +++ polly/trunk/include/polly/ScopInfo.h Mon Jun 27 04:25:40 2016
> > @@ -2288,9 +2288,6 @@ class ScopBuilder {
> >    // The Scop
> >    std::unique_ptr<Scop> scop;
> >
> > -  // Clear the context.
> > -  void clear();
> > -
> >    // Build the SCoP for Region @p R.
> >    void buildScop(Region &R, AssumptionCache &AC);
> >
> > @@ -2485,18 +2482,16 @@ public:
> >    /// @brief Try to build the Polly IR of static control part on the
> current
> >    ///        SESE-Region.
> >    ///
> > -  /// @return If the current region is a valid for a static control
> part,
> > -  ///         return the Polly IR representing this static control part,
> > -  ///         return null otherwise.
> > -  Scop *getScop() { return scop.get(); }
> > -  const Scop *getScop() const { return scop.get(); }
> > +  /// @return Give up the ownership of the scop object or static
> control part
> > +  ///         for the region
> > +  std::unique_ptr<Scop> getScop() { return std::move(scop); }
> >  };
> >
> >  /// @brief The legacy pass manager's analysis pass to compute scop
> information
> >  ///        for a region.
> >  class ScopInfoRegionPass : public RegionPass {
> > -  /// @brief The ScopBuilder pointer which is used to construct a Scop.
> > -  std::unique_ptr<ScopBuilder> SI;
> > +  /// @brief The Scop pointer which is used to construct a Scop.
> > +  std::unique_ptr<Scop> S;
> >
> >  public:
> >    static char ID; // Pass identification, replacement for typeid
> > @@ -2504,27 +2499,19 @@ public:
> >    ScopInfoRegionPass() : RegionPass(ID) {}
> >    ~ScopInfoRegionPass() {}
> >
> > -  /// @brief Build ScopBuilder object, which constructs Polly IR of
> static
> > -  ///        control part for the current SESE-Region.
> > +  /// @brief Build Scop object, the Polly IR of static control
> > +  ///        part for the current SESE-Region.
> >    ///
> > -  /// @return Return Scop for the current Region.
> > -  Scop *getScop() {
> > -    if (SI)
> > -      return SI.get()->getScop();
> > -    else
> > -      return nullptr;
> > -  }
> > -  const Scop *getScop() const {
> > -    if (SI)
> > -      return SI.get()->getScop();
> > -    else
> > -      return nullptr;
> > -  }
> > +  /// @return If the current region is a valid for a static control
> part,
> > +  ///         return the Polly IR representing this static control part,
> > +  ///         return null otherwise.
> > +  Scop *getScop() { return S.get(); }
> > +  const Scop *getScop() const { return S.get(); }
> >
> >    /// @brief Calculate the polyhedral scop information for a given
> Region.
> >    bool runOnRegion(Region *R, RGPassManager &RGM) override;
> >
> > -  void releaseMemory() override { SI.reset(); }
> > +  void releaseMemory() override { S.reset(); }
> >
> >    void print(raw_ostream &O, const Module *M = nullptr) const override;
> >
> >
> > Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=273855&r1=273854&r2=273855&view=diff
> >
> ==============================================================================
> > --- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
> > +++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Jun 27 04:25:40 2016
> > @@ -4881,8 +4881,6 @@ ScopBuilder::ScopBuilder(Region *R, Assu
> >    emitOptimizationRemarkAnalysis(F->getContext(), DEBUG_TYPE, *F, End,
> Msg);
> >  }
> >
> > -void ScopBuilder::clear() { scop.reset(); }
> > -
> >
> //===----------------------------------------------------------------------===//
> >  void ScopInfoRegionPass::getAnalysisUsage(AnalysisUsage &AU) const {
> >    AU.addRequired<LoopInfoWrapperPass>();
> > @@ -4909,19 +4907,16 @@ bool ScopInfoRegionPass::runOnRegion(Reg
> >    auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
> >    auto &AC =
> getAnalysis<AssumptionCacheTracker>().getAssumptionCache(*F);
> >
> > -  SI.reset(new ScopBuilder(R, AC, AA, DL, DT, LI, SD, SE));
> > +  ScopBuilder SB(R, AC, AA, DL, DT, LI, SD, SE);
> > +  S = SB.getScop(); // take ownership of scop object
> >    return false;
> >  }
> >
> >  void ScopInfoRegionPass::print(raw_ostream &OS, const Module *) const {
> > -  Scop *scop;
> > -  if (SI) {
> > -    if ((scop = SI->getScop())) {
> > -      scop->print(OS);
> > -      return;
> > -    }
> > -  }
> > -  OS << "Invalid Scop!\n";
> > +  if (S)
> > +    S->print(OS);
> > +  else
> > +    OS << "Invalid Scop!\n";
> >  }
> >
> >  char ScopInfoRegionPass::ID = 0;
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
> --
> You received this message because you are subscribed to the Google Groups
> "Polly Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to polly-dev+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160627/3d7bebd1/attachment.html>


More information about the llvm-commits mailing list