[all-commits] [llvm/llvm-project] 2629bf: [X86][APX] Fix per-function V3 unwind for EGPR fun...

Feng Zou via All-commits all-commits at lists.llvm.org
Tue Aug 4 05:33:53 PDT 2026


  Branch: refs/heads/release/23.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 2629bf96a7c92c9708baba5c09ce5e82fad581a5
      https://github.com/llvm/llvm-project/commit/2629bf96a7c92c9708baba5c09ce5e82fad581a5
  Author: Feng Zou <feng.zou at intel.com>
  Date:   2026-08-04 (Tue, 04 Aug 2026)

  Changed paths:
    M llvm/lib/Target/X86/X86.h
    M llvm/lib/Target/X86/X86FrameLowering.cpp
    M llvm/lib/Target/X86/X86InstrCompiler.td
    M llvm/lib/Target/X86/X86WinEHUnwindV2.cpp
    M llvm/lib/Target/X86/X86WinEHUnwindV3.cpp
    A llvm/test/CodeGen/X86/win64-eh-unwindv3-egpr-funclet.ll
    A llvm/test/CodeGen/X86/win64-eh-unwindv3-egpr-no-wincfi.ll
    A llvm/test/CodeGen/X86/win64-eh-unwindv3-egpr-per-function.ll
    R llvm/test/CodeGen/X86/win64-eh-unwindv3-egpr-required.ll
    A llvm/test/CodeGen/X86/win64-eh-unwindv3-egpr-v2-module.ll
    A llvm/test/CodeGen/X86/win64-eh-unwindv3-egpr-version-switch-v1.ll
    A llvm/test/CodeGen/X86/win64-eh-unwindv3-egpr-version-switch.ll

  Log Message:
  -----------
  [X86][APX] Fix per-function V3 unwind for EGPR functions on Windows x64 (#212924)

A function that saves a callee-saved EGPR (R16-R31) cannot be encoded with V1/V2 unwind info, so it must use V3 even when the module default stays on V1/V2 (e.g. an APX clone created by auto-dispatch alongside a baseline generic clone). The previous code rejected such functions with a recoverable backend diagnostic ("EGPR (R16-R31) requires V3 unwind info on Windows x64") instead of emitting valid V3 unwind info.

Introduce a single shared predicate, requiresWinX64UnwindV3(MF), that returns true when the whole module is in V3 mode, or when the function needs an unwind table and may use EGPR. It is consumed by X86FrameLowering (SEH prolog/epilog layout), the X86WinEHUnwindV2 pass (which skips such functions), and the X86WinEHUnwindV3 pass (which stamps a per-function .seh_unwindversion 3 on every WinEH frame -- the entry block and each funclet). Also widen the SEH_UnwindVersion pseudo operand from i1imm to i8imm since it holds 1, 2 or 3.

(cherry picked from commit 9466be2c87689a07c9a171f24cb5c9b0c2f0cda8)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list