@@ -4,6 +4,7 @@ use rustc_abi::{Align, BackendRepr, ExternAbi, HasDataLayout, Reg, Size, Wrappin
44use rustc_ast as ast;
55use rustc_ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
66use rustc_data_structures:: packed:: Pu128 ;
7+ use rustc_hir:: attrs:: AttributeKind ;
78use rustc_hir:: lang_items:: LangItem ;
89use rustc_lint_defs:: builtin:: TAIL_CALL_TRACK_CALLER ;
910use rustc_middle:: mir:: { self , AssertKind , InlineAsmMacro , SwitchTargets , UnwindTerminateReason } ;
@@ -135,6 +136,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
135136 bx : & mut Bx ,
136137 target : mir:: BasicBlock ,
137138 mergeable_succ : bool ,
139+ attributes : & [ AttributeKind ] ,
138140 ) -> MergingSucc {
139141 let ( needs_landing_pad, is_cleanupret) = self . llbb_characteristics ( fx, target) ;
140142 if mergeable_succ && !needs_landing_pad && !is_cleanupret {
@@ -150,7 +152,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
150152 // to a trampoline.
151153 bx. cleanup_ret ( self . funclet ( fx) . unwrap ( ) , Some ( lltarget) ) ;
152154 } else {
153- bx. br ( lltarget) ;
155+ bx. br_with_attrs ( lltarget, attributes ) ;
154156 }
155157 MergingSucc :: False
156158 }
@@ -291,7 +293,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
291293 bx. lifetime_end ( tmp, size) ;
292294 }
293295 fx. store_return ( bx, ret_dest, & fn_abi. ret , llret) ;
294- self . funclet_br ( fx, bx, target, mergeable_succ)
296+ self . funclet_br ( fx, bx, target, mergeable_succ, & [ ] )
295297 } else {
296298 bx. unreachable ( ) ;
297299 MergingSucc :: False
@@ -359,7 +361,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
359361 bx. codegen_inline_asm ( template, operands, options, line_spans, instance, None , None ) ;
360362
361363 if let Some ( target) = destination {
362- self . funclet_br ( fx, bx, target, mergeable_succ)
364+ self . funclet_br ( fx, bx, target, mergeable_succ, & [ ] )
363365 } else {
364366 bx. unreachable ( ) ;
365367 MergingSucc :: False
@@ -618,7 +620,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
618620
619621 if let ty:: InstanceKind :: DropGlue ( _, None ) = drop_fn. def {
620622 // we don't actually need to drop anything.
621- return helper. funclet_br ( self , bx, target, mergeable_succ) ;
623+ return helper. funclet_br ( self , bx, target, mergeable_succ, & [ ] ) ;
622624 }
623625
624626 let place = self . codegen_place ( bx, location. as_ref ( ) ) ;
@@ -727,7 +729,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
727729
728730 // Don't codegen the panic block if success if known.
729731 if const_cond == Some ( expected) {
730- return helper. funclet_br ( self , bx, target, mergeable_succ) ;
732+ return helper. funclet_br ( self , bx, target, mergeable_succ, & [ ] ) ;
731733 }
732734
733735 // Because we're branching to a panic block (either a `#[cold]` one
@@ -861,7 +863,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
861863 if is_valid {
862864 // a NOP
863865 let target = target. unwrap ( ) ;
864- return Some ( helper. funclet_br ( self , bx, target, mergeable_succ) ) ;
866+ return Some ( helper. funclet_br ( self , bx, target, mergeable_succ, & [ ] ) ) ;
865867 }
866868
867869 let layout = bx. layout_of ( ty) ;
@@ -935,7 +937,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
935937 ty:: InstanceKind :: DropGlue ( _, None ) => {
936938 // Empty drop glue; a no-op.
937939 let target = target. unwrap ( ) ;
938- return helper. funclet_br ( self , bx, target, mergeable_succ) ;
940+ return helper. funclet_br ( self , bx, target, mergeable_succ, & [ ] ) ;
939941 }
940942 ty:: InstanceKind :: Intrinsic ( def_id) => {
941943 let intrinsic = bx. tcx ( ) . intrinsic ( def_id) . unwrap ( ) ;
@@ -1023,7 +1025,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10231025 match intrinsic_result {
10241026 IntrinsicResult :: Operand ( _) | IntrinsicResult :: WroteIntoPlace => {
10251027 return if let Some ( target) = target {
1026- helper. funclet_br ( self , bx, target, mergeable_succ)
1028+ helper. funclet_br ( self , bx, target, mergeable_succ, & [ ] )
10271029 } else {
10281030 bx. unreachable ( ) ;
10291031 MergingSucc :: False
@@ -1133,7 +1135,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11331135 & ArgAbi { layout : result_layout, mode : PassMode :: Direct ( ArgAttributes :: new ( ) ) } ,
11341136 llret,
11351137 ) ;
1136- return helper. funclet_br ( self , bx, target, mergeable_succ) ;
1138+ return helper. funclet_br ( self , bx, target, mergeable_succ, & [ ] ) ;
11371139 } else {
11381140 bx. unreachable ( ) ;
11391141 return MergingSucc :: False ;
@@ -1577,7 +1579,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
15771579 }
15781580
15791581 mir:: TerminatorKind :: Goto { target } => {
1580- helper. funclet_br ( self , bx, target, mergeable_succ ( ) )
1582+ helper. funclet_br ( self , bx, target, mergeable_succ ( ) , & terminator . attributes )
15811583 }
15821584
15831585 mir:: TerminatorKind :: SwitchInt { ref discr, ref targets } => {
0 commit comments