[all-commits] [llvm/llvm-project] 941601: DAG: Fix cross-block gc.relocate of constants and ...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Tue Sep 22 12:17:18 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 941601e5da23c567ff8fdd2377392ca6dcba672d
      https://github.com/llvm/llvm-project/commit/941601e5da23c567ff8fdd2377392ca6dcba672d
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2026-09-22 (Tue, 22 Sep 2026)

  Changed paths:
    M llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
    M llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
    A llvm/test/CodeGen/X86/statepoint-relocate-eh.ll

  Log Message:
  -----------
  DAG: Fix cross-block gc.relocate of constants and allocas (#222894)

This fixes latent "Register not marked live out of predecessor" verifier errors in 
existing statepoint tests when LiveIntervals is run earlier in the pass pipeline. This 
is observable today when using -verify-coalescing in  statepoint tests. The verifier 
check only runs with LiveIntervals, which is first computed as a dependency for the 
RegisterCoalescer, but the coalescer happens to hide the problem before the first 
verifier run with computed LiveIntervals in the existing testcases.

When constants and static allocas are relocated in an invoke statepoint's landing pad, 
LowerAsSTATEPOINT places the virtual register definition after the STATEPOINT call:

  bb.0.entry:
    STATEPOINT ...          ; unwinds to bb.2 before %0 is defined
    %0:gr64 = MOV64ri 1

  bb.2.lpad (landing-pad):
    $rax = COPY %0:gr64     ; reads uninitialized %0 (folded to undef)

This happens because LowerAsSTATEPOINT calls ExportFromCurrentBlock(V)
for cross-block NoRelocate values, queuing a CopyToReg in PendingExports
that is chained after the STATEPOINT call node.

This patch fixes the problem by recording the directly-lowered leaf in
StatepointRelocationRecord and rematerializing it in visitGCRelocate,
resolving both the wrong-code miscompile on the unwind path and the
machine verifier error with -early-live-intervals.

Co-authored-by: Claude (Claude-Opus-4.8)



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