@@ -9,7 +9,9 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
9
9
use smallvec:: SmallVec ;
10
10
11
11
use 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
+ } ;
13
15
14
16
#[ derive( Clone , TyEncodable , TyDecodable , Debug , HashStable , TypeFoldable , TypeVisitable ) ]
15
17
pub struct BasicBlocks < ' tcx > {
@@ -28,7 +30,7 @@ type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>;
28
30
/// `BasicBlocks::switch_sources`, which is only called by backwards analyses
29
31
/// that do `SwitchInt` handling, and we don't have any of those, not even in
30
32
/// tests. See #95120 and #94576.
31
- type SwitchSources = FxHashMap < ( BasicBlock , BasicBlock ) , SmallVec < [ Option < u128 > ; 1 ] > > ;
33
+ type SwitchSources = FxHashMap < ( BasicBlock , BasicBlock ) , SmallVec < [ SwitchTargetValue ; 1 ] > > ;
32
34
33
35
#[ derive( Clone , Default , Debug ) ]
34
36
struct Cache {
@@ -90,9 +92,15 @@ impl<'tcx> BasicBlocks<'tcx> {
90
92
} ) = & data. terminator
91
93
{
92
94
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) ) ;
94
99
}
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 ) ;
96
104
}
97
105
}
98
106
switch_sources
0 commit comments