[all-commits] [llvm/llvm-project] f590df: [RegAllocFast] Give an undef tied use the register...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Sep 9 21:58:57 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f590dfa8e989652cdd906d6ec74ebfe7f8d8d869
      https://github.com/llvm/llvm-project/commit/f590dfa8e989652cdd906d6ec74ebfe7f8d8d869
  Author: Fangrui Song <i at maskray.me>
  Date:   2026-09-09 (Wed, 09 Sep 2026)

  Changed paths:
    M llvm/lib/CodeGen/RegAllocFast.cpp
    A llvm/test/CodeGen/X86/regallocfast-undef-tied-use.mir

  Log Message:
  -----------
  [RegAllocFast] Give an undef tied use the register of its tied def (#222249)

X86TargetLowering::emitSetJmpShadowStackFix zeroes a register by
building an XOR whose two uses are undef reads of its own def (per
MachineOperand.h "... reading the same dont-care value"). Def processing
frees a def whose tied use is undef before the uses are allocated, so
allocVirtRegUndef() no longer finds the virtual register and takes the
head of the allocation order instead. -verify-machineinstrs would fail:

```
renamable $rcx = XOR64rr undef renamable $rax(tied-def 0), undef renamable $rax, implicit-def dead $eflags
*** Bad machine code: Tied physical registers must match. ***
```

Take the register from the tie, and rewrite the instruction's other
reads of the value with it so that they keep agreeing on one register.

Aided by Opus 5



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