1 // RUN: %clang -S -target armv7l-unknown-linux-gnueabihf -emit-llvm -O1 -mllvm -disable-llvm-optzns -S %s -o - | FileCheck %s
2
3 // This test should not to generate llvm.lifetime.start/llvm.lifetime.end for
4 // f function because all temporary objects in this function are used for the
5 // final result
6
7 class S {
8 char *ptr;
9 unsigned int len;
10 };
11
12 class T {
13 S left;
14 S right;
15
16 public:
17 T(const char s[]);
18 T(S);
19
20 T concat(const T &Suffix) const;
21 const char * str() const;
22 };
23
f(S s)24 const char * f(S s)
25 {
26 // CHECK: [[T1:%.*]] = alloca %class.T, align 4
27 // CHECK: [[T2:%.*]] = alloca %class.T, align 4
28 // CHECK: [[T3:%.*]] = alloca %class.T, align 4
29 // CHECK: [[T4:%.*]] = call %class.T* @_ZN1TC1EPKc(%class.T* [[T1]], i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0))
30 // CHECK: [[T5:%.*]] = call %class.T* @_ZN1TC1E1S(%class.T* [[T2]], [2 x i32] %{{.*}})
31 // CHECK: call void @_ZNK1T6concatERKS_(%class.T* sret [[T3]], %class.T* [[T1]], %class.T* dereferenceable(16) [[T2]])
32 // CHECK: [[T6:%.*]] = call i8* @_ZNK1T3strEv(%class.T* [[T3]])
33 // CHECK: ret i8* [[T6]]
34
35 return T("[").concat(T(s)).str();
36 }
37