[PATCH] D38563: [MachineBlockPlacement] Make sure PreferredLoopExit is cleared everytime new loop is processed

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 14:41:11 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL314937: [MachineBlockPlacement] Make sure PreferredLoopExit is cleared everytime new… (authored by trentxintong).

Repository:
  rL LLVM

https://reviews.llvm.org/D38563

Files:
  llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp


Index: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
+++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
@@ -2233,9 +2233,19 @@
   // If we selected just the header for the loop top, look for a potentially
   // profitable exit block in the event that rotating the loop can eliminate
   // branches by placing an exit edge at the bottom.
+  //
+  // Loops are processed innermost to uttermost, make sure we clear
+  // PreferredLoopExit before processing a new loop.
+  PreferredLoopExit = nullptr;
   if (!RotateLoopWithProfile && LoopTop == L.getHeader())
     PreferredLoopExit = findBestLoopExit(L, LoopBlockSet);
 
+  // Make sure PreferredLoopExit actually exits the current loop.
+  if (PreferredLoopExit) {
+    assert(L.isLoopExiting(PreferredLoopExit) &&
+           "not an exiting block of current loop");
+  }
+
   BlockChain &LoopChain = *BlockToChain[LoopTop];
 
   // FIXME: This is a really lame way of walking the chains in the loop: we


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38563.117745.patch
Type: text/x-patch
Size: 1080 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171004/e76facdd/attachment.bin>


More information about the llvm-commits mailing list