[PATCH] D152213: ShrinkWrap: Ignore load/store until stack address computation

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 17:14:55 PDT 2023


MatzeB created this revision.
MatzeB added reviewers: fhahn, thegameg, jpenix-quic, sushgokh.
Herald added subscribers: luke, StephenFan, frasercrmck, modimo, wenlei, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, mcrosier.
Herald added a project: All.
MatzeB requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, MaskRay.
Herald added a project: LLVM.

No longer conservatively assume a load/store accesses the stack when we can prove that we did not compute any stack-relative address up to this point in the program.

We do this in a cheap not-quite-a-dataflow-analysis: Assume `NoStackAddressUsed` when all predecessors of a block already guarantee it. Process blocks in reverse post order to guarantee that except for loop headers we have processed all predecessors of a block before processing the block itself. For loops we accept the conservative answer as they are unlikely to be shrink-wrappable anyway.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152213

Files:
  llvm/lib/CodeGen/ShrinkWrap.cpp
  llvm/test/CodeGen/AArch64/branch-relax-cbz.ll
  llvm/test/CodeGen/AArch64/optimize-cond-branch.ll
  llvm/test/CodeGen/ARM/arm-shrink-wrapping.ll
  llvm/test/CodeGen/ARM/machine-sink-multidef.ll
  llvm/test/CodeGen/ARM/swifterror.ll
  llvm/test/CodeGen/RISCV/half-round-conv-sat.ll
  llvm/test/CodeGen/RISCV/half-round-conv.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll
  llvm/test/CodeGen/Thumb2/LowOverheadLoops/fast-fp-loops.ll
  llvm/test/CodeGen/X86/MachineSink-eflags.ll
  llvm/test/CodeGen/X86/callbr-asm-label-addr.ll
  llvm/test/CodeGen/X86/dag-update-nodetomatch.ll
  llvm/test/CodeGen/X86/fold-pcmpeqd-2.ll
  llvm/test/CodeGen/X86/fp128-select.ll
  llvm/test/CodeGen/X86/i386-shrink-wrapping.ll
  llvm/test/CodeGen/X86/inline-asm-flag-output.ll
  llvm/test/CodeGen/X86/pr56103.ll
  llvm/test/CodeGen/X86/test-shrink-bug.ll
  llvm/test/CodeGen/X86/xchg-nofold.ll
  llvm/test/Transforms/CodeGenPrepare/AArch64/large-offset-gep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152213.528636.patch
Type: text/x-patch
Size: 161078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230606/8e254c5d/attachment-0001.bin>


More information about the llvm-commits mailing list