diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2014-03-06 06:10:02 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2014-03-06 06:10:02 +0000 |
| commit | 5ec8fe19cf10d64f17ba24e066c7450ee95abecb (patch) | |
| tree | 4e8863b01b86325e1b3174def88267f2ddaf875b /clang/test/CodeGenObjC | |
| parent | 0a685a9a52e1471a9ee15fe6ed7a0b25b7915a3f (diff) | |
| download | bcm5719-llvm-5ec8fe19cf10d64f17ba24e066c7450ee95abecb.tar.gz bcm5719-llvm-5ec8fe19cf10d64f17ba24e066c7450ee95abecb.zip | |
PGO: add instrumentation for Objective-C methods.
llvm-svn: 203085
Diffstat (limited to 'clang/test/CodeGenObjC')
| -rw-r--r-- | clang/test/CodeGenObjC/Inputs/instr-profile.profdata | 2 | ||||
| -rw-r--r-- | clang/test/CodeGenObjC/instr-profile.m | 32 |
2 files changed, 28 insertions, 6 deletions
diff --git a/clang/test/CodeGenObjC/Inputs/instr-profile.profdata b/clang/test/CodeGenObjC/Inputs/instr-profile.profdata index f3c03cc7930..f068640dbca 100644 --- a/clang/test/CodeGenObjC/Inputs/instr-profile.profdata +++ b/clang/test/CodeGenObjC/Inputs/instr-profile.profdata @@ -1,4 +1,4 @@ -foreach 2 +instr-profile.m:+[A foreach:] 2 1 2 diff --git a/clang/test/CodeGenObjC/instr-profile.m b/clang/test/CodeGenObjC/instr-profile.m index e1b13edf215..f232d985d83 100644 --- a/clang/test/CodeGenObjC/instr-profile.m +++ b/clang/test/CodeGenObjC/instr-profile.m @@ -8,11 +8,24 @@ // RUN: %clang %s -o - -emit-llvm -S -fprofile-instr-use=%S/Inputs/instr-profile.profdata | FileCheck -check-prefix=PGOUSE %s #ifdef HAVE_FOUNDATION + // Use this to build an instrumented version to regenerate the input file. #import <Foundation/Foundation.h> + #else + +// Minimal definitions to get this to compile without Foundation.h. + +@protocol NSObject +@end + +@interface NSObject <NSObject> +- (id)init; ++ (id)alloc; +@end + struct NSFastEnumerationState; -@interface NSArray +@interface NSArray : NSObject - (unsigned long) countByEnumeratingWithState: (struct NSFastEnumerationState*) state objects: (id*) buffer count: (unsigned long) bufferSize; @@ -22,17 +35,26 @@ struct NSFastEnumerationState; // PGOGEN: @[[FOR:__llvm_pgo_ctr[0-9]*]] = private global [2 x i64] zeroinitializer -// PGOGEN-LABEL: @foreach -// PGOUSE-LABEL: @foreach +@interface A : NSObject ++ (void)foreach: (NSArray *)array; +@end + +@implementation A +// PGOGEN-LABEL: define {{.*}}+[A foreach:] +// PGOUSE-LABEL: define {{.*}}+[A foreach:] // PGOGEN: store {{.*}} @[[FOR]], i64 0, i64 0 -void foreach(NSArray *array) { ++ (void)foreach: (NSArray *)array +{ // PGOGEN: store {{.*}} @[[FOR]], i64 0, i64 1 // FIXME: We don't emit branch weights for this yet. for (id x in array) { } } +@end int main(int argc, const char *argv[]) { + A *a = [[A alloc] init]; NSArray *array = [NSArray arrayWithObjects: @"0", @"1", (void*)0]; - foreach(array); + [A foreach: array]; + return 0; } |

