[PATCH] D89665: [LSR] ignore profitable chain optimization when instruction number is the major cost

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 17:53:51 PDT 2020


shchenz added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:2862
+  // chain as profitable.
   if (TTI.isProfitableLSRChainElement(Chain.Incs[0].UserInst))
     return true;
----------------
shchenz wrote:
> samparker wrote:
> > You don't need this now :)
> seems we still need this? The following loop does not contain the first element in the chain.
> ```
>   // Return the first increment in the chain.
>   const_iterator begin() const {
>     assert(!Incs.empty());
>     return std::next(Incs.begin());
>   }
>   const_iterator end() const {
>     return Incs.end();
>   }
> ```
Ah, I know what you mean, we should change the loop in line 2865 to use `Chain.Incs` and thus we can delete the first one


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89665



More information about the llvm-commits mailing list