@@ -132,3 +132,34 @@ function f32579(x::Int, b::Bool)
132132end
133133@test f32579 (0 , true ) === true
134134@test f32579 (0 , false ) === false
135+
136+ # Test for bug caused by renaming blocks improperly, related to PR #32145
137+ using Base. Meta
138+ let ci = (Meta. @lower 1 + 1 ). args[1 ]
139+ ci. code = [
140+ # block 1
141+ Core. Compiler. GotoIfNot (Expr (:boundscheck ), 6 ),
142+ # block 2
143+ Expr (:call , GlobalRef (Base, :size ), Core. Compiler. Argument (3 )),
144+ Core. Compiler. ReturnNode (),
145+ # block 3
146+ Core. PhiNode (),
147+ Core. Compiler. ReturnNode (),
148+ # block 4
149+ Expr (:call ,
150+ GlobalRef (Main, :something ),
151+ GlobalRef (Main, :somethingelse )),
152+ Core. Compiler. GotoIfNot (Core. SSAValue (6 ), 9 ),
153+ # block 5
154+ Core. Compiler. ReturnNode (Core. SSAValue (6 )),
155+ # block 6
156+ Core. Compiler. ReturnNode (Core. SSAValue (6 ))
157+ ]
158+ nstmts = length (ci. code)
159+ ci. ssavaluetypes = nstmts
160+ ci. codelocs = fill (Int32 (1 ), nstmts)
161+ ci. ssaflags = fill (Int32 (0 ), nstmts)
162+ ir = Core. Compiler. inflate_ir (ci)
163+ ir = Core. Compiler. compact! (ir, true )
164+ @test Core. Compiler. verify_ir (ir) == nothing
165+ end
0 commit comments