Skip to content

Canonicalize more comparison operators - #165221

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
mu001999-contrib:canonicalize-more-comparisons
Nov 13, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
mu001999-contrib:canonicalize-more-comparisons

Conversation

@mu001999

Copy link
Copy Markdown
Member

As a follow-up PR to #163373 (comment)

r? dianqk

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 31, 2026
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 31, 2026
@rustbot

rustbot commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

dianqk is currently at their maximum review capacity.
They may take a while to respond.

StorageLive(_7);
_7 = PtrMetadata(copy _1);
_8 = Le(copy _4, move _7);
_8 = Ge(move _7, copy _4);

@mu001999 mu001999 Oct 31, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is because ReorderLocals

View changes since the review

@rust-log-analyzer

This comment has been minimized.

@mu001999
mu001999 force-pushed the canonicalize-more-comparisons branch from 2a9a24f to 700179f Compare October 31, 2026 07:38
@mu001999
mu001999 marked this pull request as ready for review October 31, 2026 13:47
@rustbot

rustbot commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@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 Oct 31, 2026

@dianqk dianqk left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. r=me
Please check whether the tests need to be blessed again.

View changes since this review

@mu001999
mu001999 force-pushed the canonicalize-more-comparisons branch from 700179f to fe65b69 Compare November 12, 2026 15:00
@rustbot

rustbot commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

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.

@dianqk

dianqk commented Nov 12, 2026

Copy link
Copy Markdown
Member

Can you reproduce tests/mir-opt/pre-codegen/slice_iter.range_loop.runtime-optimized.after.panic-abort.mir?

diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.runtime-optimized.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.runtime-optimized.after.panic-abort.mir
index e817d9cd872..0fbeca458f4 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.runtime-optimized.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.runtime-optimized.after.panic-abort.mir
@@ -56,7 +56,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
         StorageLive(_6);
         StorageLive(_5);
         _5 = copy _4;
-        _6 = Lt(move _5, copy _3);
+        _6 = Gt(copy _3, move _5);
         StorageDead(_5);
         switchInt(move _6) -> [0: bb2, otherwise: bb4];
     }
@@ -81,7 +81,7 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
         StorageLive(_9);
         _9 = copy ((_8 as Some).0: usize);
         StorageLive(_11);
-        _10 = Lt(copy _9, copy _3);
+        _10 = Gt(copy _3, copy _9);
         assert(move _10, "index out of bounds: the length is {} but the index is {}", copy _3, copy _9) -> [success: bb5, unwind unreachable];
     }

@mu001999
mu001999 force-pushed the canonicalize-more-comparisons branch from fe65b69 to 3406af2 Compare November 12, 2026 15:56
@dianqk

dianqk commented Nov 12, 2026

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 3406af2 has been approved by dianqk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Nov 12, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 12, 2026
…-comparisons, r=dianqk

Canonicalize more comparison operators

As a follow-up PR to rust-lang#163373 (comment)

r? dianqk
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #164707 (Re-enable rustc profile generation for static linked llvm on Windows x64 builds )
 - #165221 (Canonicalize more comparison operators)
 - #165880 (Remove dead code for returning `BackendRepr::Memory` with `PassMode::Direct`)
 - #164108 (Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`)
 - #165565 (view-types: lower view types from HIR)
 - #165771 (tests: cover MSVC ThinLTO exported symbol preservation)
 - #165810 (reflection: reflect attributes from adts, fields, and variants)
 - #165823 (Tweak crate error wording and turn them into fatal errors)
 - #165849 (More opt-dist improvements)
 - #165855 (Update `sysinfo` version to `0.40.3`)
 - #165861 (cg_llvm: Use an invariant lifetime brand for LLVM attributes)
 - #165872 (Some attribute related cleanups)
@Zalathar

Copy link
Copy Markdown
Member

@bors r-
@bors try jobs=test-various

@rust-bors rust-bors Bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 13, 2026
@rust-bors

rust-bors Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#165891), which was unapproved.

View changes since this unapproval

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
…s, r=<try>

Canonicalize more comparison operators


try-job: test-various
@rust-bors

rust-bors Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 50de34e failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@mu001999
mu001999 force-pushed the canonicalize-more-comparisons branch from 3406af2 to cac2cbf Compare November 13, 2026 05:29
@mu001999

Copy link
Copy Markdown
Member Author

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
…s, r=<try>

Canonicalize more comparison operators


try-job: test-various
@rust-bors

rust-bors Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a1e636e (a1e636e1547323956a7c64011b41ee233ba7a537)
Base parent: 8eb778d (8eb778d04094d3af4b26580cab327e0413eb1e02)

@mu001999

Copy link
Copy Markdown
Member Author

@bors r=dianqk

@rust-bors

rust-bors Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit cac2cbf has been approved by dianqk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 13, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 13, 2026
…-comparisons, r=dianqk

Canonicalize more comparison operators

As a follow-up PR to rust-lang#163373 (comment)

r? dianqk
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
…uwer

Rollup of 18 pull requests

Successful merges:

 - #164828 (When suggesting path of renamed crate, use the renamed name)
 - #164864 (Avoid hoisting uninitialized reads in EarlyOtherwiseBranch)
 - #165068 (Change color usage for highlights)
 - #165221 (Canonicalize more comparison operators)
 - #165841 (Tell Miri about the alignment handling in the Windows System allocator)
 - #165869 (Cleanup: Remove `path_matches` and `value_str` from `AttributeExt`)
 - #165880 (Remove dead code for returning `BackendRepr::Memory` with `PassMode::Direct`)
 - #164108 (Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`)
 - #165565 (view-types: lower view types from HIR)
 - #165622 (small cleanups in rustc_codegen_llvm)
 - #165745 (Don't ICE when a guard condition is a place of type `!`)
 - #165771 (tests: cover MSVC ThinLTO exported symbol preservation)
 - #165810 (reflection: reflect attributes from adts, fields, and variants)
 - #165823 (Tweak crate error wording and turn them into fatal errors)
 - #165849 (More opt-dist improvements)
 - #165855 (Update `sysinfo` version to `0.40.3`)
 - #165872 (Some attribute related cleanups)
 - #165905 (CI: Use a consistent locale when sorting docker build inputs)
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - #164828 (When suggesting path of renamed crate, use the renamed name)
 - #164864 (Avoid hoisting uninitialized reads in EarlyOtherwiseBranch)
 - #165068 (Change color usage for highlights)
 - #165221 (Canonicalize more comparison operators)
 - #165841 (Tell Miri about the alignment handling in the Windows System allocator)
 - #165869 (Cleanup: Remove `path_matches` and `value_str` from `AttributeExt`)
 - #165880 (Remove dead code for returning `BackendRepr::Memory` with `PassMode::Direct`)
 - #164108 (Add unstable `-Zllvm-tpde` flag to `rustc_codegen_llvm`)
 - #165565 (view-types: lower view types from HIR)
 - #165622 (small cleanups in rustc_codegen_llvm)
 - #165771 (tests: cover MSVC ThinLTO exported symbol preservation)
 - #165810 (reflection: reflect attributes from adts, fields, and variants)
 - #165823 (Tweak crate error wording and turn them into fatal errors)
 - #165849 (More opt-dist improvements)
 - #165855 (Update `sysinfo` version to `0.40.3`)
 - #165872 (Some attribute related cleanups)
 - #165905 (CI: Use a consistent locale when sorting docker build inputs)
@rust-bors
rust-bors Bot merged commit 1c0d284 into rust-lang:main Nov 13, 2026
15 checks passed
rust-bors Bot pushed a commit that referenced this pull request Nov 13, 2026
Rollup merge of #165221 - mu001999-contrib:canonicalize-more-comparisons, r=dianqk

Canonicalize more comparison operators

As a follow-up PR to #163373 (comment)

r? dianqk
@rustbot rustbot added this to the 1.102.0 milestone Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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