[llvm] r296294 - [LoopDeletion] Modernize and simplify a bit. NFCI.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 25 23:08:20 PST 2017


Author: davide
Date: Sun Feb 26 01:08:20 2017
New Revision: 296294

URL: http://llvm.org/viewvc/llvm-project?rev=296294&view=rev
Log:
[LoopDeletion] Modernize and simplify a bit. NFCI.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp?rev=296294&r1=296293&r2=296294&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopDeletion.cpp Sun Feb 26 01:08:20 2017
@@ -78,14 +78,9 @@ static bool isLoopDead(Loop *L, ScalarEv
   // 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;
 }
 




More information about the llvm-commits mailing list