[PATCH] D14983: Introduce new @llvm.getdynamicareaoffset.i{32, 64} intrinsic.

Maxim Ostapenko via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 05:03:40 PST 2015


m.ostepenko created this revision.
m.ostepenko added a reviewer: hfinkel.
m.ostepenko added subscribers: foad, ygribov, llvm-commits.
m.ostepenko set the repository for this revision to rL LLVM.

As discussed in llvm-dev ML (https://groups.google.com/forum/m/#!topic/llvm-dev/42tNzaHISdk), we rely on @llvm.stackrestore intrinsic to get "bottom" parameter for __asan_allocas_unpoison routine to perform stack unpoisoning for deallocated dynamic alloca into ASan runtime. For most targets this is fine, because SP to be restored is guaranteed to be higher than the highest poisoned byte for this alloca, but for PowerPC{64} the situation is different (see http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#DYNAM-STACK). Here we cannot use SP as "bottom" parameter for __asan_allocas_unpoison, because we can just miss unpoisoning of the highest part of right redzone for given alloca.

This patch introduces new @llvm.getdynamicareaoffset.i{32, 64} intrinsic that returns offset from native SP to end of dynamic stack area for given frame. For most targets that would be just 0, for others (e.g. PPC) it would be a compile time known nonzero constant. By adding this value to SP, we can make sure that we would have correct address to pass into __asan_allocas_unpoison as "bottom" and the whole right redzone would be unpoisoned.

Repository:
  rL LLVM

http://reviews.llvm.org/D14983

Files:
  include/llvm/CodeGen/ISDOpcodes.h
  include/llvm/IR/Intrinsics.td
  lib/CodeGen/IntrinsicLowering.cpp
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  lib/CodeGen/TargetLoweringBase.cpp
  lib/Target/PowerPC/PPCISelLowering.cpp
  lib/Target/PowerPC/PPCISelLowering.h
  lib/Target/PowerPC/PPCInstr64Bit.td
  lib/Target/PowerPC/PPCInstrInfo.td
  lib/Target/PowerPC/PPCRegisterInfo.cpp
  lib/Target/PowerPC/PPCRegisterInfo.h
  test/CodeGen/PowerPC/dyn-alloca-offset.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14983.41127.patch
Type: text/x-patch
Size: 13381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151125/75b802a3/attachment.bin>


More information about the llvm-commits mailing list