-
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.
Enable CopyProp by default, tune the impl a bit
- Loading branch information
Showing
14 changed files
with
248 additions
and
174 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
- // MIR for `f` before CopyProp | ||
+ // MIR for `f` after CopyProp | ||
|
||
fn f(_1: NotCopy) -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/custom_move_arg.rs:+0:19: +0:19 | ||
let mut _2: NotCopy; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL | ||
let mut _3: NotCopy; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL | ||
|
||
bb0: { | ||
- _2 = move _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL | ||
_0 = opaque::<NotCopy>(move _1) -> bb1; // scope 0 at $DIR/custom_move_arg.rs:+3:9: +3:41 | ||
// mir::Constant | ||
// + span: $DIR/custom_move_arg.rs:15:24: 15:30 | ||
// + literal: Const { ty: fn(NotCopy) {opaque::<NotCopy>}, val: Value(<ZST>) } | ||
} | ||
|
||
bb1: { | ||
- _3 = move _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL | ||
- _0 = opaque::<NotCopy>(_3) -> bb2; // scope 0 at $DIR/custom_move_arg.rs:+7:9: +7:35 | ||
+ _0 = opaque::<NotCopy>(_1) -> bb2; // scope 0 at $DIR/custom_move_arg.rs:+7:9: +7:35 | ||
// mir::Constant | ||
// + span: $DIR/custom_move_arg.rs:19:24: 19:30 | ||
// + literal: Const { ty: fn(NotCopy) {opaque::<NotCopy>}, val: Value(<ZST>) } | ||
} | ||
|
||
bb2: { | ||
return; // scope 0 at $DIR/custom_move_arg.rs:+10:9: +10:17 | ||
} | ||
} | ||
|
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,32 @@ | ||
// unit-test: CopyProp | ||
|
||
#![feature(custom_mir, core_intrinsics)] | ||
#![allow(unused_assignments)] | ||
extern crate core; | ||
use core::intrinsics::mir::*; | ||
|
||
struct NotCopy(bool); | ||
|
||
// EMIT_MIR custom_move_arg.f.CopyProp.diff | ||
#[custom_mir(dialect = "analysis", phase = "post-cleanup")] | ||
fn f(_1: NotCopy) { | ||
mir!({ | ||
let _2 = Move(_1); | ||
Call(RET, bb1, opaque(Move(_1))) | ||
} | ||
bb1 = { | ||
let _3 = Move(_2); | ||
Call(RET, bb2, opaque(_3)) | ||
} | ||
bb2 = { | ||
Return() | ||
}) | ||
} | ||
|
||
#[inline(never)] | ||
fn opaque<T>(_t: T) {} | ||
|
||
fn main() { | ||
f(NotCopy(true)); | ||
println!("hi"); | ||
} |
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
Oops, something went wrong.