[llvm] e85d798 - [cgp] group related code together [nfc]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 11:23:25 PST 2021


Author: Philip Reames
Date: 2021-03-09T11:23:15-08:00
New Revision: e85d798b5b7709c352a7b270de55d2facad14793

URL: https://github.com/llvm/llvm-project/commit/e85d798b5b7709c352a7b270de55d2facad14793
DIFF: https://github.com/llvm/llvm-project/commit/e85d798b5b7709c352a7b270de55d2facad14793.diff

LOG: [cgp] group related code together [nfc]

Added: 
    

Modified: 
    llvm/lib/CodeGen/CodeGenPrepare.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 7c9775601773..b6fbfa842133 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -1348,14 +1348,15 @@ bool CodeGenPrepare::replaceMathCmpWithIntrinsic(BinaryOperator *BO,
       return false;
     const Loop *L = LI->getLoopFor(BO->getParent());
     assert(L && "L should not be null after isIVIncrement()");
+    // Do not risk on moving increment into a child loop.
+    if (LI->getLoopFor(Cmp->getParent()) != L)
+      return false;
+
     // IV increment may have other users than the IV. We do not want to make
     // dominance queries to analyze the legality of moving it towards the cmp,
     // so just check that there is no other users.
     if (!BO->hasOneUse())
       return false;
-    // Do not risk on moving increment into a child loop.
-    if (LI->getLoopFor(Cmp->getParent()) != L)
-      return false;
     // Ultimately, the insertion point must dominate latch. This should be a
     // cheap check because no CFG changes & dom tree recomputation happens
     // during the transform.


        


More information about the llvm-commits mailing list