Skip to content

Add codegen-llvm regression tests #145380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2025
Merged

Conversation

okaneco
Copy link
Contributor

@okaneco okaneco commented Aug 14, 2025

Most of these regressions deal with elimination of panics and bounds checks that were fixed upstream by LLVM.

closes #141497
closes #131162
closes #129583
closes #110971
closes #91109
closes #80075
closes #74917
closes #71997
closes #71257
closes #59352

@rustbot
Copy link
Collaborator

rustbot commented Aug 14, 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 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 Aug 14, 2025
// CHECK-LABEL: @is_inter_or_switch
#[no_mangle]
pub fn is_inter_or_switch(f: FrameType) -> bool {
// CHECK-NOT: ADD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little brittle -- maybe we should check a more specific sequence of instructions? Or some other form of assertion that's not "no adds".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can change this to the specific sequence of checking and-cmp-ret in addition to the check-not.

This was the IR change from that issue, the subtraction being unwanted.

define i1 @src(i8 range(i8 0, 4) %arg) {
-  %add = add nsw i8 %arg, -1
  %and = and i8 %add, -3
  %cmp = icmp eq i8 %and, 0
  ret i1 %cmp
}

#[no_mangle]
pub fn check_no_compare(v: &mut Vec<f32>) {
// CHECK-NOT: icmp
// CHECK-NOT: br
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also seems brittle -- I could see a future compiler making this just call Vec::clear (given that the code sequence is the same for all 4-byte vec values, and maybe even for all T: Copy vec values?).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what to do so I'll back this test out then.

1.29 codegen - https://rust.godbolt.org/z/9qcPPMh67
1.30 codegen - https://rust.godbolt.org/z/7qK1rojYG

@rustbot rustbot 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 Aug 21, 2025
Most of these regressions concern elimination of panics and bounds
checks that were fixed upstream by LLVM.
@okaneco okaneco force-pushed the add-codegen-tests branch from b109232 to 9e28de2 Compare August 21, 2025 02:36
@okaneco
Copy link
Contributor Author

okaneco commented Aug 21, 2025

I removed the vec clear test and that issue from the PR message.
I made the other test an explicit sequence instead of no additions.

@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 Aug 21, 2025
@Mark-Simulacrum
Copy link
Member

@bors r+ rollup=iffy

@bors
Copy link
Collaborator

bors commented Aug 22, 2025

📌 Commit 9e28de2 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 22, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 22, 2025
…Simulacrum

Add codegen-llvm regression tests

Most of these regressions deal with elimination of panics and bounds checks that were fixed upstream by LLVM.

closes rust-lang#141497
closes rust-lang#131162
closes rust-lang#129583
closes rust-lang#110971
closes rust-lang#91109
closes rust-lang#80075
closes rust-lang#74917
closes rust-lang#71997
closes rust-lang#71257
closes rust-lang#59352
bors added a commit that referenced this pull request Aug 23, 2025
Rollup of 20 pull requests

Successful merges:

 - #132087 (Fix overly restrictive lifetime in `core::panic::Location::file` return type)
 - #137396 (Recover `param: Ty = EXPR`)
 - #142185 (Convert moves of references to copies in ReferencePropagation)
 - #144443 (Make target pointer width in target json an integer)
 - #144648 (Implementation: `#[feature(nonpoison_rwlock)]`)
 - #144897 (print raw lifetime idents with r#)
 - #145218 ([Debuginfo] improve enum value formatting in LLDB for better readability)
 - #145380 (Add codegen-llvm regression tests)
 - #145573 (Add an experimental unsafe(force_target_feature) attribute.)
 - #145597 (resolve: Remove `ScopeSet::Late`)
 - #145641 (On E0277, point at type that doesn't implement bound)
 - #145669 (rustdoc-search: GUI tests check for `//` in URL)
 - #145695 (Introduce ProjectionElem::try_map.)
 - #145710 (Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64)
 - #145726 (Experiment: Reborrow trait)
 - #145731 (Make raw pointers work in type-based search)
 - #145736 (triagebot: Update style team reviewers)
 - #145738 (Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures.)
 - #145743 (doc: fix some typos in comment)
 - #145745 (tests: Ignore basic-stepping.rs on LoongArch)

Failed merges:

 - #145670 (port `sanitize` attribute to the new parsing infrastructure)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 23, 2025
Rollup of 28 pull requests

Successful merges:

 - #132087 (Fix overly restrictive lifetime in `core::panic::Location::file` return type)
 - #137396 (Recover `param: Ty = EXPR`)
 - #137457 (Fix host code appearing in Wasm binaries)
 - #142185 (Convert moves of references to copies in ReferencePropagation)
 - #144648 (Implementation: `#[feature(nonpoison_rwlock)]`)
 - #144897 (print raw lifetime idents with r#)
 - #145218 ([Debuginfo] improve enum value formatting in LLDB for better readability)
 - #145380 (Add codegen-llvm regression tests)
 - #145573 (Add an experimental unsafe(force_target_feature) attribute.)
 - #145597 (resolve: Remove `ScopeSet::Late`)
 - #145633 (Fix some typos in LocalKey documentation)
 - #145641 (On E0277, point at type that doesn't implement bound)
 - #145669 (rustdoc-search: GUI tests check for `//` in URL)
 - #145695 (Introduce ProjectionElem::try_map.)
 - #145710 (Fix the ABI parameter inconsistency issue in debug.rs for LoongArch64)
 - #145726 (Experiment: Reborrow trait)
 - #145731 (Make raw pointers work in type-based search)
 - #145736 (triagebot: Update style team reviewers)
 - #145738 (Uplift rustc_mir_transform::coverage::counters::union_find to rustc_data_structures.)
 - #145742 (rustdoc js: Even more typechecking improvments )
 - #145743 (doc: fix some typos in comment)
 - #145745 (tests: Ignore basic-stepping.rs on LoongArch)
 - #145747 (Refactor lint buffering to avoid requiring a giant enum)
 - #145751 (fix(lexer): Allow '-' in the frontmatter infostring continue set)
 - #145761 (Add aarch64_be-unknown-hermit target)
 - #145762 (convert strings to symbols in attr diagnostics)
 - #145763 (Ship LLVM tools for the correct target when cross-compiling)
 - #145765 (Revert suggestions for missing methods in tuples)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f0a4148 into rust-lang:master Aug 23, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 23, 2025
rust-timer added a commit that referenced this pull request Aug 23, 2025
Rollup merge of #145380 - okaneco:add-codegen-tests, r=Mark-Simulacrum

Add codegen-llvm regression tests

Most of these regressions deal with elimination of panics and bounds checks that were fixed upstream by LLVM.

closes #141497
closes #131162
closes #129583
closes #110971
closes #91109
closes #80075
closes #74917
closes #71997
closes #71257
closes #59352
@okaneco okaneco deleted the add-codegen-tests branch August 23, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment