46 lines · plain
1; RUN: llc -relocation-model=static -verify-machineinstrs -O2 < %s | FileCheck %s2 3; The call to function TestBar should be a tail call, when in C++ the string4; `ret` is RVO returned.5; string TestFoo() {6; string ret = undef;7; TestBar(&ret); // tail call optimized8; return ret;9; }10 11target triple = "powerpc64le-linux-gnu"12 13%class.basic_string.11.42.73 = type { %"class.__gnu_cxx::__versa_string.10.41.72" }14%"class.__gnu_cxx::__versa_string.10.41.72" = type { %"class.__gnu_cxx::__sso_string_base.9.40.71" }15%"class.__gnu_cxx::__sso_string_base.9.40.71" = type { %"struct.__gnu_cxx::__vstring_utility<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider.7.38.69", i64, %union.anon.8.39.70 }16%"struct.__gnu_cxx::__vstring_utility<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider.7.38.69" = type { ptr }17%union.anon.8.39.70 = type { i64, [8 x i8] }18 19declare void @TestBaz(ptr noalias sret(%class.basic_string.11.42.73) %arg)20 21define dso_local void @TestBar(ptr noalias sret(%class.basic_string.11.42.73) %arg) {22bb:23 call void @TestBaz(ptr noalias sret(%class.basic_string.11.42.73) %arg)24 ret void25}26 27define dso_local void @TestFoo(ptr noalias sret(%class.basic_string.11.42.73) %arg) {28; CHECK-LABEL: TestFoo:29; CHECK: #TC_RETURNd8 TestBar 030bb:31 %tmp = getelementptr inbounds %class.basic_string.11.42.73, ptr %arg, i64 0, i32 0, i32 0, i32 232 store ptr %tmp, ptr %arg, align 833 tail call void @llvm.memcpy.p0.p0.i64(ptr %tmp, ptr nonnull undef, i64 13, i1 false)34 %tmp3 = getelementptr inbounds %class.basic_string.11.42.73, ptr %arg, i64 0, i32 0, i32 0, i32 135 store i64 13, ptr %tmp3, align 836 %tmp4 = getelementptr inbounds %class.basic_string.11.42.73, ptr %arg, i64 0, i32 0, i32 0, i32 2, i32 1, i64 537 store i8 0, ptr %tmp4, align 138 tail call void @TestBar(ptr noalias sret(%class.basic_string.11.42.73) %arg)39 ret void40}41 42; Function Attrs: argmemonly nounwind43declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) #044 45attributes #0 = { argmemonly nounwind }46