[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
Sun Oct 18 20:33:55 PDT 2020


shchenz created this revision.
shchenz added reviewers: hfinkel, qcolombet, samparker, PowerPC.
Herald added subscribers: llvm-commits, steven.zhang, pengfei, hiraditya, nemanjai.
Herald added a project: LLVM.
shchenz requested review of this revision.

`isProfitableChain` was added based on register number cost. But now, there are some targets like X86/PowerPC taking instruction number as the major cost.

So on these targets, `isProfitableChain` wrongly eliminates some LSRUse based on register number when collecting chains/LSRUses, these eliminated LSRUse may impact the instruction number a lot in later rate cost phase. Thus we will get a suboptimal loop code sequence.

Maybe we need to add a new hook if target overrides `isLSRCostLess` and sets instruction number as the first priority of the cost?

This patch can make some cpu2017 benchmarks improve on PowerPC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89665

Files:
  llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
  llvm/test/CodeGen/PowerPC/lsr-profitable-chain.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89665.298921.patch
Type: text/x-patch
Size: 5561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201019/4f0286d2/attachment.bin>


More information about the llvm-commits mailing list