37 lines · plain
1// RUN: %clang_cc1 -emit-llvm -o - -fblocks %s -O1 -fno-inline-functions -triple x86_64-apple-darwin10.0.0 -fobjc-runtime=macosx-fragile-10.5 | FileCheck %s2 3// PR108354struct X {5 X();6 X(const X&);7 ~X();8};9 10@interface NRVO11@end12 13@implementation NRVO14// CHECK: define internal void @"\01-[NRVO getNRVO]"15- (X)getNRVO { 16 X x;17 // CHECK: call void @_ZN1XC1Ev18 // CHECK-NEXT: ret void19 return x;20}21@end22 23X blocksNRVO() {24 return ^{25 // With the optimizer enabled, the DeadArgElim pass is able to26 // mark the block litteral address argument as unused and later the27 // related block_litteral global variable is removed.28 // This allows to promote this call to a fastcc call.29 // CHECK-LABEL: define internal fastcc void @___Z10blocksNRVOv_block_invoke30 X x;31 // CHECK: call void @_ZN1XC1Ev32 // CHECK-NEXT: ret void33 return x;34 }() ;35}36 37