[PATCH] D130049: [WinEH][ARM64] Split unwind info for functions larger than 1MB

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 06:09:01 PDT 2022


mstorsjo added a comment.

In D130049#3704064 <https://reviews.llvm.org/D130049#3704064>, @mstorsjo wrote:

> This triggers failed asserts in two cases in my builds - this one:
>
> clang: ../lib/MC/MCWin64EH.cpp:998: void ARM64FindSegmentsInFunction(llvm::MCStreamer&, llvm::WinEH::FrameInfo*, int64_t): Assertion `(Epilogs.size() == 0 || Offset >= Epilogs.back().End) && "Epilogs should be monotonically ordered"' failed.
>
> It’s reproducible with https://martin.st/temp/wine-corruntimehost.c and https://martin.st/temp/dav1d-thread.c with this command:
> `clang -target aarch64-windows -c src.c -O2`

I ran into this issue in a number of more cases too, hitting compilation of at least 3 different projects.

I had a look at it - see D131393 <https://reviews.llvm.org/D131393> for a quick tweak that avoids triggering the failed assert in at least the particular case that I looked at.

I also posted D131394 <https://reviews.llvm.org/D131394>, which adds a similar consistency check as for ARM, which triggers and shows the real root cause for this issue. For the dav1d-thread.c testcase, we're currently generating the following code:

  $ clang -target aarch64-windows -S dav1d-thread.c -O2 -o -
  [...]
  dav1d_set_thread_name:
  [...]
          ldp     x2, x19, [sp, #8]               // 16-byte Folded Reload
          .seh_startepilogue
          ldr     x30, [sp, #24]                  // 8-byte Folded Reload
          .seh_save_reg   x30, 24
          .seh_save_reg   x19, 16
          add     sp, sp, #32
          .seh_stackalloc 32
          .seh_endepilogue
          br      x2

There's three `.seh_` opcodes in the epilogue, even if there's only two actual instructions - while the `.seh_save_reg x19` has been merged into an `ldp x2, x19` before the start of the epilogue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130049/new/

https://reviews.llvm.org/D130049



More information about the llvm-commits mailing list