[PATCH] D152308: [RISCV] Prevent overflowing the small size of InstSeq in generateInstSeq.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 13:50:21 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: reames, jrtc27, asb, luismarques.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

The small size is 8 which is the worst case of the core recursive
algorithm.

The special cases use the core algorithm and append additonal
instructions. We were pushing the extra instructions before checking
the profitability. This could lead to 9 and maybe 10 instructions
in the sequence which overflows the small size.

This patch does the profitability check before inserting the
extra instructions so that we don't create 9 or 10 insruction
sequences.

Alternative we could bump the small size to 9 or 10, but then
we're pushing things that are never going be used.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152308

Files:
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152308.529034.patch
Type: text/x-patch
Size: 4140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230606/0a1fa14b/attachment.bin>


More information about the llvm-commits mailing list