Skip to content

Commit

Permalink
[PowerPC] return early if there is no preparing candidate in the loop…
Browse files Browse the repository at this point in the history
…; NFC

This is to improve compiling time.

Differential Revision: https://reviews.llvm.org/D112196

Reviewed By: jsji
  • Loading branch information
chenzheng1030 committed Oct 22, 2021
1 parent 85bf221 commit 1375543
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
Expand Up @@ -174,6 +174,7 @@ namespace {
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,
Expand Down Expand Up @@ -570,6 +571,9 @@ SmallVector<Bucket, 16> PPCLoopInstrFormPrep::collectCandidates(
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);
}
Expand Down Expand Up @@ -1046,6 +1050,8 @@ bool PPCLoopInstrFormPrep::runOnLoop(Loop *L) {
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 =
Expand All @@ -1054,6 +1060,9 @@ bool PPCLoopInstrFormPrep::runOnLoop(Loop *L) {
// 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.
Expand Down

0 comments on commit 1375543

Please sign in to comment.