[PATCH] D33313: [SCEV][NFC] Remove duplication of isLoopInvariant code

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 01:24:11 PDT 2017


mkazantsev created this revision.
Herald added subscribers: mzolotukhin, sanjoy.

Replace two places that duplicate the code of isLoopInvariant method with
the invocation of this method.


https://reviews.llvm.org/D33313

Files:
  lib/Analysis/ScalarEvolution.cpp


Index: lib/Analysis/ScalarEvolution.cpp
===================================================================
--- lib/Analysis/ScalarEvolution.cpp
+++ lib/Analysis/ScalarEvolution.cpp
@@ -3885,7 +3885,7 @@
       : SCEVRewriteVisitor(SE), L(L), Valid(true) {}
 
   const SCEV *visitUnknown(const SCEVUnknown *Expr) {
-    if (!(SE.getLoopDisposition(Expr, L) == ScalarEvolution::LoopInvariant))
+    if (!SE.isLoopInvariant(Expr, L))
       Valid = false;
     return Expr;
   }
@@ -3919,7 +3919,7 @@
 
   const SCEV *visitUnknown(const SCEVUnknown *Expr) {
     // Only allow AddRecExprs for this loop.
-    if (!(SE.getLoopDisposition(Expr, L) == ScalarEvolution::LoopInvariant))
+    if (!SE.isLoopInvariant(Expr, L))
       Valid = false;
     return Expr;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33313.99406.patch
Type: text/x-patch
Size: 764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170518/f552ab92/attachment.bin>


More information about the llvm-commits mailing list