[llvm] [RegAllocFast] Give an undef tied use the register of its tied def (PR #222249)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 23:18:54 PDT 2026


MaskRay wrote:

This patch fixes:
```
% cat j.c
#include <stdio.h>

static void *storage[8];
void **buf = storage;

__attribute__((noinline)) int bar(int i) {
  __builtin_longjmp(buf, 1);
  return i;
}

int foo(int i) {
  int j = i * 11;
  if (!__builtin_setjmp(buf)) {
    j += 33 + bar(j);
  }
  return j + i;
}

int main() {
  printf("foo(1) = %d\n", foo(1));
}

% /data/out/debug/bin/clang -fcf-protection=return j.c -o j && ./j
fish: Job 1, './j' terminated by signal SIGSEGV (Address boundary error)

% /data/out/debug/bin/clang -fcf-protection=return j.c -c -mllvm -verify-machineinstrs  
*** Bad machine code: Tied physical registers must match. ***

```

https://github.com/llvm/llvm-project/pull/222249


More information about the llvm-commits mailing list