[PATCH] A new HeapToStack allocation promotion pass

hfinkel at anl.gov hfinkel at anl.gov
Wed Oct 2 07:31:16 PDT 2013


  This is an updated implementation, with a few major changes:

   - A major bug has been fixed (which has been causing a miscompile in SingleSource/Benchmarks/Shootout/objinst): the transformation had been failing to remove the 'tail' attribute on call sites that might modify the now-stack-allocated memory. It seems important not to remove 'tail' except when absolutely necessary because doing so pessimizes AA, but likely does not affect any actual tail-call formation (because there must have been a free after the call originally, and so the original call was not in tail-call position).

   - New instructions are created using IRBuilder, and lifetime intrinsics are added (for constant-sized allocations, the new allocas are moved to the beginning of the entry block).

   - By default, we now branch around conditionally-elided free calls (instead of nulling out the pointer argument). I'm assuming that the branch is generally more efficient than the call in the common case.

   - The new alloca call now should properly take the name of the original malloc.

  Thanks again everyone!

Hi chandlerc,

http://llvm-reviews.chandlerc.com/D1745

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1745?vs=4448&id=4598#toc

Files:
  include/llvm-c/Transforms/Scalar.h
  include/llvm/IR/DataLayout.h
  include/llvm/IR/IRBuilder.h
  include/llvm/InitializePasses.h
  include/llvm/LinkAllPasses.h
  include/llvm/Transforms/IPO/PassManagerBuilder.h
  include/llvm/Transforms/Scalar.h
  include/llvm/Transforms/Utils/BasicBlockUtils.h
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Scalar/CMakeLists.txt
  lib/Transforms/Scalar/HeapToStack.cpp
  lib/Transforms/Scalar/Scalar.cpp
  lib/Transforms/Utils/BasicBlockUtils.cpp
  test/Transforms/HeapToStack/basic.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1745.2.patch
Type: text/x-patch
Size: 36663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131002/1e46d2c3/attachment.bin>


More information about the llvm-commits mailing list