[PATCH] D112196: [PowerPC] return early if there is no preparing candidate in the loop; NFC

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 20 20:35:03 PDT 2021


shchenz created this revision.
shchenz added reviewers: jsji, PowerPC.
Herald added subscribers: kbarton, hiraditya, nemanjai.
shchenz requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is from @jsji review comments for patch D108750 <https://reviews.llvm.org/D108750>.

This is to improve some compiling time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112196

Files:
  llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp


Index: llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
+++ llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
@@ -174,6 +174,7 @@
     LoopInfo *LI;
     ScalarEvolution *SE;
     bool PreserveLCSSA;
+    bool HasCandidateForPrepare;
 
     /// Successful preparation number for Update/DS/DQ form in all inner most
     /// loops. One successful preparation will put one common base out of loop,
@@ -570,6 +571,9 @@
       if (!LARSCEV || LARSCEV->getLoop() != L)
         continue;
 
+      // Mark that we have candidates for preparing.
+      HasCandidateForPrepare = true;
+
       if (isValidCandidate(&J, PtrValue, PointerElementType))
         addOneCandidate(&J, LSCEV, Buckets, MaxCandidateNum);
     }
@@ -1046,6 +1050,8 @@
     return ST && ST->hasP9Vector() && (PointerElementType->isVectorTy());
   };
 
+  HasCandidateForPrepare = false;
+
   // Collect buckets of comparable addresses used by loads and stores for update
   // form.
   SmallVector<Bucket, 16> UpdateFormBuckets =
@@ -1054,6 +1060,9 @@
   // Prepare for update form.
   if (!UpdateFormBuckets.empty())
     MadeChange |= updateFormPrep(L, UpdateFormBuckets);
+  else if (!HasCandidateForPrepare)
+    // If no candidate for preparing, return early.
+    return MadeChange;
 
   // Collect buckets of comparable addresses used by loads and stores for DS
   // form.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112196.381140.patch
Type: text/x-patch
Size: 1466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211021/4c980bea/attachment.bin>


More information about the llvm-commits mailing list