@@ -58,8 +58,7 @@ pub fn inline(sess: &Session, module: &mut Module) -> super::Result<()> {
5858 void,
5959 ptr_map,
6060 functions : & functions,
61- disallowed_argument_types : & disallowed_argument_types,
62- disallowed_return_types : & disallowed_return_types,
61+ needs_inline : & to_delete,
6362 } ;
6463 for index in postorder {
6564 inliner. inline_fn ( & mut module. functions , index) ;
@@ -299,9 +298,7 @@ struct Inliner<'m, 'map> {
299298 void : Word ,
300299 ptr_map : FxHashMap < Word , Word > ,
301300 functions : & ' map FunctionMap ,
302- disallowed_argument_types : & ' map FxHashSet < Word > ,
303- disallowed_return_types : & ' map FxHashSet < Word > ,
304- // rewrite_rules: FxHashMap<Word, Word>,
301+ needs_inline : & ' map [ bool ] ,
305302}
306303
307304impl Inliner < ' _ , ' _ > {
@@ -358,23 +355,20 @@ impl Inliner<'_, '_> {
358355 . enumerate ( )
359356 . filter ( |( _, inst) | inst. class . opcode == Op :: FunctionCall )
360357 . map ( |( index, inst) | {
361- let idx = self
362- . functions
363- . get ( & inst. operands [ 0 ] . id_ref_any ( ) . unwrap ( ) )
364- . unwrap ( ) ;
365- ( index , inst , & functions [ * idx ] )
358+ (
359+ index ,
360+ inst,
361+ self . functions [ & inst . operands [ 0 ] . id_ref_any ( ) . unwrap ( ) ] ,
362+ )
366363 } )
367- . find ( |( _, inst, f) | {
368- should_inline (
369- self . disallowed_argument_types ,
370- self . disallowed_return_types ,
371- f,
372- ) || args_invalid ( caller, inst)
364+ . find ( |( index, inst, func_idx) | {
365+ self . needs_inline [ * func_idx] || args_invalid ( caller, inst)
373366 } ) ;
374- let ( call_index, call_inst, callee ) = match call {
367+ let ( call_index, call_inst, callee_idx ) = match call {
375368 None => return false ,
376369 Some ( call) => call,
377370 } ;
371+ let callee = & functions[ callee_idx] ;
378372 let call_result_type = {
379373 let ty = call_inst. result_type . unwrap ( ) ;
380374 if ty == self . void {
0 commit comments