29
29
//! (non-mutating) use of `SRC`. These restrictions are conservative and may be relaxed in the
30
30
//! future.
31
31
32
- use rustc:: hir;
33
32
use rustc:: mir:: { Constant , Local , LocalKind , Location , Place , Mir , Operand , Rvalue , StatementKind } ;
34
33
use rustc:: mir:: visit:: MutVisitor ;
35
34
use rustc:: ty:: TyCtxt ;
@@ -41,26 +40,8 @@ pub struct CopyPropagation;
41
40
impl MirPass for CopyPropagation {
42
41
fn run_pass < ' a , ' tcx > ( & self ,
43
42
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
44
- source : MirSource ,
43
+ _source : MirSource ,
45
44
mir : & mut Mir < ' tcx > ) {
46
- // Don't run on constant MIR, because trans might not be able to
47
- // evaluate the modified MIR.
48
- // FIXME(eddyb) Remove check after miri is merged.
49
- let id = tcx. hir . as_local_node_id ( source. def_id ) . unwrap ( ) ;
50
- match ( tcx. hir . body_owner_kind ( id) , source. promoted ) {
51
- ( _, Some ( _) ) |
52
- ( hir:: BodyOwnerKind :: Const , _) |
53
- ( hir:: BodyOwnerKind :: Static ( _) , _) => return ,
54
-
55
- ( hir:: BodyOwnerKind :: Fn , _) => {
56
- if tcx. is_const_fn ( source. def_id ) {
57
- // Don't run on const functions, as, again, trans might not be able to evaluate
58
- // the optimized IR.
59
- return
60
- }
61
- }
62
- }
63
-
64
45
// We only run when the MIR optimization level is > 1.
65
46
// This avoids a slow pass, and messing up debug info.
66
47
if tcx. sess . opts . debugging_opts . mir_opt_level <= 1 {
0 commit comments