[ShrinkWrapping] Do not choose restore point inside loops.
authorQuentin Colombet <qcolombet@apple.com>
Tue, 15 Dec 2015 03:28:11 +0000 (03:28 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Tue, 15 Dec 2015 03:28:11 +0000 (03:28 +0000)
commit8d412e83199c5d7bf29cf3dd7586a8bd134960d1
treec374e0854b9497c7e2f911fc232363469456ce9e
parentf78f55d4dedcff18ffc8a50d152deee00a06b1c0
[ShrinkWrapping] Do not choose restore point inside loops.

The post-dominance property is not sufficient to guarantee that a restore point
inside a loop is safe.
E.g.,
 while(1) {
   Save
   Restore
   if (...)
     break;
   use/def CSRs
 }
All the uses/defs of CSRs are dominated by Save and post-dominated
by Restore. However, the CSRs uses are still reachable after
Restore and before Save are executed.

This fixes PR25824

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255613 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/ShrinkWrap.cpp
test/CodeGen/ARM/arm-shrink-wrapping-linux.ll [new file with mode: 0644]