@@ -394,6 +394,20 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
394394 line_spans,
395395 } ) => {
396396 use rustc_middle:: { mir, thir} ;
397+
398+ let destination_block = this. cfg . start_new_block ( ) ;
399+ let mut targets = if options. contains ( InlineAsmOptions :: NORETURN ) {
400+ vec ! [ ]
401+ } else {
402+ this. cfg . push_assign_unit (
403+ destination_block,
404+ source_info,
405+ destination,
406+ this. tcx ,
407+ ) ;
408+ vec ! [ destination_block]
409+ } ;
410+
397411 let operands = operands
398412 . into_iter ( )
399413 . map ( |op| match * op {
@@ -449,17 +463,24 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
449463 thir:: InlineAsmOperand :: SymStatic { def_id } => {
450464 mir:: InlineAsmOperand :: SymStatic { def_id }
451465 }
452- thir:: InlineAsmOperand :: Label { .. } => {
453- todo ! ( )
466+ thir:: InlineAsmOperand :: Label { block } => {
467+ let target = this. cfg . start_new_block ( ) ;
468+ let target_index = targets. len ( ) ;
469+ targets. push ( target) ;
470+
471+ let tmp = this. get_unit_temp ( ) ;
472+ let target = unpack ! ( this. ast_block( tmp, target, block, source_info) ) ;
473+ this. cfg . terminate (
474+ target,
475+ source_info,
476+ TerminatorKind :: Goto { target : destination_block } ,
477+ ) ;
478+
479+ mir:: InlineAsmOperand :: Label { target_index }
454480 }
455481 } )
456482 . collect ( ) ;
457483
458- if !options. contains ( InlineAsmOptions :: NORETURN ) {
459- this. cfg . push_assign_unit ( block, source_info, destination, this. tcx ) ;
460- }
461-
462- let destination_block = this. cfg . start_new_block ( ) ;
463484 this. cfg . terminate (
464485 block,
465486 source_info,
@@ -468,11 +489,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
468489 operands,
469490 options,
470491 line_spans,
471- targets : if options. contains ( InlineAsmOptions :: NORETURN ) {
472- Vec :: new ( )
473- } else {
474- vec ! [ destination_block]
475- } ,
492+ targets,
476493 unwind : if options. contains ( InlineAsmOptions :: MAY_UNWIND ) {
477494 UnwindAction :: Continue
478495 } else {
0 commit comments