[PATCH] D149668: [ShrinkWrap] Use underlying object to rule out stack access.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 10:34:37 PDT 2023


fhahn created this revision.
fhahn added reviewers: efriedma, arsenm, RKSimon, thegameg, dnsampaio, qcolombet.
Herald added subscribers: StephenFan, pengfei, hiraditya, kristof.beyls.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Allow shrink-wrapping past memory accesses that only access globals or
function arguments. This patch uses getUnderlyingObject to try to
identify the accessed object by a given memory operand. If it is a
global or an argument, it does not access the stack of the current
function and should not block shrink wrapping.

Note that the caller's stack may get accessed when passing an argument
via the stack, but not the stack of the current function.

This addresses part of the TODO from D63152 <https://reviews.llvm.org/D63152>.

NOTE: for now I only updated the X86 and AArch64 tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149668

Files:
  llvm/lib/CodeGen/ShrinkWrap.cpp
  llvm/test/CodeGen/AArch64/addsub.ll
  llvm/test/CodeGen/AArch64/arm64-shrink-wrapping.ll
  llvm/test/CodeGen/AArch64/combine-comparisons-by-cse.ll
  llvm/test/CodeGen/AArch64/csr-split.ll
  llvm/test/CodeGen/AArch64/taildup-cfi.ll
  llvm/test/CodeGen/X86/2010-08-04-MaskedSignedCompare.ll
  llvm/test/CodeGen/X86/cmov.ll
  llvm/test/CodeGen/X86/copy-eflags.ll
  llvm/test/CodeGen/X86/csr-split.ll
  llvm/test/CodeGen/X86/i686-win-shrink-wrapping.ll
  llvm/test/CodeGen/X86/inline-asm-flag-output.ll
  llvm/test/CodeGen/X86/peep-test-5.ll
  llvm/test/CodeGen/X86/shrink-wrap-chkstk-x86_64.ll
  llvm/test/CodeGen/X86/statepoint-vector.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149668.518795.patch
Type: text/x-patch
Size: 34000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230502/53af42f9/attachment.bin>


More information about the llvm-commits mailing list