Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a6dccfeb
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a6dccfeb
编写于
10月 03, 2020
作者:
S
Simon Vandel Sillesen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
New mir-opt pass to simplify gotos with const values
Fixes #77355
上级
15598a83
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
652 addition
and
374 deletion
+652
-374
compiler/rustc_middle/src/mir/mod.rs
compiler/rustc_middle/src/mir/mod.rs
+8
-1
compiler/rustc_middle/src/mir/terminator.rs
compiler/rustc_middle/src/mir/terminator.rs
+16
-0
compiler/rustc_mir/src/interpret/operand.rs
compiler/rustc_mir/src/interpret/operand.rs
+1
-0
compiler/rustc_mir/src/transform/const_goto.rs
compiler/rustc_mir/src/transform/const_goto.rs
+122
-0
compiler/rustc_mir/src/transform/mod.rs
compiler/rustc_mir/src/transform/mod.rs
+2
-0
compiler/rustc_mir/src/transform/simplify.rs
compiler/rustc_mir/src/transform/simplify.rs
+20
-17
compiler/rustc_mir/src/transform/simplify_comparison_integral.rs
...r/rustc_mir/src/transform/simplify_comparison_integral.rs
+1
-1
src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff
src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff
+52
-0
src/test/mir-opt/const_goto.rs
src/test/mir-opt/const_goto.rs
+16
-0
src/test/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff
src/test/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff
+51
-0
src/test/mir-opt/const_goto_const_eval_fail.rs
src/test/mir-opt/const_goto_const_eval_fail.rs
+16
-0
src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff
..._reduce_branches.bar.MatchBranchSimplification.32bit.diff
+59
-59
src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff
..._reduce_branches.bar.MatchBranchSimplification.64bit.diff
+59
-59
src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff
..._reduce_branches.foo.MatchBranchSimplification.32bit.diff
+13
-34
src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff
..._reduce_branches.foo.MatchBranchSimplification.64bit.diff
+13
-34
src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.32bit.mir
...t/matches_reduce_branches.foo.PreCodegen.before.32bit.mir
+21
-0
src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir
...t/matches_reduce_branches.foo.PreCodegen.before.64bit.mir
+21
-0
src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff
...ches.match_nested_if.MatchBranchSimplification.32bit.diff
+64
-64
src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff
...ches.match_nested_if.MatchBranchSimplification.64bit.diff
+64
-64
src/test/mir-opt/matches_reduce_branches.rs
src/test/mir-opt/matches_reduce_branches.rs
+14
-6
src/test/mir-opt/not_equal_false.opt.InstCombine.diff
src/test/mir-opt/not_equal_false.opt.InstCombine.diff
+16
-32
src/test/mir-opt/not_equal_false.rs
src/test/mir-opt/not_equal_false.rs
+3
-3
未找到文件。
compiler/rustc_middle/src/mir/mod.rs
浏览文件 @
a6dccfeb
...
...
@@ -1518,7 +1518,14 @@ pub enum StatementKind<'tcx> {
}
impl
<
'tcx
>
StatementKind
<
'tcx
>
{
pub
fn
as_assign_mut
(
&
mut
self
)
->
Option
<&
mut
Box
<
(
Place
<
'tcx
>
,
Rvalue
<
'tcx
>
)
>>
{
pub
fn
as_assign_mut
(
&
mut
self
)
->
Option
<&
mut
(
Place
<
'tcx
>
,
Rvalue
<
'tcx
>
)
>
{
match
self
{
StatementKind
::
Assign
(
x
)
=>
Some
(
x
),
_
=>
None
,
}
}
pub
fn
as_assign
(
&
self
)
->
Option
<&
(
Place
<
'tcx
>
,
Rvalue
<
'tcx
>
)
>
{
match
self
{
StatementKind
::
Assign
(
x
)
=>
Some
(
x
),
_
=>
None
,
...
...
compiler/rustc_middle/src/mir/terminator.rs
浏览文件 @
a6dccfeb
...
...
@@ -407,6 +407,22 @@ pub fn unwind_mut(&mut self) -> Option<&mut Option<BasicBlock>> {
|
TerminatorKind
::
FalseUnwind
{
ref
mut
unwind
,
..
}
=>
Some
(
unwind
),
}
}
pub
fn
as_switch
(
&
self
)
->
Option
<
(
&
Operand
<
'tcx
>
,
Ty
<
'tcx
>
,
&
SwitchTargets
)
>
{
match
self
{
TerminatorKind
::
SwitchInt
{
discr
,
switch_ty
,
targets
}
=>
{
Some
((
discr
,
switch_ty
,
targets
))
}
_
=>
None
,
}
}
pub
fn
as_goto
(
&
self
)
->
Option
<
BasicBlock
>
{
match
self
{
TerminatorKind
::
Goto
{
target
}
=>
Some
(
*
target
),
_
=>
None
,
}
}
}
impl
<
'tcx
>
Debug
for
TerminatorKind
<
'tcx
>
{
...
...
compiler/rustc_mir/src/interpret/operand.rs
浏览文件 @
a6dccfeb
...
...
@@ -514,6 +514,7 @@ pub fn eval_place_to_op(
/// Evaluate the operand, returning a place where you can then find the data.
/// If you already know the layout, you can save two table lookups
/// by passing it in here.
#[inline]
pub
fn
eval_operand
(
&
self
,
mir_op
:
&
mir
::
Operand
<
'tcx
>
,
...
...
compiler/rustc_mir/src/transform/const_goto.rs
0 → 100644
浏览文件 @
a6dccfeb
//! This pass optimizes the following sequence
//! ```rust,ignore (example)
//! bb2: {
//! _2 = const true;
//! goto -> bb3;
//! }
//!
//! bb3: {
//! switchInt(_2) -> [false: bb4, otherwise: bb5];
//! }
//! ```
//! into
//! ```rust,ignore (example)
//! bb2: {
//! _2 = const true;
//! goto -> bb5;
//! }
//! ```
use
crate
::
transform
::
MirPass
;
use
rustc_middle
::
mir
::
*
;
use
rustc_middle
::
ty
::
TyCtxt
;
use
rustc_middle
::{
mir
::
visit
::
Visitor
,
ty
::
ParamEnv
};
use
super
::
simplify
::{
simplify_cfg
,
simplify_locals
};
pub
struct
ConstGoto
;
impl
<
'tcx
>
MirPass
<
'tcx
>
for
ConstGoto
{
fn
run_pass
(
&
self
,
tcx
:
TyCtxt
<
'tcx
>
,
body
:
&
mut
Body
<
'tcx
>
)
{
if
tcx
.sess.opts.debugging_opts.mir_opt_level
<
3
{
return
;
}
trace!
(
"Running ConstGoto on {:?}"
,
body
.source
);
let
param_env
=
tcx
.param_env_reveal_all_normalized
(
body
.source
.def_id
());
let
mut
opt_finder
=
ConstGotoOptimizationFinder
{
tcx
,
body
,
optimizations
:
vec!
[],
param_env
};
opt_finder
.visit_body
(
body
);
let
should_simplify
=
!
opt_finder
.optimizations
.is_empty
();
for
opt
in
opt_finder
.optimizations
{
let
terminator
=
body
.basic_blocks_mut
()[
opt
.bb_with_goto
]
.terminator_mut
();
let
new_goto
=
TerminatorKind
::
Goto
{
target
:
opt
.target_to_use_in_goto
};
debug!
(
"SUCCESS: replacing `{:?}` with `{:?}`"
,
terminator
.kind
,
new_goto
);
terminator
.kind
=
new_goto
;
}
// if we applied optimizations, we potentially have some cfg to cleanup to
// make it easier for further passes
if
should_simplify
{
simplify_cfg
(
body
);
simplify_locals
(
body
,
tcx
);
}
}
}
impl
<
'a
,
'tcx
>
Visitor
<
'tcx
>
for
ConstGotoOptimizationFinder
<
'a
,
'tcx
>
{
fn
visit_terminator
(
&
mut
self
,
terminator
:
&
Terminator
<
'tcx
>
,
location
:
Location
)
{
let
_
:
Option
<
_
>
=
try
{
let
target
=
terminator
.kind
.as_goto
()
?
;
// We only apply this optimization if the last statement is a const assignment
let
last_statement
=
self
.body
.basic_blocks
()[
location
.block
]
.statements
.last
()
?
;
if
let
(
place
,
Rvalue
::
Use
(
Operand
::
Constant
(
_
const
)))
=
last_statement
.kind
.as_assign
()
?
{
// We found a constant being assigned to `place`.
// Now check that the target of this Goto switches on this place.
let
target_bb
=
&
self
.body
.basic_blocks
()[
target
];
// FIXME(simonvandel): We are conservative here when we don't allow
// any statements in the target basic block.
// This could probably be relaxed to allow `StorageDead`s which could be
// copied to the predecessor of this block.
if
!
target_bb
.statements
.is_empty
()
{
None
?
}
let
target_bb_terminator
=
target_bb
.terminator
();
let
(
discr
,
switch_ty
,
targets
)
=
target_bb_terminator
.kind
.as_switch
()
?
;
if
discr
.place
()
==
Some
(
*
place
)
{
// We now know that the Switch matches on the const place, and it is statementless
// Now find which value in the Switch matches the const value.
let
const_value
=
_
const
.literal
.try_eval_bits
(
self
.tcx
,
self
.param_env
,
switch_ty
)
?
;
let
found_value_idx_option
=
targets
.iter
()
.enumerate
()
.find
(|(
_
,
(
value
,
_
))|
const_value
==
*
value
)
.map
(|(
idx
,
_
)|
idx
);
let
target_to_use_in_goto
=
if
let
Some
(
found_value_idx
)
=
found_value_idx_option
{
targets
.iter
()
.nth
(
found_value_idx
)
.unwrap
()
.1
}
else
{
// If we did not find the const value in values, it must be the otherwise case
targets
.otherwise
()
};
self
.optimizations
.push
(
OptimizationToApply
{
bb_with_goto
:
location
.block
,
target_to_use_in_goto
,
});
}
}
Some
(())
};
self
.super_terminator
(
terminator
,
location
);
}
}
struct
OptimizationToApply
{
bb_with_goto
:
BasicBlock
,
target_to_use_in_goto
:
BasicBlock
,
}
pub
struct
ConstGotoOptimizationFinder
<
'a
,
'tcx
>
{
tcx
:
TyCtxt
<
'tcx
>
,
body
:
&
'a
Body
<
'tcx
>
,
param_env
:
ParamEnv
<
'tcx
>
,
optimizations
:
Vec
<
OptimizationToApply
>
,
}
compiler/rustc_mir/src/transform/mod.rs
浏览文件 @
a6dccfeb
...
...
@@ -22,6 +22,7 @@
pub
mod
check_unsafety
;
pub
mod
cleanup_post_borrowck
;
pub
mod
const_debuginfo
;
pub
mod
const_goto
;
pub
mod
const_prop
;
pub
mod
coverage
;
pub
mod
deaggregator
;
...
...
@@ -492,6 +493,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
// The main optimizations that we do on MIR.
let
optimizations
:
&
[
&
dyn
MirPass
<
'tcx
>
]
=
&
[
&
const_goto
::
ConstGoto
,
&
remove_unneeded_drops
::
RemoveUnneededDrops
,
&
match_branches
::
MatchBranchSimplification
,
// inst combine is after MatchBranchSimplification to clean up Ne(_1, false)
...
...
compiler/rustc_mir/src/transform/simplify.rs
浏览文件 @
a6dccfeb
...
...
@@ -320,28 +320,31 @@ pub fn remove_dead_blocks(body: &mut Body<'_>) {
impl
<
'tcx
>
MirPass
<
'tcx
>
for
SimplifyLocals
{
fn
run_pass
(
&
self
,
tcx
:
TyCtxt
<
'tcx
>
,
body
:
&
mut
Body
<
'tcx
>
)
{
trace!
(
"running SimplifyLocals on {:?}"
,
body
.source
);
simplify_locals
(
body
,
tcx
);
}
}
// First, we're going to get a count of *actual* uses for every `Local`.
let
mut
used_locals
=
UsedLocals
::
new
(
body
);
pub
fn
simplify_locals
<
'tcx
>
(
body
:
&
mut
Body
<
'tcx
>
,
tcx
:
TyCtxt
<
'tcx
>
)
{
// First, we're going to get a count of *actual* uses for every `Local`.
let
mut
used_locals
=
UsedLocals
::
new
(
body
);
// Next, we're going to remove any `Local` with zero actual uses. When we remove those
// `Locals`, we're also going to subtract any uses of other `Locals` from the `used_locals`
// count. For example, if we removed `_2 = discriminant(_1)`, then we'll subtract one from
// `use_counts[_1]`. That in turn might make `_1` unused, so we loop until we hit a
// fixedpoint where there are no more unused locals.
remove_unused_definitions
(
&
mut
used_locals
,
body
);
// Next, we're going to remove any `Local` with zero actual uses. When we remove those
// `Locals`, we're also going to subtract any uses of other `Locals` from the `used_locals`
// count. For example, if we removed `_2 = discriminant(_1)`, then we'll subtract one from
// `use_counts[_1]`. That in turn might make `_1` unused, so we loop until we hit a
// fixedpoint where there are no more unused locals.
remove_unused_definitions
(
&
mut
used_locals
,
body
);
// Finally, we'll actually do the work of shrinking `body.local_decls` and remapping the `Local`s.
let
map
=
make_local_map
(
&
mut
body
.local_decls
,
&
used_locals
);
// Finally, we'll actually do the work of shrinking `body.local_decls` and remapping the `Local`s.
let
map
=
make_local_map
(
&
mut
body
.local_decls
,
&
used_locals
);
// Only bother running the `LocalUpdater` if we actually found locals to remove.
if
map
.iter
()
.any
(
Option
::
is_none
)
{
// Update references to all vars and tmps now
let
mut
updater
=
LocalUpdater
{
map
,
tcx
};
updater
.visit_body
(
body
);
// Only bother running the `LocalUpdater` if we actually found locals to remove.
if
map
.iter
()
.any
(
Option
::
is_none
)
{
// Update references to all vars and tmps now
let
mut
updater
=
LocalUpdater
{
map
,
tcx
};
updater
.visit_body
(
body
);
body
.local_decls
.shrink_to_fit
();
}
body
.local_decls
.shrink_to_fit
();
}
}
...
...
compiler/rustc_mir/src/transform/simplify_comparison_integral.rs
浏览文件 @
a6dccfeb
...
...
@@ -80,7 +80,7 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
// we convert the move in the comparison statement to a copy.
// unwrap is safe as we know this statement is an assign
let
box
(
_
,
rhs
)
=
bb
.statements
[
opt
.bin_op_stmt_idx
]
.kind
.as_assign_mut
()
.unwrap
();
let
(
_
,
rhs
)
=
bb
.statements
[
opt
.bin_op_stmt_idx
]
.kind
.as_assign_mut
()
.unwrap
();
use
Operand
::
*
;
match
rhs
{
...
...
src/test/mir-opt/const_goto.issue_77355_opt.ConstGoto.diff
0 → 100644
浏览文件 @
a6dccfeb
- // MIR for `issue_77355_opt` before ConstGoto
+ // MIR for `issue_77355_opt` after ConstGoto
fn issue_77355_opt(_1: Foo) -> u64 {
debug num => _1; // in scope 0 at $DIR/const_goto.rs:11:20: 11:23
let mut _0: u64; // return place in scope 0 at $DIR/const_goto.rs:11:33: 11:36
- let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- let mut _3: isize; // in scope 0 at $DIR/const_goto.rs:12:22: 12:28
+ let mut _2: isize; // in scope 0 at $DIR/const_goto.rs:12:22: 12:28
bb0: {
- StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- _3 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:12:22: 12:28
- switchInt(move _3) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto.rs:12:22: 12:28
+ _2 = discriminant(_1); // scope 0 at $DIR/const_goto.rs:12:22: 12:28
+ switchInt(move _2) -> [1_isize: bb2, 2_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto.rs:12:22: 12:28
}
bb1: {
- _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+ _0 = const 42_u64; // scope 0 at $DIR/const_goto.rs:12:53: 12:55
+ goto -> bb3; // scope 0 at $DIR/const_goto.rs:12:5: 12:57
}
bb2: {
- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb3: {
- switchInt(move _2) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto.rs:12:5: 12:57
- }
-
- bb4: {
_0 = const 23_u64; // scope 0 at $DIR/const_goto.rs:12:41: 12:43
- goto -> bb6; // scope 0 at $DIR/const_goto.rs:12:5: 12:57
+ goto -> bb3; // scope 0 at $DIR/const_goto.rs:12:5: 12:57
}
- bb5: {
- _0 = const 42_u64; // scope 0 at $DIR/const_goto.rs:12:53: 12:55
- goto -> bb6; // scope 0 at $DIR/const_goto.rs:12:5: 12:57
- }
-
- bb6: {
- StorageDead(_2); // scope 0 at $DIR/const_goto.rs:12:56: 12:57
+ bb3: {
return; // scope 0 at $DIR/const_goto.rs:13:2: 13:2
}
}
src/test/mir-opt/const_goto.rs
0 → 100644
浏览文件 @
a6dccfeb
pub
enum
Foo
{
A
,
B
,
C
,
D
,
E
,
F
,
}
// EMIT_MIR const_goto.issue_77355_opt.ConstGoto.diff
fn
issue_77355_opt
(
num
:
Foo
)
->
u64
{
if
matches!
(
num
,
Foo
::
B
|
Foo
::
C
)
{
23
}
else
{
42
}
}
fn
main
()
{
issue_77355_opt
(
Foo
::
A
);
}
src/test/mir-opt/const_goto_const_eval_fail.f.ConstGoto.diff
0 → 100644
浏览文件 @
a6dccfeb
- // MIR for `f` before ConstGoto
+ // MIR for `f` after ConstGoto
fn f() -> u64 {
let mut _0: u64; // return place in scope 0 at $DIR/const_goto_const_eval_fail.rs:6:44: 6:47
let mut _1: bool; // in scope 0 at $DIR/const_goto_const_eval_fail.rs:7:11: 12:6
let mut _2: i32; // in scope 0 at $DIR/const_goto_const_eval_fail.rs:8:15: 8:16
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_goto_const_eval_fail.rs:7:11: 12:6
StorageLive(_2); // scope 0 at $DIR/const_goto_const_eval_fail.rs:8:15: 8:16
_2 = const A; // scope 0 at $DIR/const_goto_const_eval_fail.rs:8:15: 8:16
switchInt(_2) -> [1_i32: bb2, 2_i32: bb2, 3_i32: bb2, otherwise: bb1]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:9:13: 9:14
}
bb1: {
_1 = const true; // scope 0 at $DIR/const_goto_const_eval_fail.rs:10:18: 10:22
goto -> bb3; // scope 0 at $DIR/const_goto_const_eval_fail.rs:8:9: 11:10
}
bb2: {
_1 = const B; // scope 0 at $DIR/const_goto_const_eval_fail.rs:9:26: 9:27
- goto -> bb3; // scope 0 at $DIR/const_goto_const_eval_fail.rs:8:9: 11:10
+ switchInt(_1) -> [false: bb4, otherwise: bb3]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:13:9: 13:14
}
bb3: {
- switchInt(_1) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/const_goto_const_eval_fail.rs:13:9: 13:14
- }
-
- bb4: {
_0 = const 2_u64; // scope 0 at $DIR/const_goto_const_eval_fail.rs:14:17: 14:18
- goto -> bb6; // scope 0 at $DIR/const_goto_const_eval_fail.rs:7:5: 15:6
+ goto -> bb5; // scope 0 at $DIR/const_goto_const_eval_fail.rs:7:5: 15:6
}
- bb5: {
+ bb4: {
_0 = const 1_u64; // scope 0 at $DIR/const_goto_const_eval_fail.rs:13:18: 13:19
- goto -> bb6; // scope 0 at $DIR/const_goto_const_eval_fail.rs:7:5: 15:6
+ goto -> bb5; // scope 0 at $DIR/const_goto_const_eval_fail.rs:7:5: 15:6
}
- bb6: {
+ bb5: {
StorageDead(_2); // scope 0 at $DIR/const_goto_const_eval_fail.rs:16:1: 16:2
StorageDead(_1); // scope 0 at $DIR/const_goto_const_eval_fail.rs:16:1: 16:2
return; // scope 0 at $DIR/const_goto_const_eval_fail.rs:16:2: 16:2
}
}
src/test/mir-opt/const_goto_const_eval_fail.rs
0 → 100644
浏览文件 @
a6dccfeb
#![feature(min_const_generics)]
#![crate_type
=
"lib"
]
// If const eval fails, then don't crash
// EMIT_MIR const_goto_const_eval_fail.f.ConstGoto.diff
pub
fn
f
<
const
A
:
i32
,
const
B
:
bool
>
()
->
u64
{
match
{
match
A
{
1
|
2
|
3
=>
B
,
_
=>
true
,
}
}
{
false
=>
1
,
true
=>
2
,
}
}
src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.32bit.diff
浏览文件 @
a6dccfeb
...
...
@@ -2,84 +2,84 @@
+ // MIR for `bar` after MatchBranchSimplification
fn bar(_1: i32) -> (bool, bool, bool, bool) {
debug i => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:1
2:8: 12
:9
let mut _0: (bool, bool, bool, bool); // return place in scope 0 at $DIR/matches_reduce_branches.rs:1
2:19: 12
:43
let _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:1
3:9: 13
:10
let _6: (); // in scope 0 at $DIR/matches_reduce_branches.rs:1
8:5: 33
:6
let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
5:6: 35
:7
let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
5:9: 35
:10
let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
5:12: 35
:13
let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
5:15: 35
:16
+ let mut _11: i32; // in scope 0 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
debug i => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:1
3:8: 13
:9
let mut _0: (bool, bool, bool, bool); // return place in scope 0 at $DIR/matches_reduce_branches.rs:1
3:19: 13
:43
let _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
let _6: (); // in scope 0 at $DIR/matches_reduce_branches.rs:1
9:5: 34
:6
let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
6:6: 36
:7
let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
6:9: 36
:10
let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
6:12: 36
:13
let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
6:15: 36
:16
+ let mut _11: i32; // in scope 0 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
scope 1 {
debug a => _2; // in scope 1 at $DIR/matches_reduce_branches.rs:1
3:9: 13
:10
let _3: bool; // in scope 1 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
debug a => _2; // in scope 1 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
let _3: bool; // in scope 1 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
scope 2 {
debug b => _3; // in scope 2 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
let _4: bool; // in scope 2 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
debug b => _3; // in scope 2 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
let _4: bool; // in scope 2 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
scope 3 {
debug c => _4; // in scope 3 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
let _5: bool; // in scope 3 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
debug c => _4; // in scope 3 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
let _5: bool; // in scope 3 at $DIR/matches_reduce_branches.rs:1
7:9: 17
:10
scope 4 {
debug d => _5; // in scope 4 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
debug d => _5; // in scope 4 at $DIR/matches_reduce_branches.rs:1
7:9: 17
:10
}
}
}
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:1
3:9: 13
:10
StorageLive(_3); // scope 1 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
StorageLive(_4); // scope 2 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
StorageLive(_5); // scope 3 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
StorageLive(_6); // scope 4 at $DIR/matches_reduce_branches.rs:1
8:5: 33
:6
- switchInt(_1) -> [7_i32: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
StorageLive(_3); // scope 1 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
StorageLive(_4); // scope 2 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
StorageLive(_5); // scope 3 at $DIR/matches_reduce_branches.rs:1
7:9: 17
:10
StorageLive(_6); // scope 4 at $DIR/matches_reduce_branches.rs:1
9:5: 34
:6
- switchInt(_1) -> [7_i32: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
- }
-
- bb1: {
- _2 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
7:13: 27
:21
- _3 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
8:13: 28
:22
- _4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:
29:13: 29
:22
- _5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:3
0:13: 30
:21
- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:1
8:5: 33
:6
- _2 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
8:13: 28
:21
- _3 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
9:13: 29
:22
- _4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:
30:13: 30
:22
- _5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:3
1:13: 31
:21
- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:1
9:5: 34
:6
- }
-
- bb2: {
- _2 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
0:13: 20
:22
- _3 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
1:13: 21
:21
+ StorageLive(_11); // scope 4 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
+ _11 = _1; // scope 4 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
+ _2 = Ne(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:2
0:13: 20
:22
+ _3 = Eq(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:2
1:13: 21
:21
_4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
2:13: 22
:22
_5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
3:13: 23
:21
- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:1
8:5: 33
:6
- _2 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
1:13: 21
:22
- _3 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
2:13: 22
:21
+ StorageLive(_11); // scope 4 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
+ _11 = _1; // scope 4 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
+ _2 = Ne(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:2
1:13: 21
:22
+ _3 = Eq(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:2
2:13: 22
:21
_4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
3:13: 23
:22
_5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
4:13: 24
:21
- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:1
9:5: 34
:6
- }
-
- bb3: {
+ StorageDead(_11); // scope 4 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
StorageDead(_6); // scope 4 at $DIR/matches_reduce_branches.rs:3
3:6: 33
:7
StorageLive(_7); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:6: 35
:7
_7 = _2; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:6: 35
:7
StorageLive(_8); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:9: 35
:10
_8 = _3; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:9: 35
:10
StorageLive(_9); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:12: 35
:13
_9 = _4; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:12: 35
:13
StorageLive(_10); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:15: 35
:16
_10 = _5; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:15: 35
:16
(_0.0: bool) = move _7; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:5: 35
:17
(_0.1: bool) = move _8; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:5: 35
:17
(_0.2: bool) = move _9; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:5: 35
:17
(_0.3: bool) = move _10; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:5: 35
:17
StorageDead(_10); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:16: 35
:17
StorageDead(_9); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:16: 35
:17
StorageDead(_8); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:16: 35
:17
StorageDead(_7); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:16: 35
:17
StorageDead(_5); // scope 3 at $DIR/matches_reduce_branches.rs:3
6:1: 36
:2
StorageDead(_4); // scope 2 at $DIR/matches_reduce_branches.rs:3
6:1: 36
:2
StorageDead(_3); // scope 1 at $DIR/matches_reduce_branches.rs:3
6:1: 36
:2
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:3
6:1: 36
:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:3
6:2: 36
:2
+ StorageDead(_11); // scope 4 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
StorageDead(_6); // scope 4 at $DIR/matches_reduce_branches.rs:3
4:6: 34
:7
StorageLive(_7); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:6: 36
:7
_7 = _2; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:6: 36
:7
StorageLive(_8); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:9: 36
:10
_8 = _3; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:9: 36
:10
StorageLive(_9); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:12: 36
:13
_9 = _4; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:12: 36
:13
StorageLive(_10); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:15: 36
:16
_10 = _5; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:15: 36
:16
(_0.0: bool) = move _7; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:5: 36
:17
(_0.1: bool) = move _8; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:5: 36
:17
(_0.2: bool) = move _9; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:5: 36
:17
(_0.3: bool) = move _10; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:5: 36
:17
StorageDead(_10); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:16: 36
:17
StorageDead(_9); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:16: 36
:17
StorageDead(_8); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:16: 36
:17
StorageDead(_7); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:16: 36
:17
StorageDead(_5); // scope 3 at $DIR/matches_reduce_branches.rs:3
7:1: 37
:2
StorageDead(_4); // scope 2 at $DIR/matches_reduce_branches.rs:3
7:1: 37
:2
StorageDead(_3); // scope 1 at $DIR/matches_reduce_branches.rs:3
7:1: 37
:2
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:3
7:1: 37
:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:3
7:2: 37
:2
}
}
src/test/mir-opt/matches_reduce_branches.bar.MatchBranchSimplification.64bit.diff
浏览文件 @
a6dccfeb
...
...
@@ -2,84 +2,84 @@
+ // MIR for `bar` after MatchBranchSimplification
fn bar(_1: i32) -> (bool, bool, bool, bool) {
debug i => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:1
2:8: 12
:9
let mut _0: (bool, bool, bool, bool); // return place in scope 0 at $DIR/matches_reduce_branches.rs:1
2:19: 12
:43
let _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:1
3:9: 13
:10
let _6: (); // in scope 0 at $DIR/matches_reduce_branches.rs:1
8:5: 33
:6
let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
5:6: 35
:7
let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
5:9: 35
:10
let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
5:12: 35
:13
let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
5:15: 35
:16
+ let mut _11: i32; // in scope 0 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
debug i => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:1
3:8: 13
:9
let mut _0: (bool, bool, bool, bool); // return place in scope 0 at $DIR/matches_reduce_branches.rs:1
3:19: 13
:43
let _2: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
let _6: (); // in scope 0 at $DIR/matches_reduce_branches.rs:1
9:5: 34
:6
let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
6:6: 36
:7
let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
6:9: 36
:10
let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
6:12: 36
:13
let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:3
6:15: 36
:16
+ let mut _11: i32; // in scope 0 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
scope 1 {
debug a => _2; // in scope 1 at $DIR/matches_reduce_branches.rs:1
3:9: 13
:10
let _3: bool; // in scope 1 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
debug a => _2; // in scope 1 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
let _3: bool; // in scope 1 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
scope 2 {
debug b => _3; // in scope 2 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
let _4: bool; // in scope 2 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
debug b => _3; // in scope 2 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
let _4: bool; // in scope 2 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
scope 3 {
debug c => _4; // in scope 3 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
let _5: bool; // in scope 3 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
debug c => _4; // in scope 3 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
let _5: bool; // in scope 3 at $DIR/matches_reduce_branches.rs:1
7:9: 17
:10
scope 4 {
debug d => _5; // in scope 4 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
debug d => _5; // in scope 4 at $DIR/matches_reduce_branches.rs:1
7:9: 17
:10
}
}
}
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:1
3:9: 13
:10
StorageLive(_3); // scope 1 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
StorageLive(_4); // scope 2 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
StorageLive(_5); // scope 3 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
StorageLive(_6); // scope 4 at $DIR/matches_reduce_branches.rs:1
8:5: 33
:6
- switchInt(_1) -> [7_i32: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:1
4:9: 14
:10
StorageLive(_3); // scope 1 at $DIR/matches_reduce_branches.rs:1
5:9: 15
:10
StorageLive(_4); // scope 2 at $DIR/matches_reduce_branches.rs:1
6:9: 16
:10
StorageLive(_5); // scope 3 at $DIR/matches_reduce_branches.rs:1
7:9: 17
:10
StorageLive(_6); // scope 4 at $DIR/matches_reduce_branches.rs:1
9:5: 34
:6
- switchInt(_1) -> [7_i32: bb2, otherwise: bb1]; // scope 4 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
- }
-
- bb1: {
- _2 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
7:13: 27
:21
- _3 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
8:13: 28
:22
- _4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:
29:13: 29
:22
- _5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:3
0:13: 30
:21
- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:1
8:5: 33
:6
- _2 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
8:13: 28
:21
- _3 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
9:13: 29
:22
- _4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:
30:13: 30
:22
- _5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:3
1:13: 31
:21
- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:1
9:5: 34
:6
- }
-
- bb2: {
- _2 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
0:13: 20
:22
- _3 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
1:13: 21
:21
+ StorageLive(_11); // scope 4 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
+ _11 = _1; // scope 4 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
+ _2 = Ne(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:2
0:13: 20
:22
+ _3 = Eq(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:2
1:13: 21
:21
_4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
2:13: 22
:22
_5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
3:13: 23
:21
- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:1
8:5: 33
:6
- _2 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
1:13: 21
:22
- _3 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
2:13: 22
:21
+ StorageLive(_11); // scope 4 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
+ _11 = _1; // scope 4 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
+ _2 = Ne(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:2
1:13: 21
:22
+ _3 = Eq(_11, const 7_i32); // scope 4 at $DIR/matches_reduce_branches.rs:2
2:13: 22
:21
_4 = const false; // scope 4 at $DIR/matches_reduce_branches.rs:2
3:13: 23
:22
_5 = const true; // scope 4 at $DIR/matches_reduce_branches.rs:2
4:13: 24
:21
- goto -> bb3; // scope 4 at $DIR/matches_reduce_branches.rs:1
9:5: 34
:6
- }
-
- bb3: {
+ StorageDead(_11); // scope 4 at $DIR/matches_reduce_branches.rs:
19:9: 19
:10
StorageDead(_6); // scope 4 at $DIR/matches_reduce_branches.rs:3
3:6: 33
:7
StorageLive(_7); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:6: 35
:7
_7 = _2; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:6: 35
:7
StorageLive(_8); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:9: 35
:10
_8 = _3; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:9: 35
:10
StorageLive(_9); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:12: 35
:13
_9 = _4; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:12: 35
:13
StorageLive(_10); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:15: 35
:16
_10 = _5; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:15: 35
:16
(_0.0: bool) = move _7; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:5: 35
:17
(_0.1: bool) = move _8; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:5: 35
:17
(_0.2: bool) = move _9; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:5: 35
:17
(_0.3: bool) = move _10; // scope 4 at $DIR/matches_reduce_branches.rs:3
5:5: 35
:17
StorageDead(_10); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:16: 35
:17
StorageDead(_9); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:16: 35
:17
StorageDead(_8); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:16: 35
:17
StorageDead(_7); // scope 4 at $DIR/matches_reduce_branches.rs:3
5:16: 35
:17
StorageDead(_5); // scope 3 at $DIR/matches_reduce_branches.rs:3
6:1: 36
:2
StorageDead(_4); // scope 2 at $DIR/matches_reduce_branches.rs:3
6:1: 36
:2
StorageDead(_3); // scope 1 at $DIR/matches_reduce_branches.rs:3
6:1: 36
:2
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:3
6:1: 36
:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:3
6:2: 36
:2
+ StorageDead(_11); // scope 4 at $DIR/matches_reduce_branches.rs:
20:9: 20
:10
StorageDead(_6); // scope 4 at $DIR/matches_reduce_branches.rs:3
4:6: 34
:7
StorageLive(_7); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:6: 36
:7
_7 = _2; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:6: 36
:7
StorageLive(_8); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:9: 36
:10
_8 = _3; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:9: 36
:10
StorageLive(_9); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:12: 36
:13
_9 = _4; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:12: 36
:13
StorageLive(_10); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:15: 36
:16
_10 = _5; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:15: 36
:16
(_0.0: bool) = move _7; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:5: 36
:17
(_0.1: bool) = move _8; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:5: 36
:17
(_0.2: bool) = move _9; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:5: 36
:17
(_0.3: bool) = move _10; // scope 4 at $DIR/matches_reduce_branches.rs:3
6:5: 36
:17
StorageDead(_10); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:16: 36
:17
StorageDead(_9); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:16: 36
:17
StorageDead(_8); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:16: 36
:17
StorageDead(_7); // scope 4 at $DIR/matches_reduce_branches.rs:3
6:16: 36
:17
StorageDead(_5); // scope 3 at $DIR/matches_reduce_branches.rs:3
7:1: 37
:2
StorageDead(_4); // scope 2 at $DIR/matches_reduce_branches.rs:3
7:1: 37
:2
StorageDead(_3); // scope 1 at $DIR/matches_reduce_branches.rs:3
7:1: 37
:2
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:3
7:1: 37
:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:3
7:2: 37
:2
}
}
src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.32bit.diff
浏览文件 @
a6dccfeb
...
...
@@ -2,47 +2,26 @@
+ // MIR for `foo` after MatchBranchSimplification
fn foo(_1: Option<()>) -> () {
debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:6:8: 6:11
let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:6:25: 6:25
let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ let mut _4: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:7:8: 7:11
let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25
let mut _2: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
bb0: {
StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_3 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
- switchInt(move _3) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ _4 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ _2 = Eq(_4, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+ StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ switchInt(move _2) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
_2 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
}
bb1: {
- _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb2: {
- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb3: {
- switchInt(move _2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
- }
-
- bb4: {
_0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:9:6: 9:6
- goto -> bb5; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
+ goto -> bb2; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
_0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:10:6: 10:6
goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:8:5: 10:6
}
- bb5: {
+ bb2: {
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:9:5: 9:6
return; // scope 0 at $DIR/matches_reduce_branches.rs:10:2: 10:2
bb2: {
goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
bb3: {
return; // scope 0 at $DIR/matches_reduce_branches.rs:11:2: 11:2
}
}
src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.64bit.diff
浏览文件 @
a6dccfeb
...
...
@@ -2,47 +2,26 @@
+ // MIR for `foo` after MatchBranchSimplification
fn foo(_1: Option<()>) -> () {
debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:6:8: 6:11
let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:6:25: 6:25
let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ let mut _4: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:7:8: 7:11
let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25
let mut _2: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
bb0: {
StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_3 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
- switchInt(move _3) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ _4 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ _2 = Eq(_4, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
+ StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:7:22: 7:26
+ switchInt(move _2) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
_2 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
}
bb1: {
- _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb2: {
- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
- }
-
- bb3: {
- switchInt(move _2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
- }
-
- bb4: {
_0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:9:6: 9:6
- goto -> bb5; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
+ goto -> bb2; // scope 0 at $DIR/matches_reduce_branches.rs:7:5: 9:6
_0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:10:6: 10:6
goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:8:5: 10:6
}
- bb5: {
+ bb2: {
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:9:5: 9:6
return; // scope 0 at $DIR/matches_reduce_branches.rs:10:2: 10:2
bb2: {
goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
bb3: {
return; // scope 0 at $DIR/matches_reduce_branches.rs:11:2: 11:2
}
}
src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.32bit.mir
0 → 100644
浏览文件 @
a6dccfeb
// MIR for `foo` before PreCodegen
fn foo(_1: Option<()>) -> () {
debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:7:8: 7:11
let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25
let mut _2: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
bb0: {
_2 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
}
bb1: {
_0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:10:6: 10:6
return; // scope 0 at $DIR/matches_reduce_branches.rs:8:5: 10:6
}
bb2: {
return; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
}
src/test/mir-opt/matches_reduce_branches.foo.PreCodegen.before.64bit.mir
0 → 100644
浏览文件 @
a6dccfeb
// MIR for `foo` before PreCodegen
fn foo(_1: Option<()>) -> () {
debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:7:8: 7:11
let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:7:25: 7:25
let mut _2: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
bb0: {
_2 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
switchInt(move _2) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:8:22: 8:26
}
bb1: {
_0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:10:6: 10:6
return; // scope 0 at $DIR/matches_reduce_branches.rs:8:5: 10:6
}
bb2: {
return; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
}
src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.32bit.diff
浏览文件 @
a6dccfeb
...
...
@@ -2,110 +2,110 @@
+ // MIR for `match_nested_if` after MatchBranchSimplification
fn match_nested_if() -> bool {
let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:3
8:25: 38
:29
let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:
39:9: 39
:12
let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:
39:21: 39
:23
let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:24: 40
:28
+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:3
9:25: 39
:29
let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:
40:9: 40
:12
let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:
40:21: 40
:23
let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:24: 41
:28
+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
scope 1 {
debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:
39:9: 39
:12
debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:
40:9: 40
:12
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:
39:9: 39
:12
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:
39:21: 39
:23
StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:24: 40
:28
_6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:24: 40
:28
- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:
40:9: 40
:12
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:
40:21: 40
:23
StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:24: 41
:28
_6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:24: 41
:28
- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
- }
-
- bb1: {
- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:30: 40:34
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:31: 41:35
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
- }
-
- bb2: {
- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:42: 40:47
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:45: 41:50
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
- }
-
- bb3: {
+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:42: 40:47
+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:47: 40:48
- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:45: 41:50
+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:51: 41:52
- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
- }
-
- bb4: {
- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:50: 40:54
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:55: 41:59
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
- }
-
- bb5: {
- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:62: 40:67
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:69: 41:74
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
- }
-
- bb6: {
+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:62: 40:67
+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:67: 40:68
- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:69: 41:74
+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:75: 41:76
- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
- }
-
- bb7: {
- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:70: 40:74
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
2:13: 42:17
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
- }
-
- bb8: {
- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:82: 40:87
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
4:13: 44:18
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
- }
-
- bb9: {
+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:82: 40:87
+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:87: 40:88
- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
4:13: 44:18
+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:4
5:9: 45:10
- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
- }
-
- bb10: {
+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:95: 40:96
- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:92: 40:96
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:
39:15: 42
:6
+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
8:9: 48:10
- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
7:13: 47:17
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:
40:15: 50
:6
- }
-
- bb11: {
- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:95: 40:96
- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:14: 41
:19
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:
39:15: 42
:6
- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
8:9: 48:10
- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
9:14: 49
:19
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:
40:15: 50
:6
- }
-
- bb12: {
+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:14: 41
:19
+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:
42:6: 42
:7
_0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:
43:5: 43
:8
StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:
44:1: 44
:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:
44:2: 44
:2
+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
9:14: 49
:19
+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:
50:6: 50
:7
_0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:
51:5: 51
:8
StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:
52:1: 52
:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:
52:2: 52
:2
}
}
src/test/mir-opt/matches_reduce_branches.match_nested_if.MatchBranchSimplification.64bit.diff
浏览文件 @
a6dccfeb
...
...
@@ -2,110 +2,110 @@
+ // MIR for `match_nested_if` after MatchBranchSimplification
fn match_nested_if() -> bool {
let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:3
8:25: 38
:29
let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:
39:9: 39
:12
let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:
39:21: 39
:23
let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:24: 40
:28
+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
let mut _0: bool; // return place in scope 0 at $DIR/matches_reduce_branches.rs:3
9:25: 39
:29
let _1: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:
40:9: 40
:12
let mut _2: (); // in scope 0 at $DIR/matches_reduce_branches.rs:
40:21: 40
:23
let mut _3: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
let mut _4: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
let mut _5: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
let mut _6: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:24: 41
:28
+ let mut _7: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
+ let mut _8: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
+ let mut _9: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
+ let mut _10: bool; // in scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
scope 1 {
debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:
39:9: 39
:12
debug val => _1; // in scope 1 at $DIR/matches_reduce_branches.rs:
40:9: 40
:12
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:
39:9: 39
:12
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:
39:21: 39
:23
StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:24: 40
:28
_6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:24: 40
:28
- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
StorageLive(_1); // scope 0 at $DIR/matches_reduce_branches.rs:
40:9: 40
:12
StorageLive(_2); // scope 0 at $DIR/matches_reduce_branches.rs:
40:21: 40
:23
StorageLive(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
StorageLive(_4); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
StorageLive(_5); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
StorageLive(_6); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:24: 41
:28
_6 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:24: 41
:28
- switchInt(move _6) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
- }
-
- bb1: {
- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:30: 40:34
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
- _5 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:31: 41:35
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
- }
-
- bb2: {
- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:42: 40:47
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
- _5 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:45: 41:50
- goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
- }
-
- bb3: {
+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:42: 40:47
+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:21: 40:48
StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:47: 40:48
- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
+ StorageLive(_7); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
+ _7 = move _6; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
+ _5 = Ne(_7, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:45: 41:50
+ StorageDead(_7); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:21: 41:52
StorageDead(_6); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:51: 41:52
- switchInt(move _5) -> [false: bb5, otherwise: bb4]; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
- }
-
- bb4: {
- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:50: 40:54
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
- _4 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:55: 41:59
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
- }
-
- bb5: {
- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:62: 40:67
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
- _4 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:69: 41:74
- goto -> bb6; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
- }
-
- bb6: {
+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:62: 40:67
+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:18: 40:68
StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:67: 40:68
- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ StorageLive(_8); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
+ _8 = move _5; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
+ _4 = Ne(_8, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:69: 41:74
+ StorageDead(_8); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:18: 41:76
StorageDead(_5); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:75: 41:76
- switchInt(move _4) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
- }
-
- bb7: {
- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:70: 40:74
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
- _3 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
2:13: 42:17
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
- }
-
- bb8: {
- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:82: 40:87
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
- _3 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
4:13: 44:18
- goto -> bb9; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
- }
-
- bb9: {
+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:82: 40:87
+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:87: 40:88
- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ StorageLive(_9); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
+ _9 = move _4; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
+ _3 = Ne(_9, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
4:13: 44:18
+ StorageDead(_9); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
StorageDead(_4); // scope 0 at $DIR/matches_reduce_branches.rs:4
5:9: 45:10
- switchInt(move _3) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
- }
-
- bb10: {
+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:95: 40:96
- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
0:92: 40:96
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:
39:15: 42
:6
+ StorageLive(_10); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
+ _10 = move _3; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
8:9: 48:10
- _1 = const true; // scope 0 at $DIR/matches_reduce_branches.rs:4
7:13: 47:17
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:
40:15: 50
:6
- }
-
- bb11: {
- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:95: 40:96
- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
1:14: 41
:19
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:
39:15: 42
:6
- StorageDead(_3); // scope 0 at $DIR/matches_reduce_branches.rs:4
8:9: 48:10
- _1 = const false; // scope 0 at $DIR/matches_reduce_branches.rs:4
9:14: 49
:19
- goto -> bb12; // scope 0 at $DIR/matches_reduce_branches.rs:
40:15: 50
:6
- }
-
- bb12: {
+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:14: 41
:19
+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:4
0:15: 40:88
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:
42:6: 42
:7
_0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:
43:5: 43
:8
StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:
44:1: 44
:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:
44:2: 44
:2
+ _1 = Ne(_10, const false); // scope 0 at $DIR/matches_reduce_branches.rs:4
9:14: 49
:19
+ StorageDead(_10); // scope 0 at $DIR/matches_reduce_branches.rs:4
1:15: 45:10
StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:
50:6: 50
:7
_0 = _1; // scope 1 at $DIR/matches_reduce_branches.rs:
51:5: 51
:8
StorageDead(_1); // scope 0 at $DIR/matches_reduce_branches.rs:
52:1: 52
:2
return; // scope 0 at $DIR/matches_reduce_branches.rs:
52:2: 52
:2
}
}
src/test/mir-opt/matches_reduce_branches.rs
浏览文件 @
a6dccfeb
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR matches_reduce_branches.foo.MatchBranchSimplification.diff
// EMIT_MIR matches_reduce_branches.foo.PreCodegen.before.mir
// EMIT_MIR matches_reduce_branches.bar.MatchBranchSimplification.diff
// EMIT_MIR matches_reduce_branches.match_nested_if.MatchBranchSimplification.diff
fn
foo
(
bar
:
Option
<
()
>
)
{
if
matches!
(
bar
,
None
)
{
()
()
}
}
...
...
@@ -37,15 +38,22 @@ fn bar(i: i32) -> (bool, bool, bool, bool) {
fn
match_nested_if
()
->
bool
{
let
val
=
match
()
{
()
if
if
if
if
true
{
true
}
else
{
false
}
{
true
}
else
{
false
}
{
true
}
else
{
false
}
=>
true
,
()
if
if
if
if
true
{
true
}
else
{
false
}
{
true
}
else
{
false
}
{
true
}
else
{
false
}
=>
{
true
}
_
=>
false
,
};
val
}
fn
main
()
{
let
_
=
foo
(
None
);
let
_
=
foo
(
Some
(()));
let
_
=
bar
(
0
);
let
_
=
match_nested_if
();
let
_
=
foo
(
None
);
let
_
=
foo
(
Some
(()));
let
_
=
bar
(
0
);
let
_
=
match_nested_if
();
}
src/test/mir-opt/not_equal_false.opt.InstCombine.diff
浏览文件 @
a6dccfeb
- // MIR for `opt` before InstCombine
+ // MIR for `opt` after InstCombine
fn opt(_1:
Option<()>) -> bool
{
fn opt(_1:
bool) -> u32
{
debug x => _1; // in scope 0 at $DIR/not_equal_false.rs:3:8: 3:9
let mut _0: bool; // return place in scope 0 at $DIR/not_equal_false.rs:3:26: 3:30
let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _3: isize; // in scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
let mut _4: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
let mut _5: isize; // in scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
let mut _6: isize; // in scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
let mut _7: isize; // in scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
let mut _8: bool; // in scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
let mut _0: u32; // return place in scope 0 at $DIR/not_equal_false.rs:3:20: 3:23
let mut _2: bool; // in scope 0 at $DIR/not_equal_false.rs:4:8: 4:18
let mut _3: bool; // in scope 0 at $DIR/not_equal_false.rs:4:8: 4:9
bb0: {
StorageLive(_2); // scope 0 at $
SRC_DIR/core/src/macros/mod.rs:LL:COL
_3 = discriminant(_1); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
StorageLive(_6); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
_6 = move _3; // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
_2 = Eq(_6, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_
6); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:
46
StorageLive(_2); // scope 0 at $
DIR/not_equal_false.rs:4:8: 4:18
StorageLive(_3); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:9
_3 = _1; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:9
- _2 = Ne(move _3, const false); // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18
+ _2 = move _3; // scope 0 at $DIR/not_equal_false.rs:4:8: 4:18
StorageDead(_
3); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:18
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:
35
}
bb1: {
_0 = const
true; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:
46
_0 = const
0_u32; // scope 0 at $DIR/not_equal_false.rs:4:21: 4:22
goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:
35
}
bb2: {
StorageLive(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_5 = discriminant(_1); // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
StorageLive(_7); // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
_7 = move _5; // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
_4 = Eq(_7, const 1_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_7); // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
StorageLive(_8); // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
_8 = move _4; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
- _0 = Ne(_8, const false); // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
+ _0 = _8; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
StorageDead(_8); // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
_0 = const 1_u32; // scope 0 at $DIR/not_equal_false.rs:4:32: 4:33
goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:35
}
bb3: {
StorageDead(_4); // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46
StorageDead(_2); // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46
StorageDead(_2); // scope 0 at $DIR/not_equal_false.rs:4:34: 4:35
return; // scope 0 at $DIR/not_equal_false.rs:5:2: 5:2
}
}
...
...
src/test/mir-opt/not_equal_false.rs
浏览文件 @
a6dccfeb
// EMIT_MIR not_equal_false.opt.InstCombine.diff
fn
opt
(
x
:
Option
<
()
>
)
->
bool
{
matches!
(
x
,
None
)
||
matches!
(
x
,
Some
(
_
))
fn
opt
(
x
:
bool
)
->
u32
{
if
x
!=
false
{
0
}
else
{
1
}
}
fn
main
()
{
opt
(
Non
e
);
opt
(
fals
e
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录