[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
Tue Jan 10 10:03:00 PST 2017
trentxintong updated this revision to Diff 83821.
trentxintong added a comment.
Address comments.
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,10 @@
SafetyInfo->MayThrow = SafetyInfo->HeaderMayThrow;
// Iterate over loop instructions and compute safety info.
- for (Loop::block_iterator BB = CurLoop->block_begin(),
+ // Skip header as it has been computed and stored in HeaderMayThrow.
+ // 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.83821.patch
Type: text/x-patch
Size: 849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170110/ffad124d/attachment.bin>
More information about the llvm-commits
mailing list