[PATCH] D17241: [Polly] [Refactor] Move isl_ctx into Scop.

Hongbin Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 07:35:32 PST 2016


etherzhhb added a comment.

In http://reviews.llvm.org/D17241#353522, @grosser wrote:

> I am a little worried about both of these changes. Will we still be warned if we forgot to release a pointer or are will we just stop to free isl_ctx due to the wrong order of freeing items.


Without shared_ptr, there will be no warning.
With the shared_ptr, we the program abort if we do not free all isl objects.

> Also, I am surprised why this works today without any troubles? For whatever reason today it seems to be ensured that we free everything else before the ScopInfo pass has been freed.


We only free the isl ctx when we destruct/delete the ScopInfo pass itself. With this patch, we free the isl ctx when we destruct/delete the Scop (the analysis result of ScopInfo), in the releaseMemory function of ScopInfo ().

A single ScopInfo pass will produce multiple Scop, we call releaseMemory of the same ScopInfo multiple times, and only delete ScopInfo pass itself once. That is the different. I think the message "Freeing Pass 'Polly - Generate an AST from the SCoP (isl)' on Region 'for.cond => for.end8'" is generated when we call releaseMemory, instead of deleting the pass.

> Eithers observation of the different pass order somehow suggests that this should not be the case, but it still magically works. Do you understand why this currently works despite the pass freeing being reversed?


Explained above.


http://reviews.llvm.org/D17241





More information about the llvm-commits mailing list