@@ -102,13 +102,12 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
102102 // Pass a wrapper rather than the function itself as the function itself may not
103103 // be exported from the main codegen unit and may thus be unreachable from the
104104 // object file created by an external assembler.
105- let inline_asm_index = fx. cx . inline_asm_index . get ( ) ;
106- fx. cx . inline_asm_index . set ( inline_asm_index + 1 ) ;
107105 let wrapper_name = format ! (
108106 "__inline_asm_{}_wrapper_n{}" ,
109107 fx. cx. cgu_name. as_str( ) . replace( '.' , "__" ) . replace( '-' , "_" ) ,
110- inline_asm_index
108+ fx . cx . inline_asm_index
111109 ) ;
110+ fx. cx . inline_asm_index += 1 ;
112111 let sig =
113112 get_function_sig ( fx. tcx , fx. target_config . default_call_conv , instance) ;
114113 create_wrapper_function ( fx. module , sig, & wrapper_name, symbol. name ) ;
@@ -167,13 +166,12 @@ pub(crate) fn codegen_inline_asm_inner<'tcx>(
167166 asm_gen. allocate_registers ( ) ;
168167 asm_gen. allocate_stack_slots ( ) ;
169168
170- let inline_asm_index = fx. cx . inline_asm_index . get ( ) ;
171- fx. cx . inline_asm_index . set ( inline_asm_index + 1 ) ;
172169 let asm_name = format ! (
173170 "__inline_asm_{}_n{}" ,
174171 fx. cx. cgu_name. as_str( ) . replace( '.' , "__" ) . replace( '-' , "_" ) ,
175- inline_asm_index
172+ fx . cx . inline_asm_index
176173 ) ;
174+ fx. cx . inline_asm_index += 1 ;
177175
178176 let generated_asm = asm_gen. generate_asm_wrapper ( & asm_name) ;
179177 fx. cx . global_asm . push_str ( & generated_asm) ;
@@ -266,13 +264,12 @@ pub(crate) fn codegen_naked_asm<'tcx>(
266264 // Pass a wrapper rather than the function itself as the function itself may not
267265 // be exported from the main codegen unit and may thus be unreachable from the
268266 // object file created by an external assembler.
269- let inline_asm_index = cx. inline_asm_index . get ( ) ;
270- cx. inline_asm_index . set ( inline_asm_index + 1 ) ;
271267 let wrapper_name = format ! (
272268 "__inline_asm_{}_wrapper_n{}" ,
273269 cx. cgu_name. as_str( ) . replace( '.' , "__" ) . replace( '-' , "_" ) ,
274- inline_asm_index
270+ cx . inline_asm_index
275271 ) ;
272+ cx. inline_asm_index += 1 ;
276273 let sig =
277274 get_function_sig ( tcx, module. target_config ( ) . default_call_conv , instance) ;
278275 create_wrapper_function ( module, sig, & wrapper_name, symbol. name ) ;
0 commit comments