[PATCH] D60056: Hoist/sink malloc/free's in LICM.

Nick Lewycky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 27 11:14:54 PDT 2019


nicholas updated this revision to Diff 196980.
nicholas added a comment.

This update adds a failing test @test21 which demonstrates a miscompile. While we check the block with the free in it for potentially-malloc'ing instructions, we don't examine all the possible paths from where that free was pre-transform to the new location of the free post-transform.

It's not immediately clear to me how to fix that efficiently. It's possible to label each loop block with whether it contains a potentially-malloc'ing instruction, then find all paths from frees to exit blocks which will have frees added to them and do not pass through any backedge or back through the header. We can simplify this path scan, knowing that all exits reachable after the free call are exits where we will insert a free.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60056/new/

https://reviews.llvm.org/D60056

Files:
  llvm/include/llvm/Analysis/LoopAllocationInfo.h
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Analysis/CMakeLists.txt
  llvm/lib/Analysis/LoopAllocationInfo.cpp
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/test/Transforms/LICM/allocs.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60056.196980.patch
Type: text/x-patch
Size: 44336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190427/1e204064/attachment.bin>


More information about the llvm-commits mailing list