Rollup merge of #127164 - Nadrieril:clean-lowering-loop, r=matthewjasper · rust-lang/rust@58fe37f

@@ -38,65 +38,61 @@ fn main() -> () {

3838

StorageLive(_2);

3939

_2 = Option::<i32>::Some(const 1_i32);

4040

PlaceMention(_2);

41-

_5 = discriminant(_2);

42-

switchInt(move _5) -> [1: bb8, otherwise: bb2];

41+

_4 = discriminant(_2);

42+

switchInt(move _4) -> [1: bb2, otherwise: bb1];

4343

}

44444545

bb1: {

46-

FakeRead(ForMatchedPlace(None), _2);

47-

unreachable;

46+

falseEdge -> [real: bb14, imaginary: bb4];

4847

}

49485049

bb2: {

51-

falseEdge -> [real: bb15, imaginary: bb3];

50+

falseEdge -> [real: bb9, imaginary: bb1];

5251

}

53525453

bb3: {

55-

_4 = discriminant(_2);

56-

switchInt(move _4) -> [1: bb6, otherwise: bb4];

54+

goto -> bb1;

5755

}

58565957

bb4: {

58+

_5 = discriminant(_2);

59+

switchInt(move _5) -> [1: bb6, otherwise: bb5];

60+

}

61+62+

bb5: {

6063

StorageLive(_14);

6164

_14 = _2;

6265

_1 = const 4_i32;

6366

StorageDead(_14);

64-

goto -> bb21;

65-

}

66-67-

bb5: {

68-

goto -> bb1;

67+

goto -> bb20;

6968

}

70697170

bb6: {

72-

falseEdge -> [real: bb16, imaginary: bb4];

71+

falseEdge -> [real: bb15, imaginary: bb5];

7372

}

74737574

bb7: {

76-

goto -> bb4;

75+

goto -> bb5;

7776

}

78777978

bb8: {

80-

falseEdge -> [real: bb10, imaginary: bb2];

79+

FakeRead(ForMatchedPlace(None), _2);

80+

unreachable;

8181

}

82828383

bb9: {

84-

goto -> bb2;

85-

}

86-87-

bb10: {

8884

StorageLive(_7);

8985

_7 = &((_2 as Some).0: i32);

9086

_3 = &fake shallow _2;

9187

StorageLive(_8);

92-

_8 = guard() -> [return: bb11, unwind: bb24];

88+

_8 = guard() -> [return: bb10, unwind: bb22];

9389

}

949095-

bb11: {

96-

switchInt(move _8) -> [0: bb13, otherwise: bb12];

91+

bb10: {

92+

switchInt(move _8) -> [0: bb12, otherwise: bb11];

9793

}

989499-

bb12: {

95+

bb11: {

10096

StorageDead(_8);

10197

FakeRead(ForMatchGuard, _3);

10298

FakeRead(ForGuardBinding, _7);

@@ -105,42 +101,42 @@ fn main() -> () {

105101

_1 = const 1_i32;

106102

StorageDead(_6);

107103

StorageDead(_7);

108-

goto -> bb21;

104+

goto -> bb20;

109105

}

110106111-

bb13: {

112-

goto -> bb14;

107+

bb12: {

108+

goto -> bb13;

113109

}

114110115-

bb14: {

111+

bb13: {

116112

StorageDead(_8);

117113

StorageDead(_7);

118-

falseEdge -> [real: bb9, imaginary: bb2];

114+

falseEdge -> [real: bb3, imaginary: bb1];

119115

}

120116121-

bb15: {

117+

bb14: {

122118

StorageLive(_9);

123119

_9 = _2;

124120

_1 = const 2_i32;

125121

StorageDead(_9);

126-

goto -> bb21;

122+

goto -> bb20;

127123

}

128124129-

bb16: {

125+

bb15: {

130126

StorageLive(_11);

131127

_11 = &((_2 as Some).0: i32);

132128

_3 = &fake shallow _2;

133129

StorageLive(_12);

134130

StorageLive(_13);

135131

_13 = (*_11);

136-

_12 = guard2(move _13) -> [return: bb17, unwind: bb24];

132+

_12 = guard2(move _13) -> [return: bb16, unwind: bb22];

137133

}

138134139-

bb17: {

140-

switchInt(move _12) -> [0: bb19, otherwise: bb18];

135+

bb16: {

136+

switchInt(move _12) -> [0: bb18, otherwise: bb17];

141137

}

142138143-

bb18: {

139+

bb17: {

144140

StorageDead(_13);

145141

StorageDead(_12);

146142

FakeRead(ForMatchGuard, _3);

@@ -150,38 +146,34 @@ fn main() -> () {

150146

_1 = const 3_i32;

151147

StorageDead(_10);

152148

StorageDead(_11);

153-

goto -> bb21;

149+

goto -> bb20;

154150

}

155151156-

bb19: {

157-

goto -> bb20;

152+

bb18: {

153+

goto -> bb19;

158154

}

159155160-

bb20: {

156+

bb19: {

161157

StorageDead(_13);

162158

StorageDead(_12);

163159

StorageDead(_11);

164-

falseEdge -> [real: bb7, imaginary: bb4];

160+

falseEdge -> [real: bb7, imaginary: bb5];

165161

}

166162167-

bb21: {

163+

bb20: {

168164

PlaceMention(_1);

169165

StorageDead(_2);

170166

StorageDead(_1);

171167

_0 = const ();

172168

return;

173169

}

174170175-

bb22: {

171+

bb21: {

176172

FakeRead(ForMatchedPlace(None), _1);

177173

unreachable;

178174

}

179175180-

bb23: {

181-

goto -> bb22;

182-

}

183-184-

bb24 (cleanup): {

176+

bb22 (cleanup): {

185177

resume;

186178

}

187179

}