1; RUN: llc -mtriple=thumbv4t-linux-gnueabi -o - %s | FileCheck %s 2 3; Functions may have more features than the base triple; code generation and 4; instruction selection may be performed based on this information. This test 5; makes sure that the MC layer performs instruction relaxation based on the 6; target-features of the function. The relaxation for tail call is particularly 7; important on Thumb2 as the 16-bit Thumb branch instruction has an extremely 8; short range. 9 10declare dso_local void @g(...) local_unnamed_addr #2 11 12define dso_local void @f() local_unnamed_addr #0 { 13entry: 14 tail call void bitcast (void (...)* @g to void ()*)() #3 15 ret void 16} 17; Function has thumb2 target-feature, tail call is allowed and must be widened. 18; CHECK: f: 19; CHECK: b g 20 21define dso_local void @h() local_unnamed_addr #2 { 22entry: 23 tail call void bitcast (void (...)* @g to void ()*)() #3 24 ret void 25} 26; Function does not have thumb2 target-feature, tail call should not be 27; generated as it cannot be widened. 28; CHECK: h: 29; CHECK: bl g 30 31attributes #0 = { nounwind "disable-tail-calls"="false" "target-cpu"="cortex-a53" "target-features"="+crypto,+fp-armv8,+neon,+soft-float-abi,+strict-align,+thumb-mode,-crc,-dotprod,-dsp,-hwdiv,-hwdiv-arm,-ras" "use-soft-float"="true" } 32 33attributes #2 = { nounwind "disable-tail-calls"="false" "target-cpu"="arm7tdmi" "target-features"="+strict-align,+thumb-mode,-crc,-dotprod,-dsp,-hwdiv,-hwdiv-arm,-ras" "unsafe-fp-math"="false" "use-soft-float"="true" } 34attributes #3 = { nounwind } 35