@@ -360,7 +360,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
360
360
ConstPropagator { ecx, tcx, param_env, local_decls : & body. local_decls , patch }
361
361
}
362
362
363
- #[ instrument( skip( self ) , level = "debug" ) ]
364
363
fn get_const ( & self , place : Place < ' tcx > ) -> Option < OpTy < ' tcx > > {
365
364
let op = match self . ecx . eval_place_to_op ( place, None ) {
366
365
Ok ( op) => {
@@ -382,14 +381,10 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
382
381
383
382
// Try to read the local as an immediate so that if it is representable as a scalar, we can
384
383
// handle it as such, but otherwise, just return the value as is.
385
- let r = Some ( match self . ecx . read_immediate_raw ( & op) {
384
+ Some ( match self . ecx . read_immediate_raw ( & op) {
386
385
Ok ( Right ( imm) ) => imm. into ( ) ,
387
386
_ => op,
388
- } ) ;
389
-
390
- trace ! ( "found = {r:?}" ) ;
391
-
392
- r
387
+ } )
393
388
}
394
389
395
390
/// Remove `local` from the pool of `Locals`. Allows writing to them,
@@ -399,7 +394,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
399
394
ecx. machine . written_only_inside_own_block_locals . remove ( & local) ;
400
395
}
401
396
402
- #[ instrument( skip( self ) , level = "debug" ) ]
403
397
fn check_rvalue ( & mut self , rvalue : & Rvalue < ' tcx > ) -> Option < ( ) > {
404
398
// Perform any special handling for specific Rvalue types.
405
399
// Generally, checks here fall into one of two categories:
@@ -516,7 +510,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
516
510
}
517
511
}
518
512
519
- #[ instrument( skip( self ) , level = "debug" ) ]
520
513
fn replace_with_const ( & mut self , place : Place < ' tcx > ) -> Option < Const < ' tcx > > {
521
514
// This will return None if the above `const_prop` invocation only "wrote" a
522
515
// type whose creation requires no write. E.g. a coroutine whose initial state
@@ -619,7 +612,6 @@ impl CanConstProp {
619
612
}
620
613
621
614
impl < ' tcx > Visitor < ' tcx > for CanConstProp {
622
- #[ instrument( skip( self ) , level = "debug" ) ]
623
615
fn visit_place ( & mut self , place : & Place < ' tcx > , mut context : PlaceContext , loc : Location ) {
624
616
use rustc_middle:: mir:: visit:: PlaceContext :: * ;
625
617
@@ -632,7 +624,6 @@ impl<'tcx> Visitor<'tcx> for CanConstProp {
632
624
self . visit_projection ( place. as_ref ( ) , context, loc) ;
633
625
}
634
626
635
- #[ instrument( skip( self ) , level = "debug" ) ]
636
627
fn visit_local ( & mut self , local : Local , context : PlaceContext , _: Location ) {
637
628
use rustc_middle:: mir:: visit:: PlaceContext :: * ;
638
629
match context {
@@ -691,22 +682,15 @@ impl<'tcx> Visitor<'tcx> for CanConstProp {
691
682
}
692
683
693
684
impl < ' tcx > Visitor < ' tcx > for ConstPropagator < ' _ , ' tcx > {
694
- #[ instrument( skip( self ) , level = "debug" ) ]
695
685
fn visit_operand ( & mut self , operand : & Operand < ' tcx > , location : Location ) {
696
686
self . super_operand ( operand, location) ;
697
-
698
- trace ! ( "about to do it" ) ;
699
-
700
687
if let Some ( place) = operand. place ( )
701
688
&& let Some ( value) = self . replace_with_const ( place)
702
689
{
703
- trace ! ( ?place, ?value, "know whats going on" ) ;
704
690
self . patch . before_effect . insert ( ( location, place) , value) ;
705
691
}
706
692
}
707
693
708
- #[ instrument( skip( self ) , level = "debug" ) ]
709
-
710
694
fn visit_projection_elem (
711
695
& mut self ,
712
696
_: PlaceRef < ' tcx > ,
@@ -721,7 +705,6 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
721
705
}
722
706
}
723
707
724
- #[ instrument( skip( self ) , level = "debug" ) ]
725
708
fn visit_assign ( & mut self , place : & Place < ' tcx > , rvalue : & Rvalue < ' tcx > , location : Location ) {
726
709
self . super_assign ( place, rvalue, location) ;
727
710
@@ -736,14 +719,14 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
736
719
_ if place. is_indirect ( ) => { }
737
720
ConstPropMode :: NoPropagation => self . ensure_not_propagated ( place. local ) ,
738
721
ConstPropMode :: OnlyInsideOwnBlock | ConstPropMode :: FullConstProp => {
739
- trace ! ( "trying to do some const-prop" ) ;
740
722
if let Some ( ( ) ) = self . eval_rvalue_with_identities ( rvalue, * place) {
741
723
// If this was already an evaluated constant, keep it.
742
724
if let Rvalue :: Use ( Operand :: Constant ( c) ) = rvalue
743
725
&& let Const :: Val ( ..) = c. const_
744
726
{
745
727
trace ! (
746
- "skipping replace of Rvalue::Use({c:?}) because it is already a const"
728
+ "skipping replace of Rvalue::Use({:?} because it is already a const" ,
729
+ c
747
730
) ;
748
731
} else if let Some ( operand) = self . replace_with_const ( * place) {
749
732
self . patch . assignments . insert ( location, operand) ;
@@ -770,12 +753,8 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
770
753
}
771
754
}
772
755
773
- #[ instrument( skip( self ) , level = "trace" ) ]
774
756
fn visit_statement ( & mut self , statement : & Statement < ' tcx > , location : Location ) {
775
- {
776
- let frame = & self . ecx . frame ( ) . locals ;
777
- trace ! ( ?frame, "initial frame" ) ;
778
- }
757
+ trace ! ( "visit_statement: {:?}" , statement) ;
779
758
780
759
// We want to evaluate operands before any change to the assigned-to value,
781
760
// so we recurse first.
@@ -816,11 +795,6 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
816
795
// In both cases, this does not matter, as those reads would be UB anyway.
817
796
_ => { }
818
797
}
819
-
820
- {
821
- let frame = & self . ecx . frame ( ) . locals ;
822
- trace ! ( ?frame, "final frame" ) ;
823
- }
824
798
}
825
799
826
800
fn visit_basic_block_data ( & mut self , block : BasicBlock , data : & BasicBlockData < ' tcx > ) {
0 commit comments