2015-11-18 22:40:41 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -O0 -emit-llvm %s -o - | FileCheck %s
|
2014-03-05 02:34:52 +08:00
|
|
|
// rdar://16095748
|
|
|
|
|
2019-01-18 02:18:53 +08:00
|
|
|
@interface MyNSObject
|
2014-03-05 02:34:52 +08:00
|
|
|
@end
|
|
|
|
|
2019-01-18 02:18:53 +08:00
|
|
|
@interface SampleClass : MyNSObject {
|
2014-03-05 02:34:52 +08:00
|
|
|
@public
|
|
|
|
int _value;
|
|
|
|
}
|
|
|
|
+ (SampleClass*) new;
|
|
|
|
@end
|
|
|
|
|
2019-01-18 02:18:53 +08:00
|
|
|
@interface AppDelegate : MyNSObject
|
2014-03-05 02:34:52 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
extern void foo(int);
|
|
|
|
|
|
|
|
@implementation AppDelegate
|
|
|
|
- (void)application
|
|
|
|
{
|
|
|
|
// Create set of objects in loop
|
|
|
|
for(int i = 0; i < 2; i++) {
|
|
|
|
SampleClass *sample = [SampleClass new];
|
|
|
|
foo (sample->_value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@end
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: [[IVAR:%.*]] = load i64, i64* @"OBJC_IVAR_$_SampleClass._value", align 8
|
2014-03-05 02:34:52 +08:00
|
|
|
// CHECK: [[THREE:%.*]] = bitcast [[ONE:%.*]]* [[CALL:%.*]] to i8*
|
2015-02-28 03:18:17 +08:00
|
|
|
// CHECK: [[ADDPTR:%.*]] = getelementptr inbounds i8, i8* [[THREE]], i64 [[IVAR]]
|
2014-03-05 02:34:52 +08:00
|
|
|
// CHECK: [[FOUR:%.*]] = bitcast i8* [[ADDPTR]] to i32*
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: [[FIVE:%.*]] = load i32, i32* [[FOUR]], align 4
|
2015-11-18 22:40:41 +08:00
|
|
|
// CHECK: call void @foo(i32 [[FIVE]])
|
2014-03-05 02:34:52 +08:00
|
|
|
|
|
|
|
@implementation SampleClass
|
|
|
|
+ (SampleClass*) new { return 0; }
|
|
|
|
- (void) SampleClassApplication
|
|
|
|
{
|
|
|
|
// Create set of objects in loop
|
|
|
|
for(int i = 0; i < 2; i++) {
|
|
|
|
SampleClass *sample = [SampleClass new];
|
|
|
|
foo (sample->_value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@end
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: [[ZERO:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load
|
|
|
|
// CHECK: [[IVAR:%.*]] = load i64, i64* @"OBJC_IVAR_$_SampleClass._value", align 8, !invariant.load
|
2014-03-05 02:34:52 +08:00
|
|
|
|
|
|
|
@interface Sample : SampleClass @end
|
|
|
|
|
|
|
|
@implementation Sample
|
|
|
|
- (void) SampleApplication
|
|
|
|
{
|
|
|
|
// Create set of objects in loop
|
|
|
|
for(int i = 0; i < 2; i++) {
|
|
|
|
SampleClass *sample = [SampleClass new];
|
|
|
|
foo (sample->_value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@end
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: [[ZERO:%.*]] = load i8*, i8** @OBJC_SELECTOR_REFERENCES_, align 8, !invariant.load
|
|
|
|
// CHECK: [[IVAR:%.*]] = load i64, i64* @"OBJC_IVAR_$_SampleClass._value", align 8, !invariant.load
|
2014-03-05 02:34:52 +08:00
|
|
|
|