[PATCH] D150664: MachineCombiner: use height in improvesCriticialPathLen()

Ramkumar Ramachandra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 05:59:13 PDT 2023


artagnon created this revision.
artagnon added reviewers: spatel, stoklund, Gerolf.
Herald added subscribers: luke, StephenFan, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Herald added a project: All.
artagnon requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, MaskRay.
Herald added a project: LLVM.

improvesCriticialPathLen() currently has an early-exit on
CombinerObjective::MustReduceDepth introduced in 766589ef (add
'MustReduceDepth' as an objective/cost-metric for the MachineCombiner),
by only considering transforms that would reduce the root depth.
However, the patch was introduced because MachineCombiner's use of
MachineTraceMetrics was incomplete, as noted in the Phabricator
discussion. This patch attempts to make better use of
MachineTraceMetrics in MachineCombiner, by also computing instruction
heights, and asserting that the critical path length = depth + slack +
height. We then unify the cost model in improvesCriticalPathLen(), since
there are only two essential differences between the MustReduceDepth
case and the other case: the MustReduceDepth case doesn't want to
consider slack, and wants to be more conservative with respect to the
cost comparison.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150664

Files:
  llvm/include/llvm/CodeGen/MachineTraceMetrics.h
  llvm/lib/CodeGen/MachineCombiner.cpp
  llvm/test/CodeGen/RISCV/addcarry.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp2i.ll
  llvm/test/CodeGen/RISCV/sadd_sat.ll
  llvm/test/CodeGen/RISCV/sadd_sat_plus.ll
  llvm/test/CodeGen/RISCV/ssub_sat.ll
  llvm/test/CodeGen/RISCV/ssub_sat_plus.ll
  llvm/test/CodeGen/RISCV/umulo-128-legalisation-lowering.ll
  llvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll
  llvm/test/CodeGen/RISCV/wide-scalar-shift-by-byte-multiple-legalization.ll
  llvm/test/CodeGen/RISCV/wide-scalar-shift-legalization.ll
  llvm/test/CodeGen/RISCV/xaluo.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150664.522566.patch
Type: text/x-patch
Size: 36477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230516/95588001/attachment.bin>


More information about the llvm-commits mailing list