[llvm] [BranchFolding] Kill common hoisted debug instructions (PR #149999)

Caslyn Tonelli via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 28 16:10:20 PDT 2025


Caslyn wrote:

Hi @OCHyams, 

After this commit we've observed clang crashes compiling existing code with:

```
clang: llvm/include/llvm/CodeGen/MachineInstr.h:2004: void llvm::MachineInstr::setDebugValueUndef(): Assertion `isDebugValue() && "Must be a debug value instruction."' failed.
```

Here's a reduced reproducer: 
```
// bin/clang -cc1 -Os -emit-obj -debug-info-kind=constructor 

void fclose();
int *fopen();
int Curl_get_line();
void Curl_parsenetrc_linebuf() {
  int *file = fopen();
  if (file)
    while (Curl_get_line(Curl_parsenetrc_linebuf))
      fclose();
done:
  fclose(Curl_parsenetrc_linebuf);
  if (file)
    fclose();
}
```

Could you please take a look and revert this change if this will require a non-trivial fix?

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


More information about the llvm-commits mailing list