[PATCH] D103007: [LoopUtils] Avoid expanding complicated SCEVNAry when rewriteLoopExitValues
    guopeilin via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon May 24 05:35:09 PDT 2021
    
    
  
guopeilin added a comment.
In D103007#2776571 <https://reviews.llvm.org/D103007#2776571>, @nikic wrote:
> Why is this not already covered by the isHighCostExpansion() check?
Firstly,within the function `isHighCostExpansion`, only the SCEVUDivExpr and SCEVMinMaxExpr could have the chance to return true.
Secondly, even though function isHighCostExpansion return true, the result is used in the following code:
  // Only do the rewrite when the ExitValue can be expanded cheaply.
  // If LoopCanBeDel is true, rewrite exit value aggressively.
  if (ReplaceExitValue == OnlyCheapRepl && !LoopCanBeDel && Phi.HighCost) {
    DeadInsts.push_back(ExitVal);
    continue;
  }
And in this case, the variable LoopCanBeDel  is true,  this means we will expand anyway.
So I guess we need some early-return way to avoid this extremely complicated cases.
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