@@ -138,12 +138,7 @@ impl Inliner<'tcx> {
138
138
) ;
139
139
140
140
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) ;
147
142
148
143
// Add callsites from inlined function
149
144
for ( bb, bb_data) in caller_body. basic_blocks ( ) . iter_enumerated ( ) . skip ( start) {
@@ -179,7 +174,8 @@ impl Inliner<'tcx> {
179
174
180
175
// Only consider direct calls to functions
181
176
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 {
183
179
if let ty:: FnDef ( callee_def_id, substs) = * op. ty ( caller_body, self . tcx ) . kind ( ) {
184
180
// To resolve an instance its substs have to be fully normalized, so
185
181
// we do this here.
@@ -397,12 +393,11 @@ impl Inliner<'tcx> {
397
393
callsite : CallSite < ' tcx > ,
398
394
caller_body : & mut Body < ' tcx > ,
399
395
mut callee_body : Body < ' tcx > ,
400
- ) -> bool {
396
+ ) {
401
397
let terminator = caller_body[ callsite. bb ] . terminator . take ( ) . unwrap ( ) ;
402
398
match terminator. kind {
403
- // FIXME: Handle inlining of diverging calls
404
399
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 ) ;
406
401
407
402
// If the call is something like `a[*i] = f(i)`, where
408
403
// `i : &mut usize`, then just duplicating the `a[*i]`
@@ -519,14 +514,8 @@ impl Inliner<'tcx> {
519
514
matches ! ( constant. literal. val, ConstKind :: Unevaluated ( _, _, _) )
520
515
} ) ,
521
516
) ;
522
-
523
- true
524
- }
525
- kind => {
526
- caller_body[ callsite. bb ] . terminator =
527
- Some ( Terminator { source_info : terminator. source_info , kind } ) ;
528
- false
529
517
}
518
+ kind => bug ! ( "unexpected terminator kind {:?}" , kind) ,
530
519
}
531
520
}
532
521
0 commit comments