Skip to content

Conversation

@Enselic
Copy link
Member

@Enselic Enselic commented Oct 7, 2025

To prevent regressions our test must cover the code both inside and outside of the SingleUseConsts MIR pass. Use revisions for that.

We know this use case is sensitive to regressions because it already happened at least once. See #33013 (comment).

CC #130896

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 7, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 7, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot

This comment has been minimized.

@Mark-Simulacrum
Copy link
Member

r? @saethlin

I'm personally dubious on disabling MIR passes in debuginfo tests... but I don't have the context here to really evaluate the tradeoffs.

@rustbot rustbot assigned saethlin and unassigned Mark-Simulacrum Oct 11, 2025
@Enselic
Copy link
Member Author

Enselic commented Oct 11, 2025

If we don't disable the pass, we can get other accidental regressions. If we disable the pass we at least know the situation will not get worse. And that risk of additional regressions is high since it already happened at least twice in the past.

Long term we should do a proper fix of course.

@saethlin
Copy link
Member

I'm very confused by the way you are describing this. If there are actual regressions happening in the behavior of the compiler, then what this PR does doesn't fix them. All it does is make sure the test suite keeps passing, which would make it easier for us to ship a regression.

@saethlin saethlin added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 11, 2025
@bors
Copy link
Collaborator

bors commented Oct 14, 2025

☔ The latest upstream changes (presumably #146414) made this pull request unmergeable. Please resolve the merge conflicts.

bors added a commit that referenced this pull request Nov 14, 2025
rustc_codegen_llvm: Require `opt-level >= 1` for index-based write_operand_repeatedly() loop

To make debugger stepping intuitive with `-Copt-level=0`. See the adjusted `basic-stepping.rs` test.

This is kind of a revert of **bd0aae92dc76d9 (cg_llvm: use index-based loop in write_operand_repeatedly)**, except we don't revert it, we just make it conditional on `opt-level`. That commit regressed `basic-stepping.rs`, but it was not noticed since that test did not exist back then (it was added later in #144876). I have retroactively bisected to find that out.

It seems messy to sprinkle if-cases inside of
`write_operand_repeatedly()` so make the whole function conditional.

The test that bd0aae9 added in
`tests/codegen/issues/issue-111603.rs` already use `-Copt-level=3`, so we don't need to adjust the compiler flags for it to keep passing.

This PR takes us one step closer to fixing #33013.

CC #147426 which is related (there will be trivial conflicts for me to resolve in basic-stepping.rs once one of them lands)
bors added a commit that referenced this pull request Nov 14, 2025
rustc_codegen_llvm: Require `opt-level >= 1` for index-based write_operand_repeatedly() loop

To make debugger stepping intuitive with `-Copt-level=0`. See the adjusted `basic-stepping.rs` test.

This is kind of a revert of **bd0aae92dc76d9 (cg_llvm: use index-based loop in write_operand_repeatedly)**, except we don't revert it, we just make it conditional on `opt-level`. That commit regressed `basic-stepping.rs`, but it was not noticed since that test did not exist back then (it was added later in #144876). I have retroactively bisected to find that out.

It seems messy to sprinkle if-cases inside of
`write_operand_repeatedly()` so make the whole function conditional.

The test that bd0aae9 added in
`tests/codegen/issues/issue-111603.rs` already use `-Copt-level=3`, so we don't need to adjust the compiler flags for it to keep passing.

This PR takes us one step closer to fixing #33013.

CC #147426 which is related (there will be trivial conflicts for me to resolve in basic-stepping.rs once one of them lands)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 17, 2025
rustc_codegen_llvm: Require `opt-level >= 1` for index-based write_operand_repeatedly() loop

To make debugger stepping intuitive with `-Copt-level=0`. See the adjusted `basic-stepping.rs` test.

This is kind of a revert of **bd0aae92dc76d9 (cg_llvm: use index-based loop in write_operand_repeatedly)**, except we don't revert it, we just make it conditional on `opt-level`. That commit regressed `basic-stepping.rs`, but it was not noticed since that test did not exist back then (it was added later in rust-lang/rust#144876). I have retroactively bisected to find that out.

It seems messy to sprinkle if-cases inside of
`write_operand_repeatedly()` so make the whole function conditional.

The test that bd0aae92dc76d9 added in
`tests/codegen/issues/issue-111603.rs` already use `-Copt-level=3`, so we don't need to adjust the compiler flags for it to keep passing.

This PR takes us one step closer to fixing rust-lang/rust#33013.

CC rust-lang/rust#147426 which is related (there will be trivial conflicts for me to resolve in basic-stepping.rs once one of them lands)
bors added a commit that referenced this pull request Nov 26, 2025
…thlin

compiletest: Use `//@` prefixes also for debuginfo test directives

So that when we later add support for revisions we can use the same syntax for revisions as elsewhere (for #147426).

This also prevents people from making typos for commands since `src/tools/compiletest/src/directives/directive_names.rs` will catch such typos now.

Note that we add one FIXME for a non-trivial change for later:
```
// FIXME(#148097): Change `// cdb-checksimple_closure` to `//@ cdb-check:simple_closure`
```

### TODO
- [x] Triple-check that all tests still run and all directives are still applied. Done: #147799 (comment)

### Zulip discussion

https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/.2F.2F.40.20syntax.20for.20debuginfo.20tests/with/545015582
bors added a commit that referenced this pull request Nov 26, 2025
…thlin

compiletest: Use `//@` prefixes also for debuginfo test directives

So that when we later add support for revisions we can use the same syntax for revisions as elsewhere (for #147426).

This also prevents people from making typos for commands since `src/tools/compiletest/src/directives/directive_names.rs` will catch such typos now.

Note that we add one FIXME for a non-trivial change for later:
```
// FIXME(#148097): Change `// cdb-checksimple_closure` to `//@ cdb-check:simple_closure`
```

### TODO
- [x] Triple-check that all tests still run and all directives are still applied. Done: #147799 (comment)

### Zulip discussion

https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/.2F.2F.40.20syntax.20for.20debuginfo.20tests/with/545015582
github-actions bot pushed a commit to rust-lang/compiler-builtins that referenced this pull request Nov 27, 2025
…thlin

compiletest: Use `//@` prefixes also for debuginfo test directives

So that when we later add support for revisions we can use the same syntax for revisions as elsewhere (for rust-lang/rust#147426).

This also prevents people from making typos for commands since `src/tools/compiletest/src/directives/directive_names.rs` will catch such typos now.

Note that we add one FIXME for a non-trivial change for later:
```
// FIXME(#148097): Change `// cdb-checksimple_closure` to `//@ cdb-check:simple_closure`
```

### TODO
- [x] Triple-check that all tests still run and all directives are still applied. Done: rust-lang/rust#147799 (comment)

### Zulip discussion

https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/.2F.2F.40.20syntax.20for.20debuginfo.20tests/with/545015582
Kobzol pushed a commit to Kobzol/rustc_codegen_gcc that referenced this pull request Dec 21, 2025
rustc_codegen_llvm: Require `opt-level >= 1` for index-based write_operand_repeatedly() loop

To make debugger stepping intuitive with `-Copt-level=0`. See the adjusted `basic-stepping.rs` test.

This is kind of a revert of **bd0aae92dc76d9 (cg_llvm: use index-based loop in write_operand_repeatedly)**, except we don't revert it, we just make it conditional on `opt-level`. That commit regressed `basic-stepping.rs`, but it was not noticed since that test did not exist back then (it was added later in rust-lang/rust#144876). I have retroactively bisected to find that out.

It seems messy to sprinkle if-cases inside of
`write_operand_repeatedly()` so make the whole function conditional.

The test that bd0aae92dc76d9 added in
`tests/codegen/issues/issue-111603.rs` already use `-Copt-level=3`, so we don't need to adjust the compiler flags for it to keep passing.

This PR takes us one step closer to fixing rust-lang/rust#33013.

CC rust-lang/rust#147426 which is related (there will be trivial conflicts for me to resolve in basic-stepping.rs once one of them lands)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jan 4, 2026
…, r=Zalathar

compiletest: Support revisions in debuginfo (read: debugger) tests

And start using revisions in `tests/debuginfo/macro-stepping.rs` to prevent regressing both with and without `SingleUseConsts` MIR pass.

I recommend commit-by-commit review.

## ~TODO~

- [x] Verify this more carefully.
- [x] Possibly do some preparatory PRs before taking this PR out of draft.
    - [x] Rebase on rust-lang#150205 once merged so we don't have to add another "`+ 1`".

## CC

CC `@Zalathar` since you might have opinions about that I expose a helper function to reduce duplication

CC `@saethlin` since this is what we will use for `tests/debuginfo/basic-stepping.rs` in rust-lang#147426 (in the same way I use it in `tests/debuginfo/macro-stepping.rs` here)
Zalathar added a commit to Zalathar/rust that referenced this pull request Jan 4, 2026
…, r=Zalathar

compiletest: Support revisions in debuginfo (read: debugger) tests

And start using revisions in `tests/debuginfo/macro-stepping.rs` to prevent regressing both with and without `SingleUseConsts` MIR pass.

I recommend commit-by-commit review.

## ~TODO~

- [x] Verify this more carefully.
- [x] Possibly do some preparatory PRs before taking this PR out of draft.
    - [x] Rebase on rust-lang#150205 once merged so we don't have to add another "`+ 1`".

## CC

CC ``@Zalathar`` since you might have opinions about that I expose a helper function to reduce duplication

CC ``@saethlin`` since this is what we will use for `tests/debuginfo/basic-stepping.rs` in rust-lang#147426 (in the same way I use it in `tests/debuginfo/macro-stepping.rs` here)
rust-timer added a commit that referenced this pull request Jan 4, 2026
Rollup merge of #150201 - Enselic:debugger-tests-revisions-2, r=Zalathar

compiletest: Support revisions in debuginfo (read: debugger) tests

And start using revisions in `tests/debuginfo/macro-stepping.rs` to prevent regressing both with and without `SingleUseConsts` MIR pass.

I recommend commit-by-commit review.

## ~TODO~

- [x] Verify this more carefully.
- [x] Possibly do some preparatory PRs before taking this PR out of draft.
    - [x] Rebase on #150205 once merged so we don't have to add another "`+ 1`".

## CC

CC ``@Zalathar`` since you might have opinions about that I expose a helper function to reduce duplication

CC ``@saethlin`` since this is what we will use for `tests/debuginfo/basic-stepping.rs` in #147426 (in the same way I use it in `tests/debuginfo/macro-stepping.rs` here)
…, `no-SingleUseConsts-mir-pass`

To prevent regressions our test must cover the code both inside and
outside of the `SingleUseConsts` MIR pass. Use revisions for that.
@rustbot
Copy link
Collaborator

rustbot commented Jan 5, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Enselic Enselic changed the title tests: basic-[debugger-]stepping.rs: Disable SingleUseConsts MIR pass temporarily tests/debuginfo/basic-stepping.rs: Add revisions default-mir-passes, no-SingleUseConsts-mir-pass Jan 5, 2026
@Enselic
Copy link
Member Author

Enselic commented Jan 5, 2026

You are completely right. We need to test both with and without SingleUseConsts to meaningfully prevent regressions.

Now that we have revisions support from #150201 I have added revisions to the test and updated the PR description.

I will investigate what happens if we only apply SingleUseConsts when optimizations are enabled. I’d like to do that before we close #33013, but in the meantime it would be good to land this PR to prevent regressions.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants