-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #127197 - matthiaskrgr:rollup-aqpvn5q, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #126923 (test: dont optimize to invalid bitcasts) - #127090 (Reduce merge conflicts from rustfmt's wrapping) - #127105 (Only update `Eq` operands in GVN if it can update both sides) - #127150 (Fix x86_64 code being produced for bare-metal LoongArch targets' `compiler_builtins`) - #127181 (Introduce a `rustc_` attribute to dump all the `DefId` parents of a `DefId`) - #127182 (Fix error in documentation for IpAddr::to_canonical and Ipv6Addr::to_canonical) - #127191 (Ensure `out_of_scope_macro_calls` lint is registered) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
20 changed files
with
436 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-abort.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
- // MIR for `remove_casts_must_change_both_sides` before GVN | ||
+ // MIR for `remove_casts_must_change_both_sides` after GVN | ||
|
||
fn remove_casts_must_change_both_sides(_1: &*mut u8, _2: *mut u8) -> bool { | ||
let mut _0: bool; | ||
let mut _3: *const u8; | ||
let mut _4: *const u8; | ||
|
||
bb0: { | ||
_3 = (*_1) as *const u8 (PtrToPtr); | ||
_4 = _2 as *const u8 (PtrToPtr); | ||
_0 = Eq(_3, _4); | ||
return; | ||
} | ||
} | ||
|
16 changes: 16 additions & 0 deletions
16
tests/mir-opt/gvn.remove_casts_must_change_both_sides.GVN.panic-unwind.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
- // MIR for `remove_casts_must_change_both_sides` before GVN | ||
+ // MIR for `remove_casts_must_change_both_sides` after GVN | ||
|
||
fn remove_casts_must_change_both_sides(_1: &*mut u8, _2: *mut u8) -> bool { | ||
let mut _0: bool; | ||
let mut _3: *const u8; | ||
let mut _4: *const u8; | ||
|
||
bb0: { | ||
_3 = (*_1) as *const u8 (PtrToPtr); | ||
_4 = _2 as *const u8 (PtrToPtr); | ||
_0 = Eq(_3, _4); | ||
return; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
- // MIR for `main` before GVN | ||
+ // MIR for `main` after GVN | ||
|
||
fn main() -> () { | ||
let mut _0: (); | ||
let _1: bool; | ||
let mut _2: *mut u8; | ||
scope 1 (inlined dangling_mut::<u8>) { | ||
let mut _3: usize; | ||
scope 2 (inlined align_of::<u8>) { | ||
} | ||
scope 3 (inlined without_provenance_mut::<u8>) { | ||
} | ||
} | ||
scope 4 (inlined Foo::<u8>::cmp_ptr) { | ||
let mut _4: *const u8; | ||
let mut _5: *mut u8; | ||
let mut _6: *const u8; | ||
scope 5 (inlined std::ptr::eq::<u8>) { | ||
} | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); | ||
StorageLive(_2); | ||
StorageLive(_3); | ||
- _3 = AlignOf(u8); | ||
- _2 = _3 as *mut u8 (Transmute); | ||
+ _3 = const 1_usize; | ||
+ _2 = const {0x1 as *mut u8}; | ||
StorageDead(_3); | ||
StorageLive(_4); | ||
StorageLive(_5); | ||
- _5 = _2; | ||
- _4 = _2 as *const u8 (PtrToPtr); | ||
+ _5 = const {0x1 as *mut u8}; | ||
+ _4 = const {0x1 as *const u8}; | ||
StorageDead(_5); | ||
StorageLive(_6); | ||
- _6 = const Foo::<u8>::SENTINEL as *const u8 (PtrToPtr); | ||
- _1 = Eq(_4, _6); | ||
+ _6 = const {0x1 as *const u8}; | ||
+ _1 = const true; | ||
StorageDead(_6); | ||
StorageDead(_4); | ||
StorageDead(_2); | ||
StorageDead(_1); | ||
_0 = const (); | ||
return; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// skip-filecheck | ||
//@ test-mir-pass: GVN | ||
//@ only-64bit | ||
//@ compile-flags: -Z mir-enable-passes=+Inline | ||
|
||
// Regression for <https://github.com/rust-lang/rust/issues/127089> | ||
|
||
#![feature(strict_provenance)] | ||
|
||
struct Foo<T>(std::marker::PhantomData<T>); | ||
|
||
impl<T> Foo<T> { | ||
const SENTINEL: *mut T = std::ptr::dangling_mut(); | ||
|
||
fn cmp_ptr(a: *mut T) -> bool { | ||
std::ptr::eq(a, Self::SENTINEL) | ||
} | ||
} | ||
|
||
// EMIT_MIR gvn_ptr_eq_with_constant.main.GVN.diff | ||
pub fn main() { | ||
Foo::<u8>::cmp_ptr(std::ptr::dangling_mut()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//@ normalize-stderr-test "DefId\(.+?\)" -> "DefId(..)" | ||
#![feature(rustc_attrs)] | ||
|
||
fn bar() { | ||
fn foo() { | ||
fn baz() { | ||
#[rustc_dump_def_parents] | ||
|| { | ||
//~^ ERROR: rustc_dump_def_parents: DefId | ||
qux::< | ||
{ | ||
//~^ ERROR: rustc_dump_def_parents: DefId | ||
fn inhibits_dump() { | ||
qux::< | ||
{ | ||
"hi"; | ||
1 | ||
}, | ||
>(); | ||
} | ||
|
||
qux::<{ 1 + 1 }>(); | ||
//~^ ERROR: rustc_dump_def_parents: DefId | ||
1 | ||
}, | ||
>(); | ||
}; | ||
} | ||
} | ||
} | ||
|
||
const fn qux<const N: usize>() {} | ||
|
||
fn main() {} |
Oops, something went wrong.