@@ -9,7 +9,9 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
99use smallvec:: SmallVec ;
1010
1111use crate :: mir:: traversal:: Postorder ;
12- use crate :: mir:: { BasicBlock , BasicBlockData , START_BLOCK , Terminator , TerminatorKind } ;
12+ use crate :: mir:: {
13+ BasicBlock , BasicBlockData , START_BLOCK , SwitchTargetValue , Terminator , TerminatorKind ,
14+ } ;
1315
1416#[ derive( Clone , TyEncodable , TyDecodable , Debug , HashStable , TypeFoldable , TypeVisitable ) ]
1517pub struct BasicBlocks < ' tcx > {
@@ -28,7 +30,7 @@ type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>;
2830/// `BasicBlocks::switch_sources`, which is only called by backwards analyses
2931/// that do `SwitchInt` handling, and we don't have any of those, not even in
3032/// tests. See #95120 and #94576.
31- type SwitchSources = FxHashMap < ( BasicBlock , BasicBlock ) , SmallVec < [ Option < u128 > ; 1 ] > > ;
33+ type SwitchSources = FxHashMap < ( BasicBlock , BasicBlock ) , SmallVec < [ SwitchTargetValue ; 1 ] > > ;
3234
3335#[ derive( Clone , Default , Debug ) ]
3436struct Cache {
@@ -90,9 +92,15 @@ impl<'tcx> BasicBlocks<'tcx> {
9092 } ) = & data. terminator
9193 {
9294 for ( value, target) in targets. iter ( ) {
93- switch_sources. entry ( ( target, bb) ) . or_default ( ) . push ( Some ( value) ) ;
95+ switch_sources
96+ . entry ( ( target, bb) )
97+ . or_default ( )
98+ . push ( SwitchTargetValue :: Normal ( value) ) ;
9499 }
95- switch_sources. entry ( ( targets. otherwise ( ) , bb) ) . or_default ( ) . push ( None ) ;
100+ switch_sources
101+ . entry ( ( targets. otherwise ( ) , bb) )
102+ . or_default ( )
103+ . push ( SwitchTargetValue :: Otherwise ) ;
96104 }
97105 }
98106 switch_sources
0 commit comments