@@ -138,12 +138,7 @@ impl Inliner<'tcx> {
138138 ) ;
139139
140140 let start = caller_body. basic_blocks ( ) . len ( ) ;
141- debug ! ( "attempting to inline callsite {:?} - body={:?}" , callsite, callee_body) ;
142- if !self . inline_call ( callsite, caller_body, callee_body) {
143- debug ! ( "attempting to inline callsite {:?} - failure" , callsite) ;
144- continue ;
145- }
146- debug ! ( "attempting to inline callsite {:?} - success" , callsite) ;
141+ self . inline_call ( callsite, caller_body, callee_body) ;
147142
148143 // Add callsites from inlined function
149144 for ( bb, bb_data) in caller_body. basic_blocks ( ) . iter_enumerated ( ) . skip ( start) {
@@ -179,7 +174,8 @@ impl Inliner<'tcx> {
179174
180175 // Only consider direct calls to functions
181176 let terminator = bb_data. terminator ( ) ;
182- if let TerminatorKind :: Call { func : ref op, .. } = terminator. kind {
177+ // FIXME: Handle inlining of diverging calls
178+ if let TerminatorKind :: Call { func : ref op, destination : Some ( _) , .. } = terminator. kind {
183179 if let ty:: FnDef ( callee_def_id, substs) = * op. ty ( caller_body, self . tcx ) . kind ( ) {
184180 // To resolve an instance its substs have to be fully normalized, so
185181 // we do this here.
@@ -397,12 +393,11 @@ impl Inliner<'tcx> {
397393 callsite : CallSite < ' tcx > ,
398394 caller_body : & mut Body < ' tcx > ,
399395 mut callee_body : Body < ' tcx > ,
400- ) -> bool {
396+ ) {
401397 let terminator = caller_body[ callsite. bb ] . terminator . take ( ) . unwrap ( ) ;
402398 match terminator. kind {
403- // FIXME: Handle inlining of diverging calls
404399 TerminatorKind :: Call { args, destination : Some ( destination) , cleanup, .. } => {
405- debug ! ( "inlined {:? } into {:?}" , callsite. callee, caller_body. source) ;
400+ debug ! ( "inlined {} into {:?}" , callsite. callee, caller_body. source. instance ) ;
406401
407402 // If the call is something like `a[*i] = f(i)`, where
408403 // `i : &mut usize`, then just duplicating the `a[*i]`
@@ -519,14 +514,8 @@ impl Inliner<'tcx> {
519514 matches ! ( constant. literal. val, ConstKind :: Unevaluated ( _, _, _) )
520515 } ) ,
521516 ) ;
522-
523- true
524- }
525- kind => {
526- caller_body[ callsite. bb ] . terminator =
527- Some ( Terminator { source_info : terminator. source_info , kind } ) ;
528- false
529517 }
518+ kind => bug ! ( "unexpected terminator kind {:?}" , kind) ,
530519 }
531520 }
532521
0 commit comments