[all-commits] [llvm/llvm-project] c1b2db: [CodeGen] Diagnose unsupported landingpad result t...

Akash Manna via All-commits all-commits at lists.llvm.org
Fri Oct 2 09:25:07 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c1b2dbb9b1094c47120a59a5b59ab3dbbc1e762a
      https://github.com/llvm/llvm-project/commit/c1b2dbb9b1094c47120a59a5b59ab3dbbc1e762a
  Author: Akash Manna <akash.manna.mymail at gmail.com>
  Date:   2026-10-02 (Fri, 02 Oct 2026)

  Changed paths:
    M llvm/docs/ReleaseNotes.md
    M llvm/include/llvm/CodeGen/Analysis.h
    M llvm/lib/CodeGen/Analysis.cpp
    M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    A llvm/test/CodeGen/X86/pr220959.ll

  Log Message:
  -----------
  [CodeGen] Diagnose unsupported landingpad result types instead of asserting (#223205)

Fixes #220959

`SelectionDAGBuilder::visitLandingPad` reads the exception pointer and
the selector out of two registers, so it assumed the landingpad's result
type always decomposes into exactly two values and asserted otherwise.
LangRef doesn't promise that shape: it says how the personality
function's results are represented is target specific, the verifier only
checks that every landingpad in a function agrees on a type, and
`landingpad token` is already accepted. So `landingpad {}` (or
`landingpad i32`) is well-formed IR that the backend just can't lower,
and it took the whole compiler down with it.

Added a small `isExceptionPointerAndSelectorType` helper in
CodeGen/Analysis that checks the IR struct for a pointer-or-integer
exception object and an integer selector, which is what the lowering
actually consumes, and made both `visitLandingPad` and GlobalISel's
`translateLandingPad` check it before computing any value types.
SelectionDAG emits a `DiagnosticInfoUnsupported` error and lowers the
result to poison so compilation can carry on; GlobalISel fails the
translation and falls back. Added `llvm/test/CodeGen/X86/pr220959.ll`
with the empty struct from the report plus `i32`, a three-element struct
and `{ float, i32 }`, run at `-O2` and at `-O0` where FastISel hands the
landingpad back to SelectionDAG.



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