[PATCH] D20912: [Polly][GSoC 2016]Update ScopBuilder's memory management
Utpal Bora via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 11:22:58 PDT 2016
cs14mtech11017 updated the summary for this revision.
cs14mtech11017 updated this revision to Diff 59432.
cs14mtech11017 added a dependency: D20831: [Polly][GSoC]Rename ScopInfo to ScopBuilder.
cs14mtech11017 added a comment.
Rebased over patch http://reviews.llvm.org/D20831 which is not committed yet.
http://reviews.llvm.org/D20912
Files:
include/polly/ScopInfo.h
lib/Analysis/ScopInfo.cpp
Index: lib/Analysis/ScopInfo.cpp
===================================================================
--- lib/Analysis/ScopInfo.cpp
+++ lib/Analysis/ScopInfo.cpp
@@ -4899,19 +4899,20 @@
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;
+ SB = new ScopBuilder(R, AC, AA, DL, DT, LI, SD, SE);
+ if (SB) {
+ scop = SB->getScop(); // take ownership of scop object
+ SB = nullptr;
+ }
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 (scop)
+ scop->print(OS);
+ else
+ OS << "Invalid Scop!\n";
}
char ScopInfoRegionPass::ID = 0;
Index: include/polly/ScopInfo.h
===================================================================
--- include/polly/ScopInfo.h
+++ include/polly/ScopInfo.h
@@ -2476,46 +2476,36 @@
/// @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> scop;
public:
static char ID; // Pass identification, replacement for typeid
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 scop.get(); }
+ const Scop *getScop() const { return scop.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 { scop.reset(); }
void print(raw_ostream &O, const Module *M = nullptr) const override;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20912.59432.patch
Type: text/x-patch
Size: 3311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160602/d562b9d6/attachment.bin>
More information about the llvm-commits
mailing list