@@ -58,8 +58,7 @@ pub fn inline(sess: &Session, module: &mut Module) -> super::Result<()> {
58
58
void,
59
59
ptr_map,
60
60
functions : & functions,
61
- disallowed_argument_types : & disallowed_argument_types,
62
- disallowed_return_types : & disallowed_return_types,
61
+ needs_inline : & to_delete,
63
62
} ;
64
63
for index in postorder {
65
64
inliner. inline_fn ( & mut module. functions , index) ;
@@ -299,9 +298,7 @@ struct Inliner<'m, 'map> {
299
298
void : Word ,
300
299
ptr_map : FxHashMap < Word , Word > ,
301
300
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 ] ,
305
302
}
306
303
307
304
impl Inliner < ' _ , ' _ > {
@@ -358,23 +355,20 @@ impl Inliner<'_, '_> {
358
355
. enumerate ( )
359
356
. filter ( |( _, inst) | inst. class . opcode == Op :: FunctionCall )
360
357
. 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
+ )
366
363
} )
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)
373
366
} ) ;
374
- let ( call_index, call_inst, callee ) = match call {
367
+ let ( call_index, call_inst, callee_idx ) = match call {
375
368
None => return false ,
376
369
Some ( call) => call,
377
370
} ;
371
+ let callee = & functions[ callee_idx] ;
378
372
let call_result_type = {
379
373
let ty = call_inst. result_type . unwrap ( ) ;
380
374
if ty == self . void {
0 commit comments