[PATCH] D15504: Bug fix for shrink-wrap

Weiming Zhao via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 11:55:06 PST 2015


weimingz created this revision.
weimingz added a subscriber: llvm-commits.
weimingz set the repository for this revision to rL LLVM.

This patch fixes a case that not handled properly. 
See bug report: https://llvm.org/bugs/show_bug.cgi?id=25824

Repository:
  rL LLVM

http://reviews.llvm.org/D15504

Files:
  lib/CodeGen/ShrinkWrap.cpp

Index: lib/CodeGen/ShrinkWrap.cpp
===================================================================
--- lib/CodeGen/ShrinkWrap.cpp
+++ lib/CodeGen/ShrinkWrap.cpp
@@ -307,6 +307,12 @@
     return;
   }
 
+  if (Save == Restore && Save != &MBB)
+    if (auto L = MLI->getLoopFor(Save))
+      if (L->getHeader() == Save)
+        // Bail out.
+        Save = nullptr;
+
   // Make sure Save and Restore are suitable for shrink-wrapping:
   // 1. all path from Save needs to lead to Restore before exiting.
   // 2. all path to Restore needs to go through Save from Entry.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15504.42747.patch
Type: text/x-patch
Size: 572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151214/9cfd4ed1/attachment.bin>


More information about the llvm-commits mailing list