OSDN Git Service

[ShrinkWrapping] Handle restores on no-return paths
authorFrancis Visoiu Mistrih <fvisoiumistrih@apple.com>
Mon, 15 May 2017 23:13:35 +0000 (23:13 +0000)
committerFrancis Visoiu Mistrih <fvisoiumistrih@apple.com>
Mon, 15 May 2017 23:13:35 +0000 (23:13 +0000)
commitcc8486f6112749053407e34b7483babdef543c38
tree3f88c0ad3a16e08375a70db4ae4444416e791514
parent4e4a48b04ca50cb8bfafe6ff85eab43869ed3372
[ShrinkWrapping] Handle restores on no-return paths

Shrink-wrapping uses post-dominators to find a restore point that
post-dominates all the uses of CSR / stack.

The way dominator trees are modeled in LLVM today is that unreachable
blocks are not present in a generic dominator tree, so, an unreachable node is
dominated by anything: include/llvm/Support/GenericDomTree.h:467.

Since for post-dominators, a no-return block is considered
"unreachable", calling findNearestCommonDominator on an unreachable node
A and a non-unreachable node B, will return B, which can be false. If we
find such node, we bail out since there is no good restore point
available.

rdar://problem/30186931

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303130 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/ShrinkWrap.cpp
test/CodeGen/Thumb2/v8_IT_5.ll
test/CodeGen/X86/x86-shrink-wrapping.ll