[PATCH] D28511: Skip loop header when we can computing loop safety info
    Xin Tong via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Jan  9 21:53:33 PST 2017
    
    
  
trentxintong updated this revision to Diff 83777.
trentxintong added a comment.
Move declaration into forloop.
https://reviews.llvm.org/D28511
Files:
  lib/Transforms/Scalar/LICM.cpp
Index: lib/Transforms/Scalar/LICM.cpp
===================================================================
--- lib/Transforms/Scalar/LICM.cpp
+++ lib/Transforms/Scalar/LICM.cpp
@@ -447,7 +447,9 @@
 
   SafetyInfo->MayThrow = SafetyInfo->HeaderMayThrow;
   // Iterate over loop instructions and compute safety info.
-  for (Loop::block_iterator BB = CurLoop->block_begin(),
+  // The first block in loopinfo.Blocks is guaranteed to be the header.
+  assert(Header == *CurLoop->getBlocks().begin() && "First block must be header");
+  for (Loop::block_iterator BB = std::next(CurLoop->block_begin()),
                             BBE = CurLoop->block_end();
        (BB != BBE) && !SafetyInfo->MayThrow; ++BB)
     for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28511.83777.patch
Type: text/x-patch
Size: 776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170110/0169edce/attachment.bin>
    
    
More information about the llvm-commits
mailing list