]> granicus.if.org Git - llvm/commit
[FIX] Forces shrink wrapping to consider any memory access as aliasing with the stack
authorDiogo N. Sampaio <diogo.sampaio@arm.com>
Thu, 13 Jun 2019 13:56:19 +0000 (13:56 +0000)
committerDiogo N. Sampaio <diogo.sampaio@arm.com>
Thu, 13 Jun 2019 13:56:19 +0000 (13:56 +0000)
commitdce1007a340c3a6301c59ab772b709604276f560
treed948c6900663bc91bb43252ac757e95a4b0e42b9
parent6528ff861ffc3b2911ec177bab60c435651d8082
[FIX] Forces shrink wrapping to consider any memory access as aliasing with the stack

Summary:
Relate bug: https://bugs.llvm.org/show_bug.cgi?id=37472

The shrink wrapping pass prematurally restores the stack, at a point where the stack might still be accessed.
Taking an exception can cause the stack to be corrupted.

As a first approach, this patch is overly conservative, assuming that any instruction that may load or store could access
the stack.

Reviewers: dmgreen, qcolombet

Reviewed By: qcolombet

Subscribers: simpal01, efriedma, eli.friedman, javed.absar, llvm-commits, eugenis, chill, carwil, thegameg

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63152

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363265 91177308-0d34-0410-b5e6-96231b3b80d8
22 files changed:
lib/CodeGen/ShrinkWrap.cpp
test/CodeGen/AArch64/arm64-shrink-wrapping.ll
test/CodeGen/AArch64/branch-relax-cbz.ll
test/CodeGen/AArch64/dont-shrink-wrap-stack-mayloadorstore.mir [new file with mode: 0644]
test/CodeGen/AArch64/taildup-cfi.ll
test/CodeGen/ARM/arm-shrink-wrapping-linux.ll
test/CodeGen/ARM/arm-shrink-wrapping.ll
test/CodeGen/PowerPC/BreakableToken-reduced.ll
test/CodeGen/PowerPC/ifcvt-forked-bug-2016-08-08.ll
test/CodeGen/PowerPC/licm-tocReg.ll
test/CodeGen/PowerPC/ppc64-sibcall-shrinkwrap.ll
test/CodeGen/PowerPC/xray-ret-is-terminator.ll
test/CodeGen/Thumb/thumb-shrink-wrapping.ll
test/CodeGen/X86/2010-08-04-MaskedSignedCompare.ll
test/CodeGen/X86/MachineSink-eflags.ll
test/CodeGen/X86/cmov.ll
test/CodeGen/X86/copy-eflags.ll
test/CodeGen/X86/fold-pcmpeqd-2.ll
test/CodeGen/X86/i386-shrink-wrapping.ll
test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll
test/CodeGen/X86/x86-shrink-wrapping.ll
test/CodeGen/X86/xchg-nofold.ll