Repository: rust
Issue: Broken LLVM module: inlinable function call in a function with debug info must have a !dbg location
Labels: A-LLVM,A-debuginfo,P-high,T-compiler,regression-from-stable-to-stable,C-bug,E-needs-mcve,A-LTO

<!--
Thank you for filing a regression report! 🐛 A regression is something that changed between versions of Rust but was not supposed to.

Please provide a short summary of the regression, along with any information you feel is relevant to replicate it.
-->

### Code

I tried this code foundry-rs/foundry@0cc535504a909dcee74694fa86f7faafa4cbf4bc:

```bash
git clone https://github.com/foundry-rs/foundry.git
git checkout 0cc535504a909dcee74694fa86f7faafa4cbf4bc
cargo +stable build --bin forge --profile maxperf # takes a while (>5 min)
```

I expected to see this happen: compiles like with dev or release profile

Instead, this happened (see https://github.com/foundry-rs/foundry/actions/runs/12700786553/job/35404155023#step:7:3652):
```
inlinable function call in a function with debug info must have a !dbg location
  tail call fastcc void @_ZN5alloc5alloc18handle_alloc_error17ha0547c441587f574E(i64 noundef 8, i64 noundef 128) #324
... # the last line repeated thousands of times with different arguments
rustc-LLVM ERROR: Broken module found, compilation aborted!
```

This is caused by the following config combination, as changing any of these values makes it compile again:
```toml
debug = "line-tables-only" # any value that's not "none"
lto = "fat"
```

I've also verified that the `strip` value does not affect the outcome either.

We fixed this by setting `debug = "none"`.

~~Maybe related to https://github.com/rust-lang/rust/pull/129063, which modified the function mentioned in the error?~~

---

~~I could reproduce this locally only on 1.84, not on beta or nightly, so feel free to close this if it has already been fixed.~~ Reproducible with `RUSTFLAGS="-Zverify-llvm-ir"`, see https://github.com/rust-lang/rust/issues/135332#issuecomment-2583700719.

~~Unfortunately I wasn't able to minimize this.~~
Simpler repro in https://github.com/rust-lang/rust/issues/135332#issuecomment-2584516583.

### Version it worked on

<!--
Provide the most recent version this worked on, for example:

It most recently worked on: Rust 1.47
-->

It most recently worked on: 1.83.0

### Version with regression

<!--
Provide the version you are using that has the regression.
-->

`rustc --version --verbose`:
```
rustc 1.84.0 (9fc6b4312 2025-01-07)
binary: rustc
commit-hash: 9fc6b43126469e3858e2fe86cafb4f0fd5068869
commit-date: 2025-01-07
host: x86_64-unknown-linux-gnu
release: 1.84.0
LLVM version: 19.1.5
```

```
rustc 1.86.0-nightly (824759493 2025-01-09)
binary: rustc
commit-hash: 824759493246ee383beb9cd5ceffa0e15deb9fa4
commit-date: 2025-01-09
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.6
```

<!--
If you know when this regression occurred, please add a line like below, replacing `{channel}` with one of stable, beta, or nightly.

@rustbot modify labels: +regression-from-stable-to-{channel} -regression-untriaged
-->

@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"khuey"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->