Commit 5362a0d8 authored by Nikita Popov's avatar Nikita Popov
Browse files

[LCSSA] Remove unused ScalarEvolution argument (NFC)

After D149435, LCSSA formation no longer needs access to
ScalarEvolution, so remove the argument from the utilities.
parent 41549b53
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ bool formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI,
/// they still do not have any uses). Otherwise the PHIs are directly removed.
bool formLCSSAForInstructions(
    SmallVectorImpl<Instruction *> &Worklist, const DominatorTree &DT,
    const LoopInfo &LI, ScalarEvolution *SE, IRBuilderBase &Builder,
    const LoopInfo &LI, IRBuilderBase &Builder,
    SmallVectorImpl<PHINode *> *PHIsToRemove = nullptr);

/// Put loop into LCSSA form.
@@ -88,25 +88,21 @@ bool formLCSSAForInstructions(
/// the loop are rewritten to use this node. Sub-loops must be in LCSSA form
/// already.
///
/// LoopInfo and DominatorTree are required and preserved.
///
/// If ScalarEvolution is passed in, it will be preserved.
/// LoopInfo and DominatorTree are required and preserved. ScalarEvolution is
/// preserved.
///
/// Returns true if any modifications are made to the loop.
bool formLCSSA(Loop &L, const DominatorTree &DT, const LoopInfo *LI,
               ScalarEvolution *SE);
bool formLCSSA(Loop &L, const DominatorTree &DT, const LoopInfo *LI);

/// Put a loop nest into LCSSA form.
///
/// This recursively forms LCSSA for a loop nest.
///
/// LoopInfo and DominatorTree are required and preserved.
///
/// If ScalarEvolution is passed in, it will be preserved.
/// LoopInfo and DominatorTree are required and preserved. ScalarEvolution is
/// preserved.
///
/// Returns true if any modifications are made to the loop.
bool formLCSSARecursively(Loop &L, const DominatorTree &DT, const LoopInfo *LI,
                          ScalarEvolution *SE);
bool formLCSSARecursively(Loop &L, const DominatorTree &DT, const LoopInfo *LI);

/// Flags controlling how much is checked when sinking or hoisting
/// instructions.  The number of memory access in the loop (and whether there
+2 −2
Original line number Diff line number Diff line
@@ -1530,7 +1530,7 @@ bool LoopConstrainer::run() {

  // This function canonicalizes the loop into Loop-Simplify and LCSSA forms.
  auto CanonicalizeLoop = [&] (Loop *L, bool IsOriginalLoop) {
    formLCSSARecursively(*L, DT, &LI, &SE);
    formLCSSARecursively(*L, DT, &LI);
    simplifyLoop(L, &DT, &LI, &SE, nullptr, nullptr, true);
    // Pre/post loops are slow paths, we do not need to perform any loop
    // optimizations on them.
@@ -1759,7 +1759,7 @@ PreservedAnalyses IRCEPass::run(Function &F, FunctionAnalysisManager &AM) {
    for (const auto &L : LI) {
      CFGChanged |= simplifyLoop(L, &DT, &LI, &SE, nullptr, nullptr,
                                 /*PreserveLCSSA=*/false);
      Changed |= formLCSSARecursively(*L, DT, &LI, &SE);
      Changed |= formLCSSARecursively(*L, DT, &LI);
    }
    Changed |= CFGChanged;

+1 −1
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AAResults *AA, LoopInfo *LI,
      // SSAUpdater strategy during promotion that was LCSSA aware and reformed
      // it as it went.
      if (Promoted)
        formLCSSARecursively(*L, *DT, LI, SE);
        formLCSSARecursively(*L, *DT, LI);

      Changed |= Promoted;
    }
+2 −2
Original line number Diff line number Diff line
@@ -532,7 +532,7 @@ struct LoopInterchange {
    LLVM_DEBUG(dbgs() << "Loops interchanged.\n");
    LoopsInterchanged++;

    llvm::formLCSSARecursively(*OuterLoop, *DT, LI, SE);
    llvm::formLCSSARecursively(*OuterLoop, *DT, LI);
    return true;
  }
};
@@ -1691,7 +1691,7 @@ bool LoopInterchangeTransform::adjustLoopBranches() {
  for (Instruction &I :
       make_range(OuterLoopHeader->begin(), std::prev(OuterLoopHeader->end())))
    MayNeedLCSSAPhis.push_back(&I);
  formLCSSAForInstructions(MayNeedLCSSAPhis, *DT, *LI, SE, Builder);
  formLCSSAForInstructions(MayNeedLCSSAPhis, *DT, *LI, Builder);

  return true;
}
+1 −1
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ private:
        else
          DTU.applyUpdates(DTUpdates);
        DTUpdates.clear();
        formLCSSARecursively(*FixLCSSALoop, DT, &LI, &SE);
        formLCSSARecursively(*FixLCSSALoop, DT, &LI);
        SE.forgetBlockAndLoopDispositions();
      }
    }
Loading