@@ -35,13 +35,11 @@ pub fn inline(sess: &Session, module: &mut Module) -> super::Result<()> {
3535 // Drop all the functions we'll be inlining. (This also means we won't waste time processing
3636 // inlines in functions that will get inlined)
3737 let mut dropped_ids = FxHashSet :: default ( ) ;
38+ let mut inlined_dont_inlines = Vec :: new ( ) ;
3839 module. functions . retain ( |f| {
3940 if should_inline ( & disallowed_argument_types, & disallowed_return_types, f) {
4041 if has_dont_inline ( f) {
41- sess. warn ( & format ! (
42- "Function `{}` has `dont_inline` attribute, but need to be inlined because it has illegal argument or return types" ,
43- get_name( & get_names( module) , f. def_id( ) . unwrap( ) )
44- ) ) ;
42+ inlined_dont_inlines. push ( f. def_id ( ) . unwrap ( ) ) ;
4543 }
4644 // TODO: We should insert all defined IDs in this function.
4745 dropped_ids. insert ( f. def_id ( ) . unwrap ( ) ) ;
@@ -50,6 +48,16 @@ pub fn inline(sess: &Session, module: &mut Module) -> super::Result<()> {
5048 true
5149 }
5250 } ) ;
51+ if !inlined_dont_inlines. is_empty ( ) {
52+ let names = get_names ( module) ;
53+ for f in inlined_dont_inlines {
54+ sess. warn ( & format ! (
55+ "Function `{}` has `dont_inline` attribute, but need to be inlined because it has illegal argument or return types" ,
56+ get_name( & names, f)
57+ ) ) ;
58+ }
59+ }
60+
5361 // Drop OpName etc. for inlined functions
5462 module. debug_names . retain ( |inst| {
5563 !inst. operands . iter ( ) . any ( |op| {
@@ -208,15 +216,12 @@ fn compute_disallowed_argument_and_return_types(
208216 ( disallowed_argument_types, disallowed_return_types)
209217}
210218
211- fn has_dont_inline (
212- function : & Function ,
213- ) -> bool {
219+ fn has_dont_inline ( function : & Function ) -> bool {
214220 let def = function. def . as_ref ( ) . unwrap ( ) ;
215221 let control = def. operands [ 0 ] . unwrap_function_control ( ) ;
216222 control. contains ( FunctionControl :: DONT_INLINE )
217223}
218224
219-
220225fn should_inline (
221226 disallowed_argument_types : & FxHashSet < Word > ,
222227 disallowed_return_types : & FxHashSet < Word > ,
0 commit comments