p4c
p4c copied to clipboard
Add additional optimizations to `SimplifySelectCases` midend pass
Reduces the following parser code:
state state_1 {
transition select(packet.lookahead<bit<16>>()) {
0x21 : state_3;
0x21 : state_2;
default : accept;
}
}
to:
state state_1 {
transition select(packet.lookahead<bit<16>>()) {
0x21 : state_3;
default : accept;
}
}
and reduces the following parser code:
state state_1 {
transition select(packet.lookahead<bit<16>>()) {
0x21 : state_3;
0x22 : state_2;
default : state_3;
}
}
to:
state state_1 {
transition select(packet.lookahead<bit<16>>()) {
0x22 : state_2;
default : state_3;
}
}