1 // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s
3 typedef unsigned int size_t;
6 @interface NSMutableArray
7 - (id)objectAtIndexedSubscript:(size_t)index;
8 - (void)setObject:(id)object atIndexedSubscript:(size_t)index;
11 @interface NSMutableDictionary
12 - (id)objectForKeyedSubscript:(id)key;
13 - (void)setObject:(id)object forKeyedSubscript:(id)key;
17 NSMutableArray *array;
20 id oldObject = array[10];
21 // CHECK: [[ARR:%.*]] = load {{.*}} [[array:%.*]], align 8
22 // CHECK-NEXT: [[SEL:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_
23 // CHECK-NEXT: [[CALL:%.*]] = call ptr @objc_msgSend(ptr noundef [[ARR]], ptr noundef [[SEL]], i32 noundef 10)
24 // CHECK-NEXT: store ptr [[CALL]], ptr [[OLDOBJ:%.*]], align 8
26 val = (array[10] = oldObject);
27 // CHECK: [[FOUR:%.*]] = load ptr, ptr [[oldObject:%.*]], align 8
28 // CHECK-NEXT: [[THREE:%.*]] = load {{.*}} [[array:%.*]], align 8
29 // CHECK-NEXT: [[FIVE:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.2
30 // CHECK-NEXT: call void @objc_msgSend(ptr noundef [[THREE]], ptr noundef [[FIVE]], ptr noundef [[FOUR]], i32 noundef 10)
31 // CHECK-NEXT: store ptr [[FOUR]], ptr [[val:%.*]]
33 NSMutableDictionary *dictionary;
36 oldObject = dictionary[key];
37 // CHECK: [[SEVEN:%.*]] = load {{.*}} [[DICTIONARY:%.*]], align 8
38 // CHECK-NEXT: [[EIGHT:%.*]] = load ptr, ptr [[KEY:%.*]], align 8
39 // CHECK-NEXT: [[TEN:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.4
40 // CHECK-NEXT: [[CALL1:%.*]] = call ptr @objc_msgSend(ptr noundef [[SEVEN]], ptr noundef [[TEN]], ptr noundef [[EIGHT]])
41 // CHECK-NEXT: store ptr [[CALL1]], ptr [[oldObject:%.*]], align 8
44 val = (dictionary[key] = newObject);
45 // CHECK: [[FOURTEEN:%.*]] = load ptr, ptr [[NEWOBJECT:%.*]], align 8
46 // CHECK-NEXT: [[TWELVE:%.*]] = load {{.*}} [[DICTIONARY]], align 8
47 // CHECK-NEXT: [[THIRTEEN:%.*]] = load ptr, ptr [[KEY]], align 8
48 // CHECK-NEXT: [[SIXTEEN:%.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_.6
49 // CHECK-NEXT: call void @objc_msgSend(ptr noundef [[TWELVE]], ptr noundef [[SIXTEEN]], ptr noundef [[FOURTEEN]], ptr noundef [[THIRTEEN]])
50 // CHECK-NEXT: store ptr [[FOURTEEN]], ptr [[val:%.*]]