aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorPhilip Reames <preames@rivosinc.com>2023-11-29 10:59:17 -0800
committerPhilip Reames <listmail@philipreames.com>2023-11-29 12:04:06 -0800
commite947f953370abe8ffc8713b8f3250a3ec39599fe (patch)
treee3c78201e8f53c5b1ad8baaee6733fb893a9c5ec /llvm/lib/Object/MachOObjectFile.cpp
parent002c54a2e6cced2eb9d79608afee5fb36dcc5b98 (diff)
downloadllvm-e947f953370abe8ffc8713b8f3250a3ec39599fe.zip
llvm-e947f953370abe8ffc8713b8f3250a3ec39599fe.tar.gz
llvm-e947f953370abe8ffc8713b8f3250a3ec39599fe.tar.bz2
[LSR][TTI][RISCV] Enable terminator folding for RISC-V
If looking for a miscompile revert candidate, look here! The transform being enabled prefers comparing to a loop invariant exit value for a secondary IV over using an otherwise dead primary IV. This increases register pressure (by requiring the exit value to be live through the loop), but reduces the number of instructions within the loop by one. On RISC-V which has a large number of scalar registers, this is generally a profitable transform. We loose the ability to use a beqz on what is typically a count down IV, and pay the cost of computing the exit value on the secondary IV in the loop preheader, but save an add or sub in the loop body. For anything except an extremely short running loop, or one with extreme register pressure, this is profitable. On spec2017, we see a 0.42% geomean improvement in dynamic icount, with no individual workload regressing by more than 0.25%. Code size wise, we trade a (possibly compressible) beqz and a (possibly compressible) addi for a uncompressible beq. We also add instructions in the preheader. Net result is a slight regression overall, but neutral or better inside the loop. Previous versions of this transform had numerous cornercase correctness bugs. All of them ones I can spot by inspection have been fixed, and I have run this through all of spec2017, but there may be further issues lurking. Adding uses to an IV is a fraught thing to do given poison semantics, so this transform is somewhat inherently risky. This patch is a reworked version of D134893 by @eop. That patch has been abandoned since May, so I picked it up, reworked it a bit, and am landing it.
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions