[PATCH] D25464: [NFC] Loop Versioning for LICM code clean up

silviu.baranga@arm.com via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 02:25:03 PDT 2016


sbaranga added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopVersioningLICM.cpp:524
-  // Initial allocation
-  CurAST = new AliasSetTracker(*AA);
 
----------------
eastig wrote:
> sbaranga wrote:
> > eastig wrote:
> > > This is not safe. Replaced with unique_ptr.
> > Why is this not safe? It looks like if we don't use use unique_ptr we end up with less memory usage (unique_ptr won't free the memory until LoopVersioningLICMs destructor gets called or until we run on another loop).
> All separate new and delete are unsafe. Yes, you are right it's hold till destruction of a LoopVersioningLICM object. I'll fix this.
I still don't understand why new/delete would be unsafe.


================
Comment at: lib/Transforms/Scalar/LoopVersioningLICM.cpp:522
+  // LoopVersioningLICM object.
+  AutoResetter Resetter(*this);
+
----------------
This only releases the memory when running on a new loop. So it wouldn't make things better. The solution also looks a bit over-engineered.


https://reviews.llvm.org/D25464





More information about the llvm-commits mailing list