[PATCH] D33688: [Polly] Heap allocation for new arrays

Andreas Simbuerger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 01:45:12 PDT 2017


simbuerg added inline comments.


================
Comment at: lib/CodeGen/CodeGeneration.cpp:243
+    // one will break the malloc allocation.
+    Builder.SetInsertPoint(StartBlock->getTerminator());
 
----------------
Maybe something like this:
-
Explicitly set the insert point to the end of the block to avoid that a split at the builder's current
insert position would move the malloc calls to the wrong BasicBlock. Ideally we would just split
the block during allocation of the new arrays, but this would break the assumption that there are
no blocks between polly.start and polly.exiting (at this point).
-

No need to mention that the creation on the heap fails, because this is not the problem, this is the
result. Furthermore, polly.loop_exit has nothing to do with this. This is just the block the malloc end up in,
if you do not set the insert location to the end.

What you want to achieve is simply: Preserve the mallocs in the polly.start block. The correct solution would be
to split the BasicBlock, however that would touch all places that assume that there are only polly.start and polly.exiting.
So, this solution works and interferes with as few locations as possible.






https://reviews.llvm.org/D33688





More information about the llvm-commits mailing list