[PATCH] D103007: [LoopUtils] Avoid expanding complicated SCEVNAry when rewriteLoopExitValues

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 01:34:14 PDT 2021


lebedev.ri added a comment.

I'm not a fan of this direction.
Which stack overflow are you seeing?



================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:1436-1468
     Phi.Expansion = Rewriter.expandCodeFor(Phi.ExpansionSCEV, Phi.PN->getType(),
                                            Phi.ExpansionPoint);
 
     LLVM_DEBUG(dbgs() << "rewriteLoopExitValues: AfterLoopVal = "
                       << *(Phi.Expansion) << '\n'
                       << "  LoopVal = " << *(Phi.ExpansionPoint) << "\n");
 
----------------
Because we expand regardless of the high cost,
because we need to do `isValidRewrite()` sanity check first,
before calling `canLoopBeDeleted()`, just in case the latter
returns true and we'd want to expand anyways.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103007/new/

https://reviews.llvm.org/D103007



More information about the llvm-commits mailing list