[llvm] [SystemZ] Add shrink-wrapping support for ELF prologue/epilogue (PR #225240)

Ulrich Weigand via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 03:54:36 PDT 2026


================

----------------
uweigand wrote:

Turns out the epilog also uses `emitIncrement` which clobbers CC, so we need a similar check in `canUseAsEpilogue`.   The X86 version has this:
```
  // If we cannot use LEA to adjust SP, we may need to use ADD, which
  // clobbers the EFLAGS. Check that we do not need to preserve it,
  // otherwise, conservatively assume this is not
  // safe to insert the epilogue here.
  return !flagsNeedToBePreservedBeforeTheTerminators(MBB);
```

(Just like Intel, we could in some cases emit the stack adjustment via `LAY` instead, which does not clobber CC.  That could be a future optimization as well.)

https://github.com/llvm/llvm-project/pull/225240


More information about the llvm-commits mailing list