[PATCH] Fix maxLoopDepth computation in ScopInfo

David Peixotto dpeixott at codeaurora.org
Fri Jan 9 17:56:44 PST 2015


Hi grosser, jdoerfert, zinob,

The max loop depth was incorrectly computed for scops that contain a
block from a loop but do not contain the entire loop. We need to
check that the full loop is contained in the block when computing
the max loop depth.

http://reviews.llvm.org/D6913

Files:
  lib/Analysis/ScopInfo.cpp

Index: lib/Analysis/ScopInfo.cpp
===================================================================
--- lib/Analysis/ScopInfo.cpp
+++ lib/Analysis/ScopInfo.cpp
@@ -1469,6 +1469,8 @@
   unsigned MinLD = INT_MAX, MaxLD = 0;
   for (BasicBlock *BB : R.blocks()) {
     if (Loop *L = LI.getLoopFor(BB)) {
+      if (!R.contains(L))
+        continue;
       unsigned LD = L->getLoopDepth();
       MinLD = std::min(MinLD, LD);
       MaxLD = std::max(MaxLD, LD);

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6913.17965.patch
Type: text/x-patch
Size: 460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150110/e59a1500/attachment.bin>


More information about the llvm-commits mailing list