]> granicus.if.org Git - llvm/commitdiff
[LoopDeletion] Modernize and simplify a bit. NFCI.
authorDavide Italiano <davide@freebsd.org>
Sun, 26 Feb 2017 07:08:20 +0000 (07:08 +0000)
committerDavide Italiano <davide@freebsd.org>
Sun, 26 Feb 2017 07:08:20 +0000 (07:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296294 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopDeletion.cpp

index 1f0ca706972bde965f77a59cad684c8b466acc80..73e8ce0e1d93cfbe769f1c26848df2e89b67e90f 100644 (file)
@@ -78,14 +78,9 @@ static bool isLoopDead(Loop *L, ScalarEvolution &SE,
   // Make sure that no instructions in the block have potential side-effects.
   // This includes instructions that could write to memory, and loads that are
   // marked volatile.
-  for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
-       LI != LE; ++LI) {
-    for (Instruction &I : **LI) {
-      if (I.mayHaveSideEffects())
-        return false;
-    }
-  }
-
+  for (auto &I : L->blocks())
+    if (any_of(*I, [](Instruction &I) { return I.mayHaveSideEffects(); }))
+      return false;
   return true;
 }