@@ -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) ;
@@ -297,9 +296,7 @@ struct Inliner<'m, 'map> {
297
296
void : Word ,
298
297
ptr_map : FxHashMap < Word , Word > ,
299
298
functions : & ' map FunctionMap ,
300
- disallowed_argument_types : & ' map FxHashSet < Word > ,
301
- disallowed_return_types : & ' map FxHashSet < Word > ,
302
- // rewrite_rules: FxHashMap<Word, Word>,
299
+ needs_inline : & ' map [ bool ] ,
303
300
}
304
301
305
302
impl Inliner < ' _ , ' _ > {
@@ -356,23 +353,20 @@ impl Inliner<'_, '_> {
356
353
. enumerate ( )
357
354
. filter ( |( _, inst) | inst. class . opcode == Op :: FunctionCall )
358
355
. map ( |( index, inst) | {
359
- let idx = self
360
- . functions
361
- . get ( & inst. operands [ 0 ] . id_ref_any ( ) . unwrap ( ) )
362
- . unwrap ( ) ;
363
- ( index , inst , & functions [ * idx ] )
356
+ (
357
+ index ,
358
+ inst,
359
+ self . functions [ & inst . operands [ 0 ] . id_ref_any ( ) . unwrap ( ) ] ,
360
+ )
364
361
} )
365
- . find ( |( _, inst, f) | {
366
- should_inline (
367
- self . disallowed_argument_types ,
368
- self . disallowed_return_types ,
369
- f,
370
- ) || args_invalid ( caller, inst)
362
+ . find ( |( index, inst, func_idx) | {
363
+ self . needs_inline [ * func_idx] || args_invalid ( caller, inst)
371
364
} ) ;
372
- let ( call_index, call_inst, callee ) = match call {
365
+ let ( call_index, call_inst, callee_idx ) = match call {
373
366
None => return false ,
374
367
Some ( call) => call,
375
368
} ;
369
+ let callee = & functions[ callee_idx] ;
376
370
let call_result_type = {
377
371
let ty = call_inst. result_type . unwrap ( ) ;
378
372
if ty == self . void {
0 commit comments