[PATCH] D20770: [GSoC 2016][Polly][Refactor] Decouple SCoP building logic from pass

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon May 30 05:16:10 PDT 2016


jdoerfert added a comment.

In http://reviews.llvm.org/D20770#443542, @grosser wrote:

> Also, I would suggest to look after this commit into the memory management of ScopInfo/ScopBuilder. It seems unnecessary to keep it around after the scop was constructed just to keep a pointer to the scop. I would prefer to just have it return the scop object and (or a unique_ptr to it) and not keep any state after the scop has been constructed.


We can do that now or afterwards but it sounds like a good idea.


================
Comment at: lib/Analysis/ScopPass.cpp:23
@@ +22,3 @@
+  ScopInfo *SI = getAnalysis<ScopInfoRegionPass>().getScopInfo();
+  if (SI)
+    if ((S = SI->getScop()))
----------------
grosser wrote:
> Johannes, I do not understand this comment/change? Why do we need to expose ScopInfo/ScopBuilder? Either getScop() returns a scop or a nullptr? That seems all the functionality we need, right?
Ok, fair enough. We can get rid of the indirection completely (same argument as I used to justify the reference return argument for ScopInfo.getScop(), once a ScopInfo/ScopBuilder is created there should always be a Scop). 

@Utpal, can you please replace ScopInfoRegionPass::getScopInfo with a ScopInfoRegionPasS::getScop function?


http://reviews.llvm.org/D20770





More information about the llvm-commits mailing list