-// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
// RUN: | FileCheck -check-prefix=CHECK-X86-64 %s
-// RUN: %clang_cc1 -no-opaque-pointers -triple powerpc64-unknown-unknown -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm -o - %s \
// RUN: | FileCheck -check-prefix=CHECK-PPC64 %s
//
// Tests for bitfield access patterns in C++ with special attention to
};
unsigned read00(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N06read00
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-X86-64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-X86-64: %[[and:.*]] = and i64 %[[val]], 16383
// CHECK-X86-64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
// CHECK-X86-64: ret i32 %[[trunc]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N06read00
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-PPC64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i64 %[[val]], 50
// CHECK-PPC64: %[[trunc:.*]] = trunc i64 %[[shr]] to i32
// CHECK-PPC64: ret i32 %[[trunc]]
}
unsigned read01(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N06read01
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-X86-64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-X86-64: %[[shr:.*]] = lshr i64 %[[val]], 14
// CHECK-X86-64: %[[and:.*]] = and i64 %[[shr]], 3
// CHECK-X86-64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
// CHECK-X86-64: ret i32 %[[trunc]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N06read01
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-PPC64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i64 %[[val]], 48
// CHECK-PPC64: %[[and:.*]] = and i64 %[[shr]], 3
// CHECK-PPC64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
}
unsigned read20(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N06read20
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-X86-64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-X86-64: %[[shr:.*]] = lshr i64 %[[val]], 16
// CHECK-X86-64: %[[and:.*]] = and i64 %[[shr]], 63
// CHECK-X86-64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
// CHECK-X86-64: ret i32 %[[trunc]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N06read20
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-PPC64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i64 %[[val]], 42
// CHECK-PPC64: %[[and:.*]] = and i64 %[[shr]], 63
// CHECK-PPC64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
}
unsigned read21(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N06read21
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-X86-64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-X86-64: %[[shr:.*]] = lshr i64 %[[val]], 22
// CHECK-X86-64: %[[and:.*]] = and i64 %[[shr]], 3
// CHECK-X86-64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
// CHECK-X86-64: ret i32 %[[trunc]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N06read21
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-PPC64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i64 %[[val]], 40
// CHECK-PPC64: %[[and:.*]] = and i64 %[[shr]], 3
// CHECK-PPC64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
}
unsigned read30(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N06read30
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-X86-64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-X86-64: %[[shr:.*]] = lshr i64 %[[val]], 24
// CHECK-X86-64: %[[and:.*]] = and i64 %[[shr]], 1073741823
// CHECK-X86-64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
// CHECK-X86-64: ret i32 %[[trunc]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N06read30
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-PPC64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i64 %[[val]], 10
// CHECK-PPC64: %[[and:.*]] = and i64 %[[shr]], 1073741823
// CHECK-PPC64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
}
unsigned read31(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N06read31
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-X86-64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-X86-64: %[[shr:.*]] = lshr i64 %[[val]], 54
// CHECK-X86-64: %[[and:.*]] = and i64 %[[shr]], 3
// CHECK-X86-64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
// CHECK-X86-64: ret i32 %[[trunc]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N06read31
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-PPC64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i64 %[[val]], 8
// CHECK-PPC64: %[[and:.*]] = and i64 %[[shr]], 3
// CHECK-PPC64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
}
unsigned read70(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N06read70
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-X86-64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-X86-64: %[[shr:.*]] = lshr i64 %[[val]], 56
// CHECK-X86-64: %[[and:.*]] = and i64 %[[shr]], 63
// CHECK-X86-64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
// CHECK-X86-64: ret i32 %[[trunc]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N06read70
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-PPC64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i64 %[[val]], 2
// CHECK-PPC64: %[[and:.*]] = and i64 %[[shr]], 63
// CHECK-PPC64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
}
unsigned read71(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N06read71
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-X86-64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-X86-64: %[[shr:.*]] = lshr i64 %[[val]], 62
// CHECK-X86-64: %[[trunc:.*]] = trunc i64 %[[shr]] to i32
// CHECK-X86-64: ret i32 %[[trunc]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N06read71
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i64*
- // CHECK-PPC64: %[[val:.*]] = load i64, i64* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i64, ptr %{{.*}}
// CHECK-PPC64: %[[and:.*]] = and i64 %[[val]], 3
// CHECK-PPC64: %[[trunc:.*]] = trunc i64 %[[and]] to i32
// CHECK-PPC64: ret i32 %[[trunc]]
};
unsigned read(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N14read
- // CHECK-X86-64: %[[ptr:.*]] = getelementptr inbounds %{{.*}}, %{{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-X86-64: %[[val:.*]] = load i8, i8* %[[ptr]]
+ // CHECK-X86-64: %[[ptr:.*]] = getelementptr inbounds %{{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-X86-64: %[[val:.*]] = load i8, ptr %[[ptr]]
// CHECK-X86-64: %[[and:.*]] = and i8 %[[val]], 1
// CHECK-X86-64: %[[ext:.*]] = zext i8 %[[and]] to i32
// CHECK-X86-64: ret i32 %[[ext]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N14read
- // CHECK-PPC64: %[[ptr:.*]] = getelementptr inbounds %{{.*}}, %{{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-PPC64: %[[val:.*]] = load i8, i8* %[[ptr]]
+ // CHECK-PPC64: %[[ptr:.*]] = getelementptr inbounds %{{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-PPC64: %[[val:.*]] = load i8, ptr %[[ptr]]
// CHECK-PPC64: %[[shr:.*]] = lshr i8 %[[val]], 7
// CHECK-PPC64: %[[ext:.*]] = zext i8 %[[shr]] to i32
// CHECK-PPC64: ret i32 %[[ext]]
}
void write(S* s, unsigned x) {
// CHECK-X86-64-LABEL: define{{.*}} void @_ZN2N15write
- // CHECK-X86-64: %[[ptr:.*]] = getelementptr inbounds %{{.*}}, %{{.*}}* %{{.*}}, i32 0, i32 1
+ // CHECK-X86-64: %[[ptr:.*]] = getelementptr inbounds %{{.*}}, ptr %{{.*}}, i32 0, i32 1
// CHECK-X86-64: %[[x_trunc:.*]] = trunc i32 %{{.*}} to i8
- // CHECK-X86-64: %[[old:.*]] = load i8, i8* %[[ptr]]
+ // CHECK-X86-64: %[[old:.*]] = load i8, ptr %[[ptr]]
// CHECK-X86-64: %[[x_and:.*]] = and i8 %[[x_trunc]], 1
// CHECK-X86-64: %[[old_and:.*]] = and i8 %[[old]], -2
// CHECK-X86-64: %[[new:.*]] = or i8 %[[old_and]], %[[x_and]]
- // CHECK-X86-64: store i8 %[[new]], i8* %[[ptr]]
+ // CHECK-X86-64: store i8 %[[new]], ptr %[[ptr]]
// CHECK-PPC64-LABEL: define{{.*}} void @_ZN2N15write
- // CHECK-PPC64: %[[ptr:.*]] = getelementptr inbounds %{{.*}}, %{{.*}}* %{{.*}}, i32 0, i32 1
+ // CHECK-PPC64: %[[ptr:.*]] = getelementptr inbounds %{{.*}}, ptr %{{.*}}, i32 0, i32 1
// CHECK-PPC64: %[[x_trunc:.*]] = trunc i32 %{{.*}} to i8
- // CHECK-PPC64: %[[old:.*]] = load i8, i8* %[[ptr]]
+ // CHECK-PPC64: %[[old:.*]] = load i8, ptr %[[ptr]]
// CHECK-PPC64: %[[x_and:.*]] = and i8 %[[x_trunc]], 1
// CHECK-PPC64: %[[x_shl:.*]] = shl i8 %[[x_and]], 7
// CHECK-PPC64: %[[old_and:.*]] = and i8 %[[old]], 127
// CHECK-PPC64: %[[new:.*]] = or i8 %[[old_and]], %[[x_shl]]
- // CHECK-PPC64: store i8 %[[new]], i8* %[[ptr]]
+ // CHECK-PPC64: store i8 %[[new]], ptr %[[ptr]]
s->b = x;
}
}
};
unsigned read(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N24read
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-X86-64: %[[val:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i32, ptr %{{.*}}
// CHECK-X86-64: %[[and:.*]] = and i32 %[[val]], 16777215
// CHECK-X86-64: ret i32 %[[and]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N24read
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-PPC64: %[[val:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i32, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i32 %[[val]], 8
// CHECK-PPC64: ret i32 %[[shr]]
return s->b;
}
void write(S* s, unsigned x) {
// CHECK-X86-64-LABEL: define{{.*}} void @_ZN2N25write
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-X86-64: %[[old:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-X86-64: %[[ptr:.*]] = load ptr, ptr %{{.*}}
+ // CHECK-X86-64: %[[old:.*]] = load i32, ptr %[[ptr]]
// CHECK-X86-64: %[[x_and:.*]] = and i32 %{{.*}}, 16777215
// CHECK-X86-64: %[[old_and:.*]] = and i32 %[[old]], -16777216
// CHECK-X86-64: %[[new:.*]] = or i32 %[[old_and]], %[[x_and]]
- // CHECK-X86-64: store i32 %[[new]], i32* %[[ptr]]
+ // CHECK-X86-64: store i32 %[[new]], ptr %{{.*}}
// CHECK-PPC64-LABEL: define{{.*}} void @_ZN2N25write
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-PPC64: %[[old:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-PPC64: %[[ptr:.*]] = load ptr, ptr %{{.*}}
+ // CHECK-PPC64: %[[old:.*]] = load i32, ptr %[[ptr]]
// CHECK-PPC64: %[[x_and:.*]] = and i32 %{{.*}}, 16777215
// CHECK-PPC64: %[[x_shl:.*]] = shl i32 %[[x_and]], 8
// CHECK-PPC64: %[[old_and:.*]] = and i32 %[[old]], 255
// CHECK-PPC64: %[[new:.*]] = or i32 %[[old_and]], %[[x_shl]]
- // CHECK-PPC64: store i32 %[[new]], i32* %[[ptr]]
+ // CHECK-PPC64: store i32 %[[new]], ptr %{{.*}}
s->b = x;
}
}
};
unsigned read(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N34read
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-X86-64: %[[val:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i32, ptr %{{.*}}
// CHECK-X86-64: %[[and:.*]] = and i32 %[[val]], 16777215
// CHECK-X86-64: ret i32 %[[and]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N34read
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-PPC64: %[[val:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i32, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i32 %[[val]], 8
// CHECK-PPC64: ret i32 %[[shr]]
return s->b;
}
void write(S* s, unsigned x) {
// CHECK-X86-64-LABEL: define{{.*}} void @_ZN2N35write
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-X86-64: %[[old:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-X86-64: %[[ptr:.*]] = load ptr, ptr %{{.*}}
+ // CHECK-X86-64: %[[old:.*]] = load i32, ptr %[[ptr]]
// CHECK-X86-64: %[[x_and:.*]] = and i32 %{{.*}}, 16777215
// CHECK-X86-64: %[[old_and:.*]] = and i32 %[[old]], -16777216
// CHECK-X86-64: %[[new:.*]] = or i32 %[[old_and]], %[[x_and]]
- // CHECK-X86-64: store i32 %[[new]], i32* %[[ptr]]
+ // CHECK-X86-64: store i32 %[[new]], ptr %{{.*}}
// CHECK-PPC64-LABEL: define{{.*}} void @_ZN2N35write
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-PPC64: %[[old:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-PPC64: %[[ptr:.*]] = load ptr, ptr %{{.*}}
+ // CHECK-PPC64: %[[old:.*]] = load i32, ptr %[[ptr]]
// CHECK-PPC64: %[[x_and:.*]] = and i32 %{{.*}}, 16777215
// CHECK-PPC64: %[[x_shl:.*]] = shl i32 %[[x_and]], 8
// CHECK-PPC64: %[[old_and:.*]] = and i32 %[[old]], 255
// CHECK-PPC64: %[[new:.*]] = or i32 %[[old_and]], %[[x_shl]]
- // CHECK-PPC64: store i32 %[[new]], i32* %[[ptr]]
+ // CHECK-PPC64: store i32 %[[new]], ptr %{{.*}}
s->b = x;
}
}
// instrumented by ThreadSanitizer.
//
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N44read
- // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-X86-64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
- // CHECK-X86-64: %[[val:.*]] = load i24, i24* %[[ptr]]
+ // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-X86-64: %[[val:.*]] = load i24, ptr %[[gep]]
// CHECK-X86-64: %[[ext:.*]] = zext i24 %[[val]] to i32
// CHECK-X86-64: ret i32 %[[ext]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N44read
- // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-PPC64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
- // CHECK-PPC64: %[[val:.*]] = load i24, i24* %[[ptr]]
+ // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-PPC64: %[[val:.*]] = load i24, ptr %[[gep]]
// CHECK-PPC64: %[[ext:.*]] = zext i24 %[[val]] to i32
// CHECK-PPC64: ret i32 %[[ext]]
return s->b;
}
void write(Base* s, unsigned x) {
// CHECK-X86-64-LABEL: define{{.*}} void @_ZN2N45write
- // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-X86-64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
+ // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
// CHECK-X86-64: %[[new:.*]] = trunc i32 %{{.*}} to i24
- // CHECK-X86-64: store i24 %[[new]], i24* %[[ptr]]
+ // CHECK-X86-64: store i24 %[[new]], ptr %[[gep]]
// CHECK-PPC64-LABEL: define{{.*}} void @_ZN2N45write
- // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-PPC64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
+ // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
// CHECK-PPC64: %[[new:.*]] = trunc i32 %{{.*}} to i24
- // CHECK-PPC64: store i24 %[[new]], i24* %[[ptr]]
+ // CHECK-PPC64: store i24 %[[new]], ptr %[[gep]]
s->b = x;
}
}
};
unsigned read(U* u) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N54read
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-X86-64: %[[val:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-X86-64: %[[val:.*]] = load i32, ptr %{{.*}}
// CHECK-X86-64: %[[and:.*]] = and i32 %[[val]], 16777215
// CHECK-X86-64: ret i32 %[[and]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N54read
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-PPC64: %[[val:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-PPC64: %[[val:.*]] = load i32, ptr %{{.*}}
// CHECK-PPC64: %[[shr:.*]] = lshr i32 %[[val]], 8
// CHECK-PPC64: ret i32 %[[shr]]
return u->y.b;
}
void write(U* u, unsigned x) {
// CHECK-X86-64-LABEL: define{{.*}} void @_ZN2N55write
- // CHECK-X86-64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-X86-64: %[[old:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-X86-64: %[[ptr:.*]] = load ptr, ptr %{{.*}}
+ // CHECK-X86-64: %[[old:.*]] = load i32, ptr %[[ptr]]
// CHECK-X86-64: %[[x_and:.*]] = and i32 %{{.*}}, 16777215
// CHECK-X86-64: %[[old_and:.*]] = and i32 %[[old]], -16777216
// CHECK-X86-64: %[[new:.*]] = or i32 %[[old_and]], %[[x_and]]
- // CHECK-X86-64: store i32 %[[new]], i32* %[[ptr]]
+ // CHECK-X86-64: store i32 %[[new]], ptr %{{.*}}
// CHECK-PPC64-LABEL: define{{.*}} void @_ZN2N55write
- // CHECK-PPC64: %[[ptr:.*]] = bitcast %{{.*}}* %{{.*}} to i32*
- // CHECK-PPC64: %[[old:.*]] = load i32, i32* %[[ptr]]
+ // CHECK-PPC64: %[[ptr:.*]] = load ptr, ptr %{{.*}}
+ // CHECK-PPC64: %[[old:.*]] = load i32, ptr %[[ptr]]
// CHECK-PPC64: %[[x_and:.*]] = and i32 %{{.*}}, 16777215
// CHECK-PPC64: %[[x_shl:.*]] = shl i32 %[[x_and]], 8
// CHECK-PPC64: %[[old_and:.*]] = and i32 %[[old]], 255
// CHECK-PPC64: %[[new:.*]] = or i32 %[[old_and]], %[[x_shl]]
- // CHECK-PPC64: store i32 %[[new]], i32* %[[ptr]]
+ // CHECK-PPC64: store i32 %[[new]], ptr %{{.*}}
u->y.b = x;
}
}
};
unsigned read(S* s) {
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N64read
- // CHECK-X86-64: %[[ptr1:.*]] = bitcast {{.*}}* %{{.*}} to i24*
- // CHECK-X86-64: %[[val1:.*]] = load i24, i24* %[[ptr1]]
+ // CHECK-X86-64: %[[val1:.*]] = load i24, ptr %{{.*}}
// CHECK-X86-64: %[[ext1:.*]] = zext i24 %[[val1]] to i32
- // CHECK-X86-64: %[[ptr2:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-X86-64: %[[val2:.*]] = load i8, i8* %[[ptr2]]
+ // CHECK-X86-64: %[[ptr2:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-X86-64: %[[val2:.*]] = load i8, ptr %[[ptr2]]
// CHECK-X86-64: %[[ext2:.*]] = zext i8 %[[val2]] to i32
// CHECK-X86-64: %[[add:.*]] = add nsw i32 %[[ext1]], %[[ext2]]
// CHECK-X86-64: ret i32 %[[add]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N64read
- // CHECK-PPC64: %[[ptr1:.*]] = bitcast {{.*}}* %{{.*}} to i24*
- // CHECK-PPC64: %[[val1:.*]] = load i24, i24* %[[ptr1]]
+ // CHECK-PPC64: %[[val1:.*]] = load i24, ptr %{{.*}}
// CHECK-PPC64: %[[ext1:.*]] = zext i24 %[[val1]] to i32
- // CHECK-PPC64: %[[ptr2:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-PPC64: %[[val2:.*]] = load i8, i8* %[[ptr2]]
+ // CHECK-PPC64: %[[ptr2:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-PPC64: %[[val2:.*]] = load i8, ptr %[[ptr2]]
// CHECK-PPC64: %[[ext2:.*]] = zext i8 %[[val2]] to i32
// CHECK-PPC64: %[[add:.*]] = add nsw i32 %[[ext1]], %[[ext2]]
// CHECK-PPC64: ret i32 %[[add]]
}
void write(S* s, unsigned x) {
// CHECK-X86-64-LABEL: define{{.*}} void @_ZN2N65write
- // CHECK-X86-64: %[[ptr1:.*]] = bitcast {{.*}}* %{{.*}} to i24*
// CHECK-X86-64: %[[new1:.*]] = trunc i32 %{{.*}} to i24
- // CHECK-X86-64: store i24 %[[new1]], i24* %[[ptr1]]
+ // CHECK-X86-64: store i24 %[[new1]], ptr %{{.*}}
// CHECK-X86-64: %[[new2:.*]] = trunc i32 %{{.*}} to i8
- // CHECK-X86-64: %[[ptr2:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-X86-64: store i8 %[[new2]], i8* %[[ptr2]]
+ // CHECK-X86-64: %[[ptr2:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-X86-64: store i8 %[[new2]], ptr %[[ptr2]]
// CHECK-PPC64-LABEL: define{{.*}} void @_ZN2N65write
- // CHECK-PPC64: %[[ptr1:.*]] = bitcast {{.*}}* %{{.*}} to i24*
// CHECK-PPC64: %[[new1:.*]] = trunc i32 %{{.*}} to i24
- // CHECK-PPC64: store i24 %[[new1]], i24* %[[ptr1]]
+ // CHECK-PPC64: store i24 %[[new1]], ptr %{{.*}}
// CHECK-PPC64: %[[new2:.*]] = trunc i32 %{{.*}} to i8
- // CHECK-PPC64: %[[ptr2:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-PPC64: store i8 %[[new2]], i8* %[[ptr2]]
+ // CHECK-PPC64: %[[ptr2:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-PPC64: store i8 %[[new2]], ptr %[[ptr2]]
s->b1 = x;
s->b2 = x;
}
// instrumented by ThreadSanitizer.
//
// CHECK-X86-64-LABEL: define{{.*}} i32 @_ZN2N74read
- // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-X86-64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
- // CHECK-X86-64: %[[val:.*]] = load i24, i24* %[[ptr]]
+ // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-X86-64: %[[val:.*]] = load i24, ptr %[[gep]]
// CHECK-X86-64: %[[ext:.*]] = zext i24 %[[val]] to i32
// CHECK-X86-64: ret i32 %[[ext]]
// CHECK-PPC64-LABEL: define{{.*}} zeroext i32 @_ZN2N74read
- // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-PPC64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
- // CHECK-PPC64: %[[val:.*]] = load i24, i24* %[[ptr]]
+ // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
+ // CHECK-PPC64: %[[val:.*]] = load i24, ptr %[[gep]]
// CHECK-PPC64: %[[ext:.*]] = zext i24 %[[val]] to i32
// CHECK-PPC64: ret i32 %[[ext]]
return s->b;
}
void write(B2* s, unsigned x) {
// CHECK-X86-64-LABEL: define{{.*}} void @_ZN2N75write
- // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-X86-64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
+ // CHECK-X86-64: %[[gep:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
// CHECK-X86-64: %[[new:.*]] = trunc i32 %{{.*}} to i24
- // CHECK-X86-64: store i24 %[[new]], i24* %[[ptr]]
+ // CHECK-X86-64: store i24 %[[new]], ptr %[[gep]]
// CHECK-PPC64-LABEL: define{{.*}} void @_ZN2N75write
- // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}, {{.*}}* %{{.*}}, i32 0, i32 1
- // CHECK-PPC64: %[[ptr:.*]] = bitcast [3 x i8]* %[[gep]] to i24*
+ // CHECK-PPC64: %[[gep:.*]] = getelementptr inbounds {{.*}}, ptr %{{.*}}, i32 0, i32 1
// CHECK-PPC64: %[[new:.*]] = trunc i32 %{{.*}} to i24
- // CHECK-PPC64: store i24 %[[new]], i24* %[[ptr]]
+ // CHECK-PPC64: store i24 %[[new]], ptr %[[gep]]
s->b = x;
}
}
-// RUN: %clang_cc1 -no-opaque-pointers %s -fblocks -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - | FileCheck %s
template <class T> void takeItByValue(T);
void takeABlock(void (^)());
takeABlock(^{ takeItByValue(x); });
// CHECK: store { i32, i32 } { i32 500, i32 0 },
+ // CHECK: [[COERCE:%.*]] = alloca { i32, i32 }
// CHECK: store i32 500,
// CHECK-NEXT: store i32 0,
- // CHECK-NEXT: [[COERCE:%.*]] = bitcast
- // CHECK-NEXT: [[CVAL:%.*]] = load i64, i64* [[COERCE]]
+ // CHECK-NEXT: [[CVAL:%.*]] = load i64, ptr [[COERCE]]
// CHECK-NEXT: call void @_Z13takeItByValueICiEvT_(i64 noundef [[CVAL]])
}
}
void test() {
const _Complex int &x = y;
takeABlock(^{ takeItByValue(x); });
- // CHECK: [[R:%.*]] = load i32, i32* getelementptr inbounds ({ i32, i32 }, { i32, i32 }* @_ZN28test_complex_int_ref_mutable1yE, i32 0, i32 0)
- // CHECK-NEXT: [[I:%.*]] = load i32, i32* getelementptr inbounds ({ i32, i32 }, { i32, i32 }* @_ZN28test_complex_int_ref_mutable1yE, i32 0, i32 1)
- // CHECK-NEXT: [[RSLOT:%.*]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[CSLOT:%.*]], i32 0, i32 0
- // CHECK-NEXT: [[ISLOT:%.*]] = getelementptr inbounds { i32, i32 }, { i32, i32 }* [[CSLOT]], i32 0, i32 1
- // CHECK-NEXT: store i32 [[R]], i32* [[RSLOT]]
- // CHECK-NEXT: store i32 [[I]], i32* [[ISLOT]]
- // CHECK-NEXT: [[COERCE:%.*]] = bitcast { i32, i32 }* [[CSLOT]] to i64*
- // CHECK-NEXT: [[CVAL:%.*]] = load i64, i64* [[COERCE]],
+ // CHECK: [[R:%.*]] = load i32, ptr @_ZN28test_complex_int_ref_mutable1yE
+ // CHECK-NEXT: [[I:%.*]] = load i32, ptr getelementptr inbounds ({ i32, i32 }, ptr @_ZN28test_complex_int_ref_mutable1yE, i32 0, i32 1)
+ // CHECK-NEXT: [[RSLOT:%.*]] = getelementptr inbounds { i32, i32 }, ptr [[CSLOT:%.*]], i32 0, i32 0
+ // CHECK-NEXT: [[ISLOT:%.*]] = getelementptr inbounds { i32, i32 }, ptr [[CSLOT]], i32 0, i32 1
+ // CHECK-NEXT: store i32 [[R]], ptr [[RSLOT]]
+ // CHECK-NEXT: store i32 [[I]], ptr [[ISLOT]]
+ // CHECK-NEXT: [[CVAL:%.*]] = load i64, ptr [[CSLOT]],
// CHECK-NEXT: call void @_Z13takeItByValueICiEvT_(i64 noundef [[CVAL]])
}
}
}
// CHECK-LABEL: define internal void @"_ZZN20test_block_in_lambda4testENS_1AEENK3$_0clEv"(
// CHECK: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], align 8
- // CHECK: [[THIS:%.*]] = load [[LAMBDA_T:%.*]]*, [[LAMBDA_T:%.*]]**
- // CHECK: [[BLOCK_CAPTURED:%.*]] = getelementptr inbounds [[BLOCK_T]], [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5
- // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds [[LAMBDA_T]], [[LAMBDA_T]]* [[THIS]], i32 0, i32 0
- // CHECK-NEXT: call void @_ZN20test_block_in_lambda1AC1ERKS0_({{.*}}* {{[^,]*}} [[BLOCK_CAPTURED]], {{.*}}* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[T1]])
- // CHECK-NEXT: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to void ()*
- // CHECK-NEXT: call void @_ZN20test_block_in_lambda9takeBlockEU13block_pointerFvvE(void ()* noundef [[T0]])
- // CHECK-NEXT: call void @_ZN20test_block_in_lambda1AD1Ev({{.*}}* {{[^,]*}} [[BLOCK_CAPTURED]])
+ // CHECK: [[THIS:%.*]] = load ptr, ptr
+ // CHECK: [[BLOCK_CAPTURED:%.*]] = getelementptr inbounds [[BLOCK_T]], ptr [[BLOCK]], i32 0, i32 5
+ // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds [[LAMBDA_T:%.*]], ptr [[THIS]], i32 0, i32 0
+ // CHECK-NEXT: call void @_ZN20test_block_in_lambda1AC1ERKS0_(ptr {{[^,]*}} [[BLOCK_CAPTURED]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[T1]])
+ // CHECK-NEXT: call void @_ZN20test_block_in_lambda9takeBlockEU13block_pointerFvvE(ptr noundef [[BLOCK]])
+ // CHECK-NEXT: call void @_ZN20test_block_in_lambda1AD1Ev(ptr {{[^,]*}} [[BLOCK_CAPTURED]])
// CHECK-NEXT: ret void
}
-// RUN: %clang_cc1 -no-opaque-pointers %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
-// CHECK: %[[STRUCT_BLOCK_DESCRIPTOR:.*]] = type { i64, i64 }
-// CHECK: @[[BLOCK_DESCRIPTOR22:.*]] = internal constant { i64, i64, i8*, i8*, i8*, i8* } { i64 0, i64 36, i8* bitcast (void (i8*, i8*)* @__copy_helper_block_8_32c22_ZTSN12_GLOBAL__N_11BE to i8*), i8* bitcast (void (i8*)* @__destroy_helper_block_8_32c22_ZTSN12_GLOBAL__N_11BE to i8*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @{{.*}}, i32 0, i32 0), i8* null }, align 8
+// CHECK: @[[BLOCK_DESCRIPTOR22:.*]] = internal constant { i64, i64, ptr, ptr, ptr, ptr } { i64 0, i64 36, ptr @__copy_helper_block_8_32c22_ZTSN12_GLOBAL__N_11BE, ptr @__destroy_helper_block_8_32c22_ZTSN12_GLOBAL__N_11BE, ptr @{{.*}}, ptr null }, align 8
namespace test0 {
// CHECK-LABEL: define{{.*}} void @_ZN5test04testEi(
namespace test1 {
// Capturing const objects doesn't require a local block.
// CHECK-LABEL: define{{.*}} void @_ZN5test15test1Ev()
- // CHECK: store void ()* bitcast ({{.*}} @__block_literal_global{{.*}} to void ()*), void ()** @out
+ // CHECK: store ptr @__block_literal_global{{.*}}, ptr @out
void test1() {
const int NumHorsemen = 4;
out = ^{ (void) NumHorsemen; };
// That applies to structs too...
// CHECK-LABEL: define{{.*}} void @_ZN5test15test2Ev()
- // CHECK: store void ()* bitcast ({{.*}} @__block_literal_global{{.*}} to void ()*), void ()** @out
+ // CHECK: store ptr @__block_literal_global{{.*}}, ptr @out
struct loc { double x, y; };
void test2() {
const loc target = { 5, 6 };
// ...unless they have mutable fields...
// CHECK-LABEL: define{{.*}} void @_ZN5test15test3Ev()
// CHECK: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
- // CHECK: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to void ()*
- // CHECK: store void ()* [[T0]], void ()** @out
+ // CHECK: store ptr [[BLOCK]], ptr @out
struct mut { mutable int x; };
void test3() {
const mut obj = { 5 };
// CHECK-LABEL: define{{.*}} void @_ZN5test15test4Ev()
// CHECK: [[OBJ:%.*]] = alloca
// CHECK: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]],
- // CHECK: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to void ()*
- // CHECK: store void ()* [[T0]], void ()** @out
+ // CHECK: store ptr [[BLOCK]], ptr @out
struct scope { int x; ~scope(); };
void test4() {
const scope obj = { 5 };
// CHECK-LABEL: define{{.*}} void @_ZN5test44testEv()
// CHECK-LABEL: define internal void @___ZN5test44testEv_block_invoke
// CHECK: [[TMP:%.*]] = alloca [[A:%.*]], align 1
- // CHECK-NEXT: store i8* [[BLOCKDESC:%.*]], i8** {{.*}}, align 8
- // CHECK-NEXT: bitcast i8* [[BLOCKDESC]] to <{ i8*, i32, i32, i8*, %[[STRUCT_BLOCK_DESCRIPTOR]]* }>*
- // CHECK: call void @_ZN5test41AC1Ev([[A]]* {{[^,]*}} [[TMP]])
- // CHECK-NEXT: call void @_ZN5test43fooENS_1AE([[A]]* noundef [[TMP]])
- // CHECK-NEXT: call void @_ZN5test41AD1Ev([[A]]* {{[^,]*}} [[TMP]])
+ // CHECK-NEXT: store ptr [[BLOCKDESC:%.*]], ptr {{.*}}, align 8
+ // CHECK: call void @_ZN5test41AC1Ev(ptr {{[^,]*}} [[TMP]])
+ // CHECK-NEXT: call void @_ZN5test43fooENS_1AE(ptr noundef [[TMP]])
+ // CHECK-NEXT: call void @_ZN5test41AD1Ev(ptr {{[^,]*}} [[TMP]])
// CHECK-NEXT: ret void
}
// CHECK-LABEL: define{{.*}} void @_ZN5test54testEb(
// CHECK: [[COND:%.*]] = alloca i8
// CHECK-NEXT: [[X:%.*]] = alloca [[A:%.*]], align 4
- // CHECK-NEXT: [[B:%.*]] = alloca void ()*, align 8
+ // CHECK-NEXT: [[B:%.*]] = alloca ptr, align 8
// CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:.*]], align 8
// CHECK-NEXT: [[CLEANUP_ACTIVE:%.*]] = alloca i1
- // CHECK-NEXT: [[COND_CLEANUP_SAVE:%.*]] = alloca [[A]]*, align 8
+ // CHECK-NEXT: [[COND_CLEANUP_SAVE:%.*]] = alloca ptr, align 8
// CHECK-NEXT: [[T0:%.*]] = zext i1
- // CHECK-NEXT: store i8 [[T0]], i8* [[COND]], align 1
- // CHECK-NEXT: call void @_ZN5test51AC1Ev([[A]]* {{[^,]*}} [[X]])
- // CHECK-NEXT: [[T0:%.*]] = load i8, i8* [[COND]], align 1
+ // CHECK-NEXT: store i8 [[T0]], ptr [[COND]], align 1
+ // CHECK-NEXT: call void @_ZN5test51AC1Ev(ptr {{[^,]*}} [[X]])
+ // CHECK-NEXT: [[T0:%.*]] = load i8, ptr [[COND]], align 1
// CHECK-NEXT: [[T1:%.*]] = trunc i8 [[T0]] to i1
- // CHECK-NEXT: store i1 false, i1* [[CLEANUP_ACTIVE]]
+ // CHECK-NEXT: store i1 false, ptr [[CLEANUP_ACTIVE]]
// CHECK-NEXT: br i1 [[T1]],
// CHECK-NOT: br
- // CHECK: [[CAPTURE:%.*]] = getelementptr inbounds [[BLOCK_T]], [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5
- // CHECK-NEXT: call void @_ZN5test51AC1ERKS0_([[A]]* {{[^,]*}} [[CAPTURE]], [[A]]* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[X]])
- // CHECK-NEXT: store i1 true, i1* [[CLEANUP_ACTIVE]]
- // CHECK-NEXT: store [[A]]* [[CAPTURE]], [[A]]** [[COND_CLEANUP_SAVE]], align 8
- // CHECK-NEXT: bitcast [[BLOCK_T]]* [[BLOCK]] to void ()*
+ // CHECK: [[CAPTURE:%.*]] = getelementptr inbounds [[BLOCK_T]], ptr [[BLOCK]], i32 0, i32 5
+ // CHECK-NEXT: call void @_ZN5test51AC1ERKS0_(ptr {{[^,]*}} [[CAPTURE]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[X]])
+ // CHECK-NEXT: store i1 true, ptr [[CLEANUP_ACTIVE]]
+ // CHECK-NEXT: store ptr [[CAPTURE]], ptr [[COND_CLEANUP_SAVE]], align 8
// CHECK-NEXT: br label
// CHECK: br label
// CHECK: phi
// CHECK-NEXT: store
// CHECK-NEXT: load
// CHECK-NEXT: call void @_ZN5test511doWithBlockEU13block_pointerFvvE(
- // CHECK-NEXT: [[T0:%.*]] = load i1, i1* [[CLEANUP_ACTIVE]]
+ // CHECK-NEXT: [[T0:%.*]] = load i1, ptr [[CLEANUP_ACTIVE]]
// CHECK-NEXT: br i1 [[T0]]
- // CHECK: [[T3:%.*]] = load [[A]]*, [[A]]** [[COND_CLEANUP_SAVE]], align 8
- // CHECK-NEXT: call void @_ZN5test51AD1Ev([[A]]* {{[^,]*}} [[T3]])
+ // CHECK: [[T3:%.*]] = load ptr, ptr [[COND_CLEANUP_SAVE]], align 8
+ // CHECK-NEXT: call void @_ZN5test51AD1Ev(ptr {{[^,]*}} [[T3]])
// CHECK-NEXT: br label
- // CHECK: call void @_ZN5test51AD1Ev([[A]]* {{[^,]*}} [[X]])
+ // CHECK: call void @_ZN5test51AD1Ev(ptr {{[^,]*}} [[X]])
// CHECK-NEXT: ret void
}
// CHECK-LABEL: define{{.*}} void @_ZN5test64testEv()
// CHECK: [[TEMP:%.*]] = alloca [[A:%.*]], align 1
- // CHECK-NEXT: call void @_ZN5test61AC1Ev([[A]]* {{[^,]*}} [[TEMP]])
+ // CHECK-NEXT: call void @_ZN5test61AC1Ev(ptr {{[^,]*}} [[TEMP]])
// CHECK-NEXT: call void @_ZN5test63fooERKNS_1AEU13block_pointerFvvE(
- // CHECK-NEXT: call void @_ZN5test61AD1Ev([[A]]* {{[^,]*}} [[TEMP]])
+ // CHECK-NEXT: call void @_ZN5test61AD1Ev(ptr {{[^,]*}} [[TEMP]])
// CHECK-NEXT: call void @_ZN5test63barEv()
// CHECK-NEXT: ret void
}
// objects that are non-external and non-trivial have internal linkage.
// CHECK-LABEL: define internal void @_ZN12_GLOBAL__N_14testEv(
-// CHECK: store %[[STRUCT_BLOCK_DESCRIPTOR]]* bitcast ({ i64, i64, i8*, i8*, i8*, i8* }* @[[BLOCK_DESCRIPTOR22]] to %[[STRUCT_BLOCK_DESCRIPTOR]]*), %[[STRUCT_BLOCK_DESCRIPTOR]]** %{{.*}}, align 8
+// CHECK: store ptr @[[BLOCK_DESCRIPTOR22]], ptr %{{.*}}, align 8
// CHECK-LABEL: define internal void @__copy_helper_block_8_32c22_ZTSN12_GLOBAL__N_11BE(
// CHECK-LABEL: define internal void @__destroy_helper_block_8_32c22_ZTSN12_GLOBAL__N_11BE(
-// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -emit-llvm %s -std=c++2a -o %t.ll
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -std=c++2a -o %t.ll
// RUN: FileCheck -check-prefix=CHECK-FN-CG -input-file=%t.ll %s
// RUN: FileCheck -check-prefix=CHECK-STATIC -input-file=%t.ll %s
// RUN: FileCheck -check-prefix=CHECK-DYN -input-file=%t.ll %s
// CHECK-FN-CG-LABEL: define linkonce_odr noundef i32 @_Z1fv()
constexpr int f() {
- // CHECK-FN-CG: store i32 13, i32* %n, align 4
- // CHECK-FN-CG: store i32 17, i32* %m, align 4
- // CHECK-FN-CG: %1 = load i32, i32* %m, align 4
- // CHECK-FN-CG: %add = add nsw i32 %1, 13
+ // CHECK-FN-CG: store i32 13, ptr %n, align 4
+ // CHECK-FN-CG: store i32 17, ptr %m, align 4
+ // CHECK-FN-CG: %0 = load i32, ptr %m, align 4
+ // CHECK-FN-CG: %add = add nsw i32 %0, 13
// CHECK-FN-CG: ret i32 %add
const int n = __builtin_is_constant_evaluated() && std::is_constant_evaluated() ? 13 : 17; // n == 13
int m = __builtin_is_constant_evaluated() ? 13 : 17; // m might be 13 or 17 (see below)
int p2 = f(); // same result without CONSTINIT
// CHECK-DYN-LABEL: define internal void @__cxx_global_var_init()
-// CHECK-DYN: %0 = load i32, i32* @p, align 4
+// CHECK-DYN: %0 = load i32, ptr @p, align 4
// CHECK-DYN-NEXT: %call = call noundef i32 @_Z1fv()
// CHECK-DYN-NEXT: %add = add nsw i32 %0, %call
-// CHECK-DYN-NEXT: store i32 %add, i32* @q, align 4
+// CHECK-DYN-NEXT: store i32 %add, ptr @q, align 4
// CHECK-DYN-NEXT: ret void
int q = p + f(); // m == 17 for this call; initialized to 56
CONSTINIT int b = __builtin_is_constant_evaluated() ? 2 : y; // static initialization to 2
// CHECK-DYN-LABEL: define internal void @__cxx_global_var_init.1()
-// CHECK-DYN: %0 = load i32, i32* @y, align 4
-// CHECK-DYN: %1 = load i32, i32* @y, align 4
+// CHECK-DYN: %0 = load i32, ptr @y, align 4
+// CHECK-DYN: %1 = load i32, ptr @y, align 4
// CHECK-DYN-NEXT: %add = add
-// CHECK-DYN-NEXT: store i32 %add, i32* @c,
+// CHECK-DYN-NEXT: store i32 %add, ptr @c,
int c = y + (__builtin_is_constant_evaluated() ? 2 : y); // dynamic initialization to y+y
// This is dynamic initialization that we can convert to static initialization
// CHECK-ARR: %x2 = alloca [42 x i8],
char x2[std::is_constant_evaluated() && __builtin_is_constant_evaluated() ? 42 : RANDU()];
- // CHECK-ARR: call i8* @llvm.stacksave()
+ // CHECK-ARR: call ptr @llvm.stacksave()
// CHECK-ARR: %vla = alloca i8, i64 13,
char x3[std::is_constant_evaluated() || __builtin_is_constant_evaluated() ? RANDU() : 13];
}
// CHECK-ARR-LABEL: define{{.*}} void @_Z17test_new_arr_exprv
void test_new_arr_expr() {
- // CHECK-ARR: call noalias noundef nonnull i8* @_Znam(i64 noundef 17)
+ // CHECK-ARR: call noalias noundef nonnull ptr @_Znam(i64 noundef 17)
new char[std::is_constant_evaluated() || __builtin_is_constant_evaluated() ? 1 : 17];
}
// CHECK-FOLD-LABEL: @_Z31test_constant_initialized_locali(
bool test_constant_initialized_local(int k) {
- // CHECK-FOLD: store i8 1, i8* %n,
- // CHECK-FOLD: store volatile i8* %n, i8** %p,
+ // CHECK-FOLD: store i8 1, ptr %n,
+ // CHECK-FOLD: store volatile ptr %n, ptr %p,
const bool n = __builtin_is_constant_evaluated() && std::is_constant_evaluated();
const bool *volatile p = &n;
return *p;
std::is_constant_evaluated() ? BOOM() : OK();
}
-// CHECK-STATIC-DAG: @ir ={{.*}} constant i32* @i_constant,
+// CHECK-STATIC-DAG: @ir ={{.*}} constant ptr @i_constant,
int i_constant;
int i_not_constant;
int &ir = __builtin_is_constant_evaluated() ? i_constant : i_not_constant;
void test_ref_initialization_local_scope() {
const int i_constant = 42;
const int i_non_constant = 101;
- // CHECK-FOLD: store i32* %i_non_constant, i32** %r,
+ // CHECK-FOLD: store ptr %i_non_constant, ptr %r,
const int &r = __builtin_is_constant_evaluated() ? i_constant : i_non_constant;
}
void test_ref_to_static_var() {
static int i_constant = 42;
static int i_non_constant = 101;
- // CHECK-FOLD: store i32* @_ZZ22test_ref_to_static_varvE10i_constant, i32** %r,
+ // CHECK-FOLD: store ptr @_ZZ22test_ref_to_static_varvE10i_constant, ptr %r,
int &r = __builtin_is_constant_evaluated() ? i_constant : i_non_constant;
}
// CHECK-DTOR-NOT: @_ZN13DestructorBCED{{.*}}@global_dtor_bce_1
DestructorBCE global_dtor_bce_1(101);
-// CHECK-DTOR: load i32, i32* @not_constexpr
+// CHECK-DTOR: load i32, ptr @not_constexpr
// CHECK-DTOR: call {{.*}} @_ZN13DestructorBCEC1Ei({{.*}} @global_dtor_bce_2, i32
// CHECK-DTOR: atexit{{.*}} @_ZN13DestructorBCED{{.*}} @global_dtor_bce_2
// CHECK-DTOR: }
-// RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-linux-gnu -emit-llvm -fstrict-vtable-pointers -o - %s \
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm -fstrict-vtable-pointers -o - %s \
// RUN: | FileCheck --check-prefixes=CHECK,CHECK-STRICT %s
-// RUN: %clang_cc1 -no-opaque-pointers -triple=x86_64-linux-gnu -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm -o - %s \
// RUN: | FileCheck --check-prefixes=CHECK,CHECK-NONSTRICT %s
//===----------------------------------------------------------------------===//
// CHECK-LABEL: define{{.*}} void @test_builtin_launder_virtual_fn
extern "C" void test_builtin_launder_virtual_fn(TestVirtualFn *p) {
- // CHECK: store [[TYPE:%[^ ]+]] %p, [[TYPE]]* %p.addr
- // CHECK-NEXT: [[TMP0:%.*]] = load [[TYPE]], [[TYPE]]* %p.addr
+ // CHECK: store ptr %p, ptr %p.addr
+ // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr %p.addr
- // CHECK-NONSTRICT-NEXT: store [[TYPE]] [[TMP0]], [[TYPE]]* %d
+ // CHECK-NONSTRICT-NEXT: store ptr [[TMP0]], ptr %d
- // CHECK-STRICT-NEXT: [[TMP1:%.*]] = bitcast [[TYPE]] [[TMP0]] to i8*
- // CHECK-STRICT-NEXT: [[TMP2:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* [[TMP1]])
- // CHECK-STRICT-NEXT: [[TMP3:%.*]] = bitcast i8* [[TMP2]] to [[TYPE]]
- // CHECK-STRICT-NEXT: store [[TYPE]] [[TMP3]], [[TYPE]]* %d
+ // CHECK-STRICT-NEXT: [[TMP2:%.*]] = call ptr @llvm.launder.invariant.group.p0(ptr [[TMP0]])
+ // CHECK-STRICT-NEXT: store ptr [[TMP2]], ptr %d
// CHECK-NEXT: ret void
TestVirtualFn *d = __builtin_launder(p);
// CHECK-LABEL: define{{.*}} void @test_builtin_launder_ommitted_one
extern "C" void test_builtin_launder_ommitted_one(int *p) {
// CHECK: entry
- // CHECK-NEXT: %p.addr = alloca i32*
- // CHECK-NEXT: %d = alloca i32*
- // CHECK-NEXT: store i32* %p, i32** %p.addr, align 8
- // CHECK-NEXT: [[TMP:%.*]] = load i32*, i32** %p.addr
- // CHECK-NEXT: store i32* [[TMP]], i32** %d
+ // CHECK-NEXT: %p.addr = alloca ptr
+ // CHECK-NEXT: %d = alloca ptr
+ // CHECK-NEXT: store ptr %p, ptr %p.addr, align 8
+ // CHECK-NEXT: [[TMP:%.*]] = load ptr, ptr %p.addr
+ // CHECK-NEXT: store ptr [[TMP]], ptr %d
// CHECK-NEXT: ret void
int *d = __builtin_launder(p);
}
extern "C" void test_builtin_launder_ommitted_two(TestNoInvariant *p) {
// CHECK: entry
// CHECK-NOT: llvm.launder.invariant.group
- // CHECK-NEXT: %p.addr = alloca [[TYPE:%.*]], align 8
- // CHECK-NEXT: %d = alloca [[TYPE]]
- // CHECK-NEXT: store [[TYPE]] %p, [[TYPE]]* %p.addr
- // CHECK-NEXT: [[TMP:%.*]] = load [[TYPE]], [[TYPE]]* %p.addr
- // CHECK-NEXT: store [[TYPE]] [[TMP]], [[TYPE]]* %d
+ // CHECK-NEXT: %p.addr = alloca ptr, align 8
+ // CHECK-NEXT: %d = alloca ptr
+ // CHECK-NEXT: store ptr %p, ptr %p.addr
+ // CHECK-NEXT: [[TMP:%.*]] = load ptr, ptr %p.addr
+ // CHECK-NEXT: store ptr [[TMP]], ptr %d
// CHECK-NEXT: ret void
TestNoInvariant *d = __builtin_launder(p);
}
-// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -std=c++11 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -fsanitize-recover=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-FUNCSAN
-// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr,address -fsanitize-recover=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN
-// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=DOWNCAST-NULL
-// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple x86_64-linux-gnux32 | FileCheck %s --check-prefix=CHECK-FUNCSAN
-// RUN: %clang_cc1 -no-opaque-pointers -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple i386-linux-gnu | FileCheck %s --check-prefix=CHECK-FUNCSAN
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -fsanitize-recover=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-FUNCSAN
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr,address -fsanitize-recover=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=DOWNCAST-NULL
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple x86_64-linux-gnux32 | FileCheck %s --check-prefix=CHECK-FUNCSAN
+// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple i386-linux-gnu | FileCheck %s --check-prefix=CHECK-FUNCSAN
struct S {
double d;
// CHECK-ASAN: [[TYPE_DESCR:@[0-9]+]] = private unnamed_addr constant { i16, i16, [4 x i8] } { i16 -1, i16 0, [4 x i8] c"'S'\00" }
// Check that type mismatch handler is not modified by ASan.
-// CHECK-ASAN: private unnamed_addr global { { [{{.*}} x i8]*, i32, i32 }, { i16, i16, [4 x i8] }*, i8*, i8 } { {{.*}}, { i16, i16, [4 x i8] }* [[TYPE_DESCR]], {{.*}} }
+// CHECK-ASAN: private unnamed_addr global { { ptr, i32, i32 }, ptr, ptr, i8 } { {{.*}}, ptr [[TYPE_DESCR]], {{.*}} }
-// CHECK-FUNCSAN: [[PROXY:@.+]] = private unnamed_addr constant i8* bitcast ({ i8*, i8* }* @_ZTIFvPFviEE to i8*)
+// CHECK-FUNCSAN: [[PROXY:@.+]] = private unnamed_addr constant ptr @_ZTIFvPFviEE
struct T : S {};
// (1b) Check that 'p' actually points to an 'S'.
- // CHECK: %[[VPTRADDR:.*]] = bitcast {{.*}} to i64*
- // CHECK-NEXT: %[[VPTR:.*]] = load i64, i64* %[[VPTRADDR]]
+ // CHECK: %[[VPTR:.*]] = load i64, ptr
//
// hash_16_bytes:
//
// Check the hash against the table:
//
// CHECK-NEXT: %[[IDX:.*]] = and i64 %{{.*}}, 127
- // CHECK-NEXT: getelementptr inbounds [128 x i64], [128 x i64]* @__ubsan_vptr_type_cache, i32 0, i64 %[[IDX]]
- // CHECK-NEXT: %[[CACHEVAL:.*]] = load i64, i64*
+ // CHECK-NEXT: getelementptr inbounds [128 x i64], ptr @__ubsan_vptr_type_cache, i32 0, i64 %[[IDX]]
+ // CHECK-NEXT: %[[CACHEVAL:.*]] = load i64, ptr
// CHECK-NEXT: icmp eq i64 %[[CACHEVAL]], %[[HASH]]
// CHECK-NEXT: br i1
// (3b) Check that 'p' actually points to an 'S'
- // CHECK: load i64, i64*
+ // CHECK: load i64, ptr
// CHECK-NEXT: xor i64 {{-4030275160588942838|1107558922}},
// [...]
- // CHECK: getelementptr inbounds [128 x i64], [128 x i64]* @__ubsan_vptr_type_cache, i32 0, i64 %
+ // CHECK: getelementptr inbounds [128 x i64], ptr @__ubsan_vptr_type_cache, i32 0, i64 %
// CHECK: br i1
// CHECK: call void @__ubsan_handle_dynamic_type_cache_miss({{.*}}, i64 %{{.*}}, i64 %{{.*}})
// CHECK-NOT: unreachable
// CHECK-LABEL: @_Z9no_return
int no_return() {
- // CHECK: call void @__ubsan_handle_missing_return(i8* bitcast ({{.*}}* @{{.*}} to i8*)) [[NR_NUW:#[0-9]+]]
+ // CHECK: call void @__ubsan_handle_missing_return(ptr @{{.*}}) [[NR_NUW:#[0-9]+]]
// CHECK-NEXT: unreachable
}
bool sour_bool(bool *p) {
// CHECK: %[[OK:.*]] = icmp ule i8 {{.*}}, 1
// CHECK: br i1 %[[OK]]
- // CHECK: call void @__ubsan_handle_load_invalid_value(i8* bitcast ({{.*}}), i64 {{.*}})
+ // CHECK: call void @__ubsan_handle_load_invalid_value(ptr @{{.*}}, i64 {{.*}})
return *p;
}
// DOWNCAST-NULL: %[[NONNULL:.*]] = icmp ne {{.*}}, null
// DOWNCAST-NULL: br i1 %[[NONNULL]],
- // CHECK: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0i8(
+ // CHECK: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0(
// CHECK: %[[E1:.*]] = icmp uge i64 %[[SIZE]], 24
// CHECK: %[[MISALIGN:.*]] = and i64 %{{.*}}, 7
// CHECK: %[[E2:.*]] = icmp eq i64 %[[MISALIGN]], 0
// CHECK: %[[E1:.*]] = icmp ne {{.*}}, null
// CHECK-NOT: br i1
- // CHECK: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0i8(
+ // CHECK: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0(
// CHECK: %[[E2:.*]] = icmp uge i64 %[[SIZE]], 24
// CHECK: %[[MISALIGN:.*]] = and i64 %{{.*}}, 7
// offset. The pointer before subtraction doesn't need to be aligned for
// the destination type.
-// CHECK-LABEL: define{{.*}} void @_Z16downcast_pointerP1B(%class.B* %b)
+// CHECK-LABEL: define{{.*}} void @_Z16downcast_pointerP1B(ptr %b)
void downcast_pointer(B *b) {
(void) static_cast<C*>(b);
// Alignment check from EmitTypeCheck(TCK_DowncastPointer, ...)
- // CHECK: [[SUB:%[.a-z0-9]*]] = getelementptr inbounds i8, i8* {{.*}}, i64 -16
- // CHECK-NEXT: [[C:%.+]] = bitcast i8* [[SUB]] to %class.C*
+ // CHECK: [[SUB:%[.a-z0-9]*]] = getelementptr inbounds i8, ptr {{.*}}, i64 -16
// null check goes here
- // CHECK: [[FROM_PHI:%.+]] = phi %class.C* [ [[C]], {{.*}} ], {{.*}}
+ // CHECK: [[FROM_PHI:%.+]] = phi ptr [ [[SUB]], {{.*}} ], {{.*}}
// Objectsize check goes here
- // CHECK: [[C_INT:%.+]] = ptrtoint %class.C* [[FROM_PHI]] to i64
+ // CHECK: [[C_INT:%.+]] = ptrtoint ptr [[FROM_PHI]] to i64
// CHECK-NEXT: [[MASKED:%.+]] = and i64 [[C_INT]], 15
// CHECK-NEXT: [[TEST:%.+]] = icmp eq i64 [[MASKED]], 0
// AND the alignment test with the objectsize test.
// CHECK-NEXT: br i1 [[AND]]
}
-// CHECK-LABEL: define{{.*}} void @_Z18downcast_referenceR1B(%class.B* nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %b)
+// CHECK-LABEL: define{{.*}} void @_Z18downcast_referenceR1B(ptr nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %b)
void downcast_reference(B &b) {
(void) static_cast<C&>(b);
// Alignment check from EmitTypeCheck(TCK_DowncastReference, ...)
- // CHECK: [[SUB:%[.a-z0-9]*]] = getelementptr inbounds i8, i8* {{.*}}, i64 -16
- // CHECK-NEXT: [[C:%.+]] = bitcast i8* [[SUB]] to %class.C*
+ // CHECK: [[SUB:%[.a-z0-9]*]] = getelementptr inbounds i8, ptr {{.*}}, i64 -16
// Objectsize check goes here
- // CHECK: [[C_INT:%.+]] = ptrtoint %class.C* [[C]] to i64
+ // CHECK: [[C_INT:%.+]] = ptrtoint ptr [[SUB]] to i64
// CHECK-NEXT: [[MASKED:%.+]] = and i64 [[C_INT]], 15
// CHECK-NEXT: [[TEST:%.+]] = icmp eq i64 [[MASKED]], 0
// AND the alignment test with the objectsize test.
// CHECK-FUNCSAN: @_Z22indirect_function_callPFviE({{.*}} !func_sanitize ![[FUNCSAN:.*]] {
void indirect_function_call(void (*p)(int)) {
- // CHECK: [[PTR:%.+]] = bitcast void (i32)* {{.*}} to <{ i32, i32 }>*
+ // CHECK: [[PTR:%.+]] = load ptr, ptr
// Signature check
- // CHECK-NEXT: [[SIGPTR:%.+]] = getelementptr <{ i32, i32 }>, <{ i32, i32 }>* [[PTR]], i32 -1, i32 0
- // CHECK-NEXT: [[SIG:%.+]] = load i32, i32* [[SIGPTR]]
+ // CHECK-NEXT: [[SIGPTR:%.+]] = getelementptr <{ i32, i32 }>, ptr [[PTR]], i32 -1, i32 0
+ // CHECK-NEXT: [[SIG:%.+]] = load i32, ptr [[SIGPTR]]
// CHECK-NEXT: [[SIGCMP:%.+]] = icmp eq i32 [[SIG]], -1056584962
// CHECK-NEXT: br i1 [[SIGCMP]]
// RTTI pointer check
- // CHECK: [[RTTIPTR:%.+]] = getelementptr <{ i32, i32 }>, <{ i32, i32 }>* [[PTR]], i32 -1, i32 1
- // CHECK-NEXT: [[RTTIEncIntTrunc:%.+]] = load i32, i32* [[RTTIPTR]]
+ // CHECK: [[RTTIPTR:%.+]] = getelementptr <{ i32, i32 }>, ptr [[PTR]], i32 -1, i32 1
+ // CHECK-NEXT: [[RTTIEncIntTrunc:%.+]] = load i32, ptr [[RTTIPTR]]
// CHECK-NEXT: [[RTTIEncInt:%.+]] = sext i32 [[RTTIEncIntTrunc]] to i64
- // CHECK-NEXT: [[FuncAddrInt:%.+]] = ptrtoint void (i32)* {{.*}} to i64
+ // CHECK-NEXT: [[FuncAddrInt:%.+]] = ptrtoint ptr {{.*}} to i64
// CHECK-NEXT: [[IndirectGVInt:%.+]] = add i64 [[RTTIEncInt]], [[FuncAddrInt]]
- // CHECK-NEXT: [[IndirectGV:%.+]] = inttoptr i64 [[IndirectGVInt]] to i8**
- // CHECK-NEXT: [[RTTI:%.+]] = load i8*, i8** [[IndirectGV]], align 8
- // CHECK-NEXT: [[RTTICMP:%.+]] = icmp eq i8* [[RTTI]], bitcast ({ i8*, i8* }* @_ZTIFviE to i8*)
+ // CHECK-NEXT: [[IndirectGV:%.+]] = inttoptr i64 [[IndirectGVInt]] to ptr
+ // CHECK-NEXT: [[RTTI:%.+]] = load ptr, ptr [[IndirectGV]], align 8
+ // CHECK-NEXT: [[RTTICMP:%.+]] = icmp eq ptr [[RTTI]], @_ZTIFviE
// CHECK-NEXT: br i1 [[RTTICMP]]
p(42);
// CHECK-LABEL: define {{.*}} @_ZN15VBaseObjectSize1fERNS_1BE(
B &f(B &b) {
// Size check: check for nvsize(B) == 16 (do not require size(B) == 32)
- // CHECK: [[SIZE:%.+]] = call i{{32|64}} @llvm.objectsize.i64.p0i8(
+ // CHECK: [[SIZE:%.+]] = call i{{32|64}} @llvm.objectsize.i64.p0(
// CHECK: icmp uge i{{32|64}} [[SIZE]], 16,
// Alignment check: check for nvalign(B) == 8 (do not require align(B) == 16)
// CHECK-LABEL: define{{.*}}nothrow_new_trivial
void *nothrow_new_trivial() {
- // CHECK: %[[is_null:.*]] = icmp eq i8*{{.*}}, null
+ // CHECK: %[[is_null:.*]] = icmp eq ptr{{.*}}, null
// CHECK: br i1 %[[is_null]], label %[[null:.*]], label %[[nonnull:.*]]
// CHECK: [[nonnull]]:
// CHECK-LABEL: define{{.*}}nothrow_new_nontrivial
void *nothrow_new_nontrivial() {
- // CHECK: %[[is_null:.*]] = icmp eq i8*{{.*}}, null
+ // CHECK: %[[is_null:.*]] = icmp eq ptr{{.*}}, null
// CHECK: br i1 %[[is_null]], label %[[null:.*]], label %[[nonnull:.*]]
// CHECK: [[nonnull]]:
// CHECK-LABEL: define{{.*}}throwing_new
void *throwing_new(int size) {
- // CHECK: icmp ne i8*{{.*}}, null
+ // CHECK: icmp ne ptr{{.*}}, null
// CHECK: %[[size:.*]] = mul
// CHECK: llvm.objectsize
// CHECK: icmp uge i64 {{.*}}, %[[size]],
// CHECK-LABEL: define{{.*}}nothrow_new_zero_size
void *nothrow_new_zero_size() {
- // CHECK: %[[nonnull:.*]] = icmp ne i8*{{.*}}, null
+ // CHECK: %[[nonnull:.*]] = icmp ne ptr{{.*}}, null
// CHECK-NOT: llvm.objectsize
// CHECK: br i1 %[[nonnull]], label %[[good:.*]], label %[[bad:[^,]*]]
//
void this_align_lambda_2();
};
void ThisAlign::this_align_lambda() {
- // CHECK-LABEL: define internal %struct.ThisAlign* @"_ZZN9ThisAlign17this_align_lambdaEvENK3$_0clEv"
- // CHECK-SAME: (%{{.*}}* {{[^,]*}} %[[this:[^)]*]])
+ // CHECK-LABEL: define internal ptr @"_ZZN9ThisAlign17this_align_lambdaEvENK3$_0clEv"
+ // CHECK-SAME: (ptr {{[^,]*}} %[[this:[^)]*]])
// CHECK: %[[this_addr:.*]] = alloca
- // CHECK: store %{{.*}}* %[[this]], %{{.*}}** %[[this_addr]],
- // CHECK: %[[this_inner:.*]] = load %{{.*}}*, %{{.*}}** %[[this_addr]],
- // CHECK: %[[this_outer_addr:.*]] = getelementptr inbounds %{{.*}}, %{{.*}}* %[[this_inner]], i32 0, i32 0
- // CHECK: %[[this_outer:.*]] = load %{{.*}}*, %{{.*}}** %[[this_outer_addr]],
+ // CHECK: store ptr %[[this]], ptr %[[this_addr]],
+ // CHECK: %[[this_inner:.*]] = load ptr, ptr %[[this_addr]],
+ // CHECK: %[[this_outer_addr:.*]] = getelementptr inbounds %{{.*}}, ptr %[[this_inner]], i32 0, i32 0
+ // CHECK: %[[this_outer:.*]] = load ptr, ptr %[[this_outer_addr]],
//
- // CHECK: %[[this_inner_isnonnull:.*]] = icmp ne %{{.*}}* %[[this_inner]], null
- // CHECK: %[[this_inner_asint:.*]] = ptrtoint %{{.*}}* %[[this_inner]] to i
+ // CHECK: %[[this_inner_isnonnull:.*]] = icmp ne ptr %[[this_inner]], null
+ // CHECK: %[[this_inner_asint:.*]] = ptrtoint ptr %[[this_inner]] to i
// CHECK: %[[this_inner_misalignment:.*]] = and i{{32|64}} %[[this_inner_asint]], {{3|7}},
// CHECK: %[[this_inner_isaligned:.*]] = icmp eq i{{32|64}} %[[this_inner_misalignment]], 0
// CHECK: %[[this_inner_valid:.*]] = and i1 %[[this_inner_isnonnull]], %[[this_inner_isaligned]],
void ThisAlign::this_align_lambda_2() {
// CHECK-LABEL: define internal void @"_ZZN9ThisAlign19this_align_lambda_2EvENK3$_0clEv"
- // CHECK-SAME: (%{{.*}}* {{[^,]*}} %[[this:[^)]*]])
+ // CHECK-SAME: (ptr {{[^,]*}} %[[this:[^)]*]])
// CHECK: %[[this_addr:.*]] = alloca
- // CHECK: store %{{.*}}* %[[this]], %{{.*}}** %[[this_addr]],
- // CHECK: %[[this_inner:.*]] = load %{{.*}}*, %{{.*}}** %[[this_addr]],
+ // CHECK: store ptr %[[this]], ptr %[[this_addr]],
+ // CHECK: %[[this_inner:.*]] = load ptr, ptr %[[this_addr]],
//
// Do not perform a null check on the 'this' pointer if the function might be
// called from a static invoker.
- // CHECK-NOT: icmp ne %{{.*}}* %[[this_inner]], null
+ // CHECK-NOT: icmp ne ptr %[[this_inner]], null
auto *p = +[] {};
p();
}
// CHECK: attributes [[NR_NUW]] = { noreturn nounwind }
-// CHECK-FUNCSAN: ![[FUNCSAN]] = !{i32 -1056584962, i8** [[PROXY]]}
+// CHECK-FUNCSAN: ![[FUNCSAN]] = !{i32 -1056584962, ptr [[PROXY]]}
-// RUN: %clang_cc1 -no-opaque-pointers -flto -triple x86_64-unknown-linux -fsanitize=cfi-vcall -fsanitize-cfi-cross-dso -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s
-// RUN: %clang_cc1 -no-opaque-pointers -flto -triple x86_64-pc-windows-msvc -fsanitize=cfi-vcall -fsanitize-cfi-cross-dso -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
+// RUN: %clang_cc1 -flto -triple x86_64-unknown-linux -fsanitize=cfi-vcall -fsanitize-cfi-cross-dso -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s
+// RUN: %clang_cc1 -flto -triple x86_64-pc-windows-msvc -fsanitize=cfi-vcall -fsanitize-cfi-cross-dso -emit-llvm -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
struct A {
A();
b.f();
}
-// MS: @[[B_VTABLE:.*]] = private unnamed_addr constant { [2 x i8*] } {{.*}}@"??_R4B@?A0x{{[^@]*}}@@6B@"{{.*}}@"?f@B@?A0x{{[^@]*}}@@UEAAXXZ"
+// MS: @[[B_VTABLE:.*]] = private unnamed_addr constant { [2 x ptr] } {{.*}}@"??_R4B@?A0x{{[^@]*}}@@6B@"{{.*}}@"?f@B@?A0x{{[^@]*}}@@UEAAXXZ"
-// CHECK: %[[VT:.*]] = load void (%struct.A*)**, void (%struct.A*)***
-// CHECK: %[[VT2:.*]] = bitcast {{.*}}%[[VT]] to i8*, !nosanitize
-// ITANIUM: %[[TEST:.*]] = call i1 @llvm.type.test(i8* %[[VT2]], metadata !"_ZTS1A"), !nosanitize
-// MS: %[[TEST:.*]] = call i1 @llvm.type.test(i8* %[[VT2]], metadata !"?AUA@@"), !nosanitize
+// CHECK-LABEL: caller
+// CHECK: %[[A:.*]] = load ptr, ptr
+// CHECK: %[[VT:.*]] = load ptr, ptr %[[A]]
+// ITANIUM: %[[TEST:.*]] = call i1 @llvm.type.test(ptr %[[VT]], metadata !"_ZTS1A"), !nosanitize
+// MS: %[[TEST:.*]] = call i1 @llvm.type.test(ptr %[[VT]], metadata !"?AUA@@"), !nosanitize
// CHECK: br i1 %[[TEST]], label %[[CONT:.*]], label %[[SLOW:.*]], {{.*}} !nosanitize
// CHECK: [[SLOW]]
-// ITANIUM: call void @__cfi_slowpath_diag(i64 7004155349499253778, i8* %[[VT2]], {{.*}}) {{.*}} !nosanitize
-// MS: call void @__cfi_slowpath_diag(i64 -8005289897957287421, i8* %[[VT2]], {{.*}}) {{.*}} !nosanitize
+// ITANIUM: call void @__cfi_slowpath_diag(i64 7004155349499253778, ptr %[[VT]], {{.*}}) {{.*}} !nosanitize
+// MS: call void @__cfi_slowpath_diag(i64 -8005289897957287421, ptr %[[VT]], {{.*}}) {{.*}} !nosanitize
// CHECK: br label %[[CONT]], !nosanitize
// CHECK: [[CONT]]
-// CHECK: call void %{{.*}}(%struct.A* {{[^,]*}} %{{.*}})
+// CHECK: call void %{{.*}}(ptr {{[^,]*}} %{{.*}})
// No hash-based bit set entry for (anonymous namespace)::B
-// ITANIUM-NOT: !{i64 {{.*}}, [3 x i8*]* @_ZTVN12_GLOBAL__N_11BE,
-// MS-NOT: !{i64 {{.*}}, [2 x i8*]* @[[B_VTABLE]],
+// ITANIUM-NOT: !{i64 {{.*}}, ptr @_ZTVN12_GLOBAL__N_11BE,
+// MS-NOT: !{i64 {{.*}}, ptr @[[B_VTABLE]],
-// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
// rdar: // 8353567
// pr7726
extern "C" int printf(...);
void test0() {
-// CHECK: call i32 (...) @printf({{.*}}, i8* noundef inttoptr (i64 3735928559 to i8*))
+// CHECK: call i32 (...) @printf({{.*}}, ptr noundef inttoptr (i64 3735928559 to ptr))
printf("%p\n", (void *)0xdeadbeef ? : (void *)0xaaaaaa);
}
B test0(B &x) {
// CHECK-LABEL: define{{.*}} void @_ZN5test35test0ERNS_1BE(
- // CHECK: [[X:%.*]] = alloca [[B:%.*]]*,
- // CHECK: store [[B]]* {{%.*}}, [[B]]** [[X]]
- // CHECK-NEXT: [[T0:%.*]] = load [[B]]*, [[B]]** [[X]]
- // CHECK-NEXT: [[BOOL:%.*]] = call noundef zeroext i1 @_ZN5test31BcvbEv([[B]]* {{[^,]*}} [[T0]])
+ // CHECK: [[RES:%.*]] = alloca ptr,
+ // CHECK: [[X:%.*]] = alloca ptr,
+ // CHECK: store ptr {{%.*}}, ptr [[RES]]
+ // CHECK: store ptr {{%.*}}, ptr [[X]]
+ // CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[X]]
+ // CHECK-NEXT: [[BOOL:%.*]] = call noundef zeroext i1 @_ZN5test31BcvbEv(ptr {{[^,]*}} [[T0]])
// CHECK-NEXT: br i1 [[BOOL]]
- // CHECK: call void @_ZN5test31BC1ERKS0_([[B]]* {{[^,]*}} [[RESULT:%.*]], [[B]]* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[T0]])
+ // CHECK: call void @_ZN5test31BC1ERKS0_(ptr {{[^,]*}} [[RESULT:%.*]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[T0]])
// CHECK-NEXT: br label
- // CHECK: call void @_ZN5test31BC1Ev([[B]]* {{[^,]*}} [[RESULT]])
+ // CHECK: call void @_ZN5test31BC1Ev(ptr {{[^,]*}} [[RESULT]])
// CHECK-NEXT: br label
// CHECK: ret void
return x ?: B();
B test1() {
// CHECK-LABEL: define{{.*}} void @_ZN5test35test1Ev(
- // CHECK: [[TEMP:%.*]] = alloca [[B]],
- // CHECK: call void @_ZN5test312test1_helperEv([[B]]* sret([[B]]) align 1 [[TEMP]])
- // CHECK-NEXT: [[BOOL:%.*]] = call noundef zeroext i1 @_ZN5test31BcvbEv([[B]]* {{[^,]*}} [[TEMP]])
+ // CHECK: [[TEMP:%.*]] = alloca [[B:%.*]],
+ // CHECK: call void @_ZN5test312test1_helperEv(ptr sret([[B]]) align 1 [[TEMP]])
+ // CHECK-NEXT: [[BOOL:%.*]] = call noundef zeroext i1 @_ZN5test31BcvbEv(ptr {{[^,]*}} [[TEMP]])
// CHECK-NEXT: br i1 [[BOOL]]
- // CHECK: call void @_ZN5test31BC1ERKS0_([[B]]* {{[^,]*}} [[RESULT:%.*]], [[B]]* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[TEMP]])
+ // CHECK: call void @_ZN5test31BC1ERKS0_(ptr {{[^,]*}} [[RESULT:%.*]], ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[TEMP]])
// CHECK-NEXT: br label
- // CHECK: call void @_ZN5test31BC1Ev([[B]]* {{[^,]*}} [[RESULT]])
+ // CHECK: call void @_ZN5test31BC1Ev(ptr {{[^,]*}} [[RESULT]])
// CHECK-NEXT: br label
- // CHECK: call void @_ZN5test31BD1Ev([[B]]* {{[^,]*}} [[TEMP]])
+ // CHECK: call void @_ZN5test31BD1Ev(ptr {{[^,]*}} [[TEMP]])
// CHECK-NEXT: ret void
extern B test1_helper();
return test1_helper() ?: B();
A test2(B &x) {
// CHECK-LABEL: define{{.*}} void @_ZN5test35test2ERNS_1BE(
- // CHECK: [[X:%.*]] = alloca [[B]]*,
- // CHECK: store [[B]]* {{%.*}}, [[B]]** [[X]]
- // CHECK-NEXT: [[T0:%.*]] = load [[B]]*, [[B]]** [[X]]
- // CHECK-NEXT: [[BOOL:%.*]] = call noundef zeroext i1 @_ZN5test31BcvbEv([[B]]* {{[^,]*}} [[T0]])
+ // CHECK: [[RES:%.*]] = alloca ptr,
+ // CHECK: [[X:%.*]] = alloca ptr,
+ // CHECK: store ptr {{%.*}}, ptr [[RES]]
+ // CHECK: store ptr {{%.*}}, ptr [[X]]
+ // CHECK-NEXT: [[T0:%.*]] = load ptr, ptr [[X]]
+ // CHECK-NEXT: [[BOOL:%.*]] = call noundef zeroext i1 @_ZN5test31BcvbEv(ptr {{[^,]*}} [[T0]])
// CHECK-NEXT: br i1 [[BOOL]]
- // CHECK: call void @_ZN5test31BcvNS_1AEEv([[A:%.*]]* sret([[A]]) align 1 [[RESULT:%.*]], [[B]]* {{[^,]*}} [[T0]])
+ // CHECK: call void @_ZN5test31BcvNS_1AEEv(ptr sret([[A:%.*]]) align 1 [[RESULT:%.*]], ptr {{[^,]*}} [[T0]])
// CHECK-NEXT: br label
- // CHECK: call void @_ZN5test31AC1Ev([[A]]* {{[^,]*}} [[RESULT]])
+ // CHECK: call void @_ZN5test31AC1Ev(ptr {{[^,]*}} [[RESULT]])
// CHECK-NEXT: br label
// CHECK: ret void
return x ?: A();
A test3() {
// CHECK-LABEL: define{{.*}} void @_ZN5test35test3Ev(
// CHECK: [[TEMP:%.*]] = alloca [[B]],
- // CHECK: call void @_ZN5test312test3_helperEv([[B]]* sret([[B]]) align 1 [[TEMP]])
- // CHECK-NEXT: [[BOOL:%.*]] = call noundef zeroext i1 @_ZN5test31BcvbEv([[B]]* {{[^,]*}} [[TEMP]])
+ // CHECK: call void @_ZN5test312test3_helperEv(ptr sret([[B]]) align 1 [[TEMP]])
+ // CHECK-NEXT: [[BOOL:%.*]] = call noundef zeroext i1 @_ZN5test31BcvbEv(ptr {{[^,]*}} [[TEMP]])
// CHECK-NEXT: br i1 [[BOOL]]
- // CHECK: call void @_ZN5test31BcvNS_1AEEv([[A]]* sret([[A]]) align 1 [[RESULT:%.*]], [[B]]* {{[^,]*}} [[TEMP]])
+ // CHECK: call void @_ZN5test31BcvNS_1AEEv(ptr sret([[A]]) align 1 [[RESULT:%.*]], ptr {{[^,]*}} [[TEMP]])
// CHECK-NEXT: br label
- // CHECK: call void @_ZN5test31AC1Ev([[A]]* {{[^,]*}} [[RESULT]])
+ // CHECK: call void @_ZN5test31AC1Ev(ptr {{[^,]*}} [[RESULT]])
// CHECK-NEXT: br label
- // CHECK: call void @_ZN5test31BD1Ev([[B]]* {{[^,]*}} [[TEMP]])
+ // CHECK: call void @_ZN5test31BD1Ev(ptr {{[^,]*}} [[TEMP]])
// CHECK-NEXT: ret void
extern B test3_helper();
return test3_helper() ?: A();
-// RUN: %clang_cc1 -no-opaque-pointers -w -fmerge-all-constants -triple x86_64-elf-gnu -emit-llvm -o - %s -std=c++11 | FileCheck %s
-// RUN: %clang_cc1 -no-opaque-pointers -w -fmerge-all-constants -triple x86_64-elf-gnu -emit-llvm -o - %s -std=c++20 | FileCheck -check-prefix=CHECK20 %s
+// RUN: %clang_cc1 -w -fmerge-all-constants -triple x86_64-elf-gnu -emit-llvm -o - %s -std=c++11 | FileCheck %s
+// RUN: %clang_cc1 -w -fmerge-all-constants -triple x86_64-elf-gnu -emit-llvm -o - %s -std=c++20 | FileCheck -check-prefix=CHECK20 %s
// FIXME: The padding in all these objects should be zero-initialized.
namespace StructUnion {
// CHECK: @_ZN11StructUnion1aE ={{.*}} constant {{.*}} { i32 1, double 2.000000e+00, {{.*}} { i32 3, [4 x i8] undef } }
extern constexpr A a(1, 2.0, 3);
- // CHECK: @_ZN11StructUnion1bE ={{.*}} constant {{.*}} { i32 4, double 5.000000e+00, {{.*}} { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @{{.*}}, i32 0, i32 0) } }
+ // CHECK: @_ZN11StructUnion1bE ={{.*}} constant {{.*}} { i32 4, double 5.000000e+00, {{.*}} { ptr @{{.*}} } }
extern constexpr A b(4, 5, "hello");
struct B {
B b = { { 0, 1 }, { 2, 3 } };
// CHECK: @[[TEMP0:.*]] = internal global i32 0, align 4
// CHECK: @[[TEMP1:.*]] = internal constant i32 1, align 4
- // CHECK: @[[TEMPA1:.*]] = internal global {{.*}} { i32* @[[TEMP0]], i32* @[[TEMP1]] }, align 8
+ // CHECK: @[[TEMPA1:.*]] = internal global {{.*}} { ptr @[[TEMP0]], ptr @[[TEMP1]] }, align 8
// CHECK: @[[TEMP2:.*]] = internal global i32 2, align 4
// CHECK: @[[TEMP3:.*]] = internal constant i32 3, align 4
- // CHECK: @[[TEMPA2:.*]] = internal constant {{.*}} { i32* @[[TEMP2]], i32* @[[TEMP3]] }, align 8
- // CHECK: @_ZN16LiteralReference1bE ={{.*}} global {{.*}} { {{.*}}* @[[TEMPA1]], {{.*}}* @[[TEMPA2]] }, align 8
+ // CHECK: @[[TEMPA2:.*]] = internal constant {{.*}} { ptr @[[TEMP2]], ptr @[[TEMP3]] }, align 8
+ // CHECK: @_ZN16LiteralReference1bE ={{.*}} global {{.*}} { ptr @[[TEMPA1]], ptr @[[TEMPA2]] }, align 8
struct Subobj {
int a, b, c;
};
// CHECK: @[[TEMP:.*]] = internal global {{.*}} { i32 1, i32 2, i32 3 }, align 4
- // CHECK: @_ZN16LiteralReference2soE ={{.*}} constant {{.*}} (i8* getelementptr {{.*}} @[[TEMP]]{{.*}}, i64 4)
+ // CHECK: @_ZN16LiteralReference2soE ={{.*}} constant ptr getelementptr (i8, ptr @[[TEMP]], i64 4)
constexpr int &&so = Subobj{ 1, 2, 3 }.b;
struct Dummy { int padding; };
int *p;
};
static_assert(!__is_literal(NonTrivialDtor), "");
- // CHECK: @_ZN19NonLiteralConstexpr3ntdE ={{.*}} global {{.*}} { i32 120, i32* getelementptr
+ // CHECK: @_ZN19NonLiteralConstexpr3ntdE ={{.*}} global {{.*}} { i32 120, ptr @
NonTrivialDtor ntd;
struct VolatileMember {
Both b;
void StaticVars() {
- // CHECK: @_ZZN19NonLiteralConstexpr10StaticVarsEvE3ntd = {{.*}} { i32 120, i32* getelementptr {{.*}}
+ // CHECK: @_ZZN19NonLiteralConstexpr10StaticVarsEvE3ntd = {{.*}} { i32 120, ptr @
// CHECK: @_ZGVZN19NonLiteralConstexpr10StaticVarsEvE3ntd =
static NonTrivialDtor ntd;
// CHECK: @_ZZN19NonLiteralConstexpr10StaticVarsEvE2vm = {{.*}} { i32 5 }
constexpr E() : B(3), c{'b','y','e'} {}
char c[3];
};
- // CHECK: @_ZN14VirtualMembers1eE ={{.*}} global { i8**, double, i32, i8**, double, [5 x i8], i16, i8**, double, [5 x i8], [3 x i8] } { i8** getelementptr inbounds ({ [3 x i8*], [4 x i8*], [4 x i8*] }, { [3 x i8*], [4 x i8*], [4 x i8*] }* @_ZTVN14VirtualMembers1EE, i32 0, inrange i32 0, i32 2), double 1.000000e+00, i32 64, i8** getelementptr inbounds ({ [3 x i8*], [4 x i8*], [4 x i8*] }, { [3 x i8*], [4 x i8*], [4 x i8*] }* @_ZTVN14VirtualMembers1EE, i32 0, inrange i32 1, i32 2), double 2.000000e+00, [5 x i8] c"hello", i16 5, i8** getelementptr inbounds ({ [3 x i8*], [4 x i8*], [4 x i8*] }, { [3 x i8*], [4 x i8*], [4 x i8*] }* @_ZTVN14VirtualMembers1EE, i32 0, inrange i32 2, i32 2), double 3.000000e+00, [5 x i8] c"world", [3 x i8] c"bye" }
+ // CHECK: @_ZN14VirtualMembers1eE ={{.*}} global { ptr, double, i32, ptr, double, [5 x i8], i16, ptr, double, [5 x i8], [3 x i8] } { ptr getelementptr inbounds ({ [3 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTVN14VirtualMembers1EE, i32 0, inrange i32 0, i32 2), double 1.000000e+00, i32 64, ptr getelementptr inbounds ({ [3 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTVN14VirtualMembers1EE, i32 0, inrange i32 1, i32 2), double 2.000000e+00, [5 x i8] c"hello", i16 5, ptr getelementptr inbounds ({ [3 x ptr], [4 x ptr], [4 x ptr] }, ptr @_ZTVN14VirtualMembers1EE, i32 0, inrange i32 2, i32 2), double 3.000000e+00, [5 x i8] c"world", [3 x i8] c"bye" }
E e;
struct nsMemoryImpl {
virtual void f();
};
- // CHECK: @_ZN14VirtualMembersL13sGlobalMemoryE = internal global { i8** } { i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTVN14VirtualMembers12nsMemoryImplE, i32 0, inrange i32 0, i32 2) }
+ // CHECK: @_ZN14VirtualMembersL13sGlobalMemoryE = internal global %"struct.VirtualMembers::nsMemoryImpl" { ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN14VirtualMembers12nsMemoryImplE, i32 0, inrange i32 0, i32 2) }
__attribute__((used))
static nsMemoryImpl sGlobalMemory;
T t;
};
- // CHECK: @_ZN14VirtualMembers1tE ={{.*}} global { i8**, i32 } { i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTVN14VirtualMembers13TemplateClassIiEE, i32 0, inrange i32 0, i32 2), i32 42 }
+ // CHECK: @_ZN14VirtualMembers1tE ={{.*}} global { ptr, i32 } { ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN14VirtualMembers13TemplateClassIiEE, i32 0, inrange i32 0, i32 2), i32 42 }
TemplateClass<int> t;
}
struct B { const A (&x)[2]; };
// CHECK: @[[A1:_ZGRN14ArrayTemporary1bE.*]] = internal constant [3 x i32] [i32 1, i32 2, i32 3]
// CHECK: @[[A2:_ZGRN14ArrayTemporary1bE.*]] = internal constant [3 x i32] [i32 4, i32 5, i32 6]
- // CHECK: @[[ARR:_ZGRN14ArrayTemporary1bE.*]] = internal constant [2 x {{.*}}] [{{.*}} { [3 x i32]* @[[A1]] }, {{.*}} { [3 x i32]* @[[A2]] }]
- // CHECK: @[[B:_ZGRN14ArrayTemporary1bE.*]] = internal global {{.*}} { [2 x {{.*}}]* @[[ARR]] }
- // CHECK: @_ZN14ArrayTemporary1bE ={{.*}} constant {{.*}}* @[[B]]
+ // CHECK: @[[ARR:_ZGRN14ArrayTemporary1bE.*]] = internal constant [2 x {{.*}}] [{{.*}} { ptr @[[A1]] }, {{.*}} { ptr @[[A2]] }]
+ // CHECK: @[[B:_ZGRN14ArrayTemporary1bE.*]] = internal global {{.*}} { ptr @[[ARR]] }
+ // CHECK: @_ZN14ArrayTemporary1bE ={{.*}} constant ptr @[[B]]
B &&b = { { { { 1, 2, 3 } }, { { 4, 5, 6 } } } };
}
// FIXME: This declaration should not be emitted -- it isn't odr-used.
// CHECK: @_ZN22UnemittedTemporaryDecl3refE
- // CHECK: @_ZN22UnemittedTemporaryDecl4ref2E ={{.*}} constant i32* @_ZGRN22UnemittedTemporaryDecl3refE_
+ // CHECK: @_ZN22UnemittedTemporaryDecl4ref2E ={{.*}} constant ptr @_ZGRN22UnemittedTemporaryDecl3refE_
}
namespace DR2126 {
constexpr const A &a = {42};
// CHECK: @_ZGRN6DR21261aE0_ = internal global i32 42
// FIXME: This is unused and need not be emitted.
- // CHECK: @_ZGRN6DR21261aE_ = internal constant {{.*}} { i32* @_ZGRN6DR21261aE0_ }
- // CHECK: @_ZN6DR21261rE ={{.*}} constant i32* @_ZGRN6DR21261aE0_
+ // CHECK: @_ZGRN6DR21261aE_ = internal constant {{.*}} { ptr @_ZGRN6DR21261aE0_ }
+ // CHECK: @_ZN6DR21261rE ={{.*}} constant ptr @_ZGRN6DR21261aE0_
int &r = a.b;
// Dynamically initialized: the temporary object bound to 'b' could be
// modified (eg, by placement 'new') before the initializer of 's' runs.
constexpr A &&b = {42};
- // CHECK: @_ZN6DR21261sE ={{.*}} global i32* null
+ // CHECK: @_ZN6DR21261sE ={{.*}} global ptr null
int &s = b.b;
}
// CHECK: @_ZZN12LocalVarInit4ctorEvE1a = internal constant {{.*}} i32 102
// CHECK: @__const._ZN12LocalVarInit8mutable_Ev.a = private unnamed_addr constant {{.*}} i32 103
// CHECK: @_ZGRN33ClassTemplateWithStaticDataMember1SIvE1aE_ = linkonce_odr constant i32 5, comdat
-// CHECK: @_ZN33ClassTemplateWithStaticDataMember3useE ={{.*}} constant i32* @_ZGRN33ClassTemplateWithStaticDataMember1SIvE1aE_
+// CHECK: @_ZN33ClassTemplateWithStaticDataMember3useE ={{.*}} constant ptr @_ZGRN33ClassTemplateWithStaticDataMember1SIvE1aE_
// CHECK: @_ZGRN39ClassTemplateWithHiddenStaticDataMember1SIvE1aE_ = linkonce_odr hidden constant i32 5, comdat
-// CHECK: @_ZN39ClassTemplateWithHiddenStaticDataMember3useE ={{.*}} constant i32* @_ZGRN39ClassTemplateWithHiddenStaticDataMember1SIvE1aE_
+// CHECK: @_ZN39ClassTemplateWithHiddenStaticDataMember3useE ={{.*}} constant ptr @_ZGRN39ClassTemplateWithHiddenStaticDataMember1SIvE1aE_
// CHECK: @_ZGRZN20InlineStaticConstRef3funEvE1i_ = linkonce_odr constant i32 10, comdat
// CHECK20: @_ZZN12LocalVarInit4dtorEvE1a = internal constant {{.*}} i32 103
// emit an initializer to register its destructor.
// CHECK: define {{.*}}cxx_global_var_init{{.*}}
// CHECK-NOT: NonLiteralConstexpr
-// CHECK: call {{.*}}cxa_atexit{{.*}} @_ZN19NonLiteralConstexpr14NonTrivialDtorD1Ev {{.*}} @_ZN19NonLiteralConstexpr3ntdE
+// CHECK: call {{.*}}cxa_atexit(ptr @_ZN19NonLiteralConstexpr14NonTrivialDtorD1Ev, ptr @_ZN19NonLiteralConstexpr3ntdE
// CHECK-NEXT: ret void
// We don't need to emit any dynamic initialization for NonLiteralConstexpr::vm.
// emit an initializer to register its destructor.
// CHECK: define {{.*}}cxx_global_var_init{{.*}}
// CHECK-NOT: NonLiteralConstexpr
-// CHECK: call {{.*}}cxa_atexit{{.*}} @_ZN19NonLiteralConstexpr4BothD1Ev {{.*}} @_ZN19NonLiteralConstexpr1bE
+// CHECK: call {{.*}}cxa_atexit(ptr @_ZN19NonLiteralConstexpr4BothD1Ev, ptr @_ZN19NonLiteralConstexpr1bE
// CHECK-NEXT: ret void
// CHECK: define {{.*}}NonLiteralConstexpr10StaticVars
// Make sure we refuse to constant-fold the variable b.
constexpr long a(bool x) { return x ? 0 : (long)&&lbl + (0 && ({lbl: 0;})); }
void test() { static long b = (long)&&lbl - a(false); lbl: return; }
- // CHECK: sub nsw i64 ptrtoint (i8* blockaddress(@_ZN18CrossFuncLabelDiff4testEv, {{.*}}) to i64),
- // CHECK: store i64 {{.*}}, i64* @_ZZN18CrossFuncLabelDiff4testEvE1b, align 8
+ // CHECK: sub nsw i64 ptrtoint (ptr blockaddress(@_ZN18CrossFuncLabelDiff4testEv, {{.*}}) to i64),
+ // CHECK: store i64 {{.*}}, ptr @_ZZN18CrossFuncLabelDiff4testEvE1b, align 8
}
// PR12012
// We must not emit a load of 'p' here, since it's not odr-used.
int q = *p;
// CHECK-NOT: _ZN12Unreferenced1pE
- // CHECK: = load i32, i32* @_ZN12Unreferenced1nE
- // CHECK-NEXT: store i32 {{.*}}, i32* @_ZN12Unreferenced1qE
+ // CHECK: = load i32, ptr @_ZN12Unreferenced1nE
+ // CHECK-NEXT: store i32 {{.*}}, ptr @_ZN12Unreferenced1qE
// CHECK-NOT: _ZN12Unreferenced1pE
// Technically, we are not required to substitute variables of reference types
// CHECK: call void @_ZN13InitFromConst7consumeIdEEvT_(double noundef 4.300000e+00)
consume(d);
- // CHECK: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(%"struct.InitFromConst::S"* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) @_ZN13InitFromConstL1sE)
+ // CHECK: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) @_ZN13InitFromConstL1sE)
consume<const S&>(s);
- // CHECK: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(%"struct.InitFromConst::S"* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) @_ZN13InitFromConstL1sE)
+ // CHECK: call void @_ZN13InitFromConst7consumeIRKNS_1SEEEvT_(ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) @_ZN13InitFromConstL1sE)
consume<const S&>(r);
- // CHECK: call void @_ZN13InitFromConst7consumeIPKNS_1SEEEvT_(%"struct.InitFromConst::S"* noundef @_ZN13InitFromConstL1sE)
+ // CHECK: call void @_ZN13InitFromConst7consumeIPKNS_1SEEEvT_(ptr noundef @_ZN13InitFromConstL1sE)
consume(p);
// CHECK: call void @_ZN13InitFromConst7consumeIMNS_1SEiEEvT_(i64 0)
consume(mp);
- // CHECK: call void @_ZN13InitFromConst7consumeIPKiEEvT_(i32* noundef getelementptr inbounds ([3 x i32], [3 x i32]* @_ZN13InitFromConstL1aE, i64 0, i64 0))
+ // CHECK: call void @_ZN13InitFromConst7consumeIPKiEEvT_(ptr noundef @_ZN13InitFromConstL1aE)
consume(a);
}
}
inline const int &fun() {
static const int &i = 10;
return i;
- // CHECK: ret i32* @_ZGRZN20InlineStaticConstRef3funEvE1i_
+ // CHECK: ret ptr @_ZGRZN20InlineStaticConstRef3funEvE1i_
}
const int &use = fun();
}
// VirtualMembers::TemplateClass::templateMethod() must be defined in this TU,
// not just declared.
-// CHECK: define linkonce_odr void @_ZN14VirtualMembers13TemplateClassIiE14templateMethodEv(%"struct.VirtualMembers::TemplateClass"* {{[^,]*}} %this)
+// CHECK: define linkonce_odr void @_ZN14VirtualMembers13TemplateClassIiE14templateMethodEv(ptr {{[^,]*}} %this)
-// RUN: %clang_cc1 -no-opaque-pointers -verify -triple x86_64-apple-darwin -emit-llvm -o - %s -std=c++1y | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin -emit-llvm -o - %s -std=c++1y | FileCheck %s
// expected-no-diagnostics
struct A {
constexpr int f(int &r) { r *= 9; return r - 12; }
A a = { 6, f(a.temporary) };
// CHECK: @_ZGRN21ModifyStaticTemporary1aE_ = internal global i32 54
- // CHECK: @_ZN21ModifyStaticTemporary1aE ={{.*}} global {{.*}} i32* @_ZGRN21ModifyStaticTemporary1aE_, i32 42
+ // CHECK: @_ZN21ModifyStaticTemporary1aE ={{.*}} global {{.*}} ptr @_ZGRN21ModifyStaticTemporary1aE_, i32 42
A b = { 7, ++b.temporary };
// CHECK: @_ZGRN21ModifyStaticTemporary1bE_ = internal global i32 8
- // CHECK: @_ZN21ModifyStaticTemporary1bE ={{.*}} global {{.*}} i32* @_ZGRN21ModifyStaticTemporary1bE_, i32 8
+ // CHECK: @_ZN21ModifyStaticTemporary1bE ={{.*}} global {{.*}} ptr @_ZGRN21ModifyStaticTemporary1bE_, i32 8
// Can't emit all of 'c' as a constant here, so emit the initial value of
// 'c.temporary', not the value as modified by the partial evaluation within
}
// CHECK: @_ZGRN28VariableTemplateWithConstRef1iIvEE_ = linkonce_odr constant i32 5, align 4
-// CHECK: @_ZN28VariableTemplateWithConstRef3useE ={{.*}} constant i32* @_ZGRN28VariableTemplateWithConstRef1iIvEE_
+// CHECK: @_ZN28VariableTemplateWithConstRef3useE ={{.*}} constant ptr @_ZGRN28VariableTemplateWithConstRef1iIvEE_
namespace VariableTemplateWithConstRef {
template <typename T>
const int &i = 5;
}
// CHECK: @_ZGRN34HiddenVariableTemplateWithConstRef1iIvEE_ = linkonce_odr hidden constant i32 5, align 4
-// CHECK: @_ZN34HiddenVariableTemplateWithConstRef3useE ={{.*}} constant i32* @_ZGRN34HiddenVariableTemplateWithConstRef1iIvEE_
+// CHECK: @_ZN34HiddenVariableTemplateWithConstRef3useE ={{.*}} constant ptr @_ZGRN34HiddenVariableTemplateWithConstRef1iIvEE_
namespace HiddenVariableTemplateWithConstRef {
template <typename T>
__attribute__((visibility("hidden"))) const int &i = 5;
}
// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE1_ = linkonce_odr constant i32 1
-// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE0_ = linkonce_odr global {{.*}} { i32* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE1_ }
+// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE0_ = linkonce_odr global {{.*}} { ptr @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE1_ }
// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE3_ = linkonce_odr constant i32 2
-// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE2_ = linkonce_odr global {{.*}} { i32* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE3_ }
+// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE2_ = linkonce_odr global {{.*}} { ptr @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE3_ }
// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE5_ = linkonce_odr constant i32 3
-// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE4_ = linkonce_odr global {{.*}} { i32* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE5_ }
+// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE4_ = linkonce_odr global {{.*}} { ptr @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE5_ }
// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE7_ = linkonce_odr constant i32 4
-// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE6_ = linkonce_odr global {{.*}} { i32* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE7_ }
-// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE_ = linkonce_odr global %"struct.VariableTemplateWithPack::S" { {{.*}}* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE0_, {{.*}}* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE2_, {{.*}}* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE4_, {{.*}}* @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE6_ }
+// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE6_ = linkonce_odr global {{.*}} { ptr @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE7_ }
+// CHECK: @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE_ = linkonce_odr global %"struct.VariableTemplateWithPack::S" { ptr @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE0_, ptr @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE2_, ptr @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE4_, ptr @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE6_ }
// CHECK: @_ZN24VariableTemplateWithPack1pE ={{.*}} global {{.*}} @_ZGRN24VariableTemplateWithPack1sIJLi1ELi2ELi3ELi4EEEE_
namespace VariableTemplateWithPack {
struct A {
S *p = &s<1, 2, 3, 4>;
}
-// CHECK: __cxa_atexit({{.*}} @_ZN1BD1Ev {{.*}} @b
+// CHECK: __cxa_atexit({{.*}} @_ZN1BD1Ev, {{.*}} @b
// CHECK: define
// CHECK-NOT: @_ZGRN21ModifyStaticTemporary1cE_
-// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -emit-llvm -std=c++98 -o - %s | FileCheck %s
-// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin -emit-llvm -std=c++11 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -std=c++98 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -std=c++11 -o - %s | FileCheck %s
// CHECK: @a = global i32 10
int a = 10;
-// CHECK: @ar = constant i32* @a
+// CHECK: @ar = constant ptr @a
int &ar = a;
void f();
-// CHECK: @fr = constant void ()* @_Z1fv
+// CHECK: @fr = constant ptr @_Z1fv
void (&fr)() = f;
struct S { int& a; };
-// CHECK: @s = global %struct.S { i32* @a }
+// CHECK: @s = global %struct.S { ptr @a }
S s = { a };
// PR5581
// CHECK: @_ZN5test22t0E = global double {{1\.0+e\+0+}}, align 8
// CHECK: @_ZN5test22t1E = global [2 x double] [double {{1\.0+e\+0+}}, double {{5\.0+e-0*}}1], align 16
- // CHECK: @_ZN5test22t2E = global double* @_ZN5test21A1d
+ // CHECK: @_ZN5test22t2E = global ptr @_ZN5test21A1d
// CHECK: @_ZN5test22t3E = global {{.*}} @_ZN5test21A1g
double t0 = A::d;
double t1[] = { A::d, A::f };
void UnfoldableAddrLabelDiff() { static __int128_t x = (long)&&a-(long)&&b; a:b:return;}
// But make sure we do fold this.
-// CHECK: @_ZZ21FoldableAddrLabelDiffvE1x = internal global i64 sub (i64 ptrtoint (i8* blockaddress(@_Z21FoldableAddrLabelDiffv
+// CHECK: @_ZZ21FoldableAddrLabelDiffvE1x = internal global i64 sub (i64 ptrtoint (ptr blockaddress(@_Z21FoldableAddrLabelDiffv
void FoldableAddrLabelDiff() { static long x = (long)&&a-(long)&&b; a:b:return;}
-// CHECK: @i = constant i32* bitcast (float* @PR9558 to i32*)
+// CHECK: @i = constant ptr @PR9558
int &i = reinterpret_cast<int&>(PR9558);
int arr[2];
-// CHECK: @pastEnd = constant i32* bitcast (i8* getelementptr (i8, i8* bitcast ([2 x i32]* @arr to i8*), i64 8) to i32*)
+// CHECK: @pastEnd = constant ptr getelementptr (i8, ptr @arr, i64 8)
int &pastEnd = arr[2];
// CHECK: @[[WCHAR_STR:.*]] = internal global [2 x i32] [i32 112, i32 0],
-// CHECK: @PR51105_a = global i32* {{.*}} @[[WCHAR_STR]],
+// CHECK: @PR51105_a = global ptr @[[WCHAR_STR]],
wchar_t *PR51105_a = (wchar_t[2]){ (L"p") };
// CHECK: @[[CHAR_STR:.*]] = internal global [5 x i8] c"p\00\00\00\00",
-// CHECK: @PR51105_b = global i8* {{.*}} @[[CHAR_STR]],
+// CHECK: @PR51105_b = global ptr @[[CHAR_STR]],
char *PR51105_b = (char [5]){ ("p") };
struct X {
};
long k;
X x = {(long)&k};
-// CHECK: store i8 ptrtoint (i64* @k to i8), i8* getelementptr inbounds (%struct.X, %struct.X* @x, i32 0, i32 0)
+// CHECK: store i8 ptrtoint (ptr @k to i8), ptr @x
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=i686-unknown-linux | FileCheck --check-prefix=CHECKGEN %s
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=thumbv7-apple-ios6.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKARM %s
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=thumbv7-apple-ios5.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKIOS5 %s
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=wasm32-unknown-unknown \
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-unknown-linux | FileCheck --check-prefix=CHECKGEN %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-apple-ios6.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKARM %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-apple-ios5.0 -target-abi apcs-gnu | FileCheck --check-prefix=CHECKIOS5 %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=wasm32-unknown-unknown \
//RUN: | FileCheck --check-prefix=CHECKARM %s
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=x86_64-unknown-fuchsia | FileCheck --check-prefix=CHECKFUCHSIA %s
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=aarch64-unknown-fuchsia | FileCheck --check-prefix=CHECKFUCHSIA %s
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=i386-pc-win32 -fno-rtti | FileCheck --check-prefix=CHECKMS %s
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=i686-unknown-linux-gnu -fctor-dtor-return-this | FileCheck --check-prefix=CHECKI686RET %s
-//RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=aarch64-unknown-linux-gnu -fctor-dtor-return-this | FileCheck --check-prefix=CHECKAARCH64RET %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-unknown-fuchsia | FileCheck --check-prefix=CHECKFUCHSIA %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=aarch64-unknown-fuchsia | FileCheck --check-prefix=CHECKFUCHSIA %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=i386-pc-win32 -fno-rtti | FileCheck --check-prefix=CHECKMS %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-unknown-linux-gnu -fctor-dtor-return-this | FileCheck --check-prefix=CHECKI686RET %s
+//RUN: %clang_cc1 %s -emit-llvm -o - -triple=aarch64-unknown-linux-gnu -fctor-dtor-return-this | FileCheck --check-prefix=CHECKAARCH64RET %s
// FIXME: these tests crash on the bots when run with -triple=x86_64-pc-win32
// Make sure we attach the 'returned' attribute to the 'this' parameter of
B::B(int *i) : i_(i) { }
B::~B() { }
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1BC2EPi(%class.B* {{[^,]*}} %this, i32* noundef %i)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1BC1EPi(%class.B* {{[^,]*}} %this, i32* noundef %i)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1BD2Ev(%class.B* {{[^,]*}} %this)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1BD1Ev(%class.B* {{[^,]*}} %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1BC2EPi(ptr {{[^,]*}} %this, ptr noundef %i)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1BC1EPi(ptr {{[^,]*}} %this, ptr noundef %i)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1BD2Ev(ptr {{[^,]*}} %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1BD1Ev(ptr {{[^,]*}} %this)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.B* @_ZN1BC2EPi(%class.B* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.B* @_ZN1BC1EPi(%class.B* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.B* @_ZN1BD2Ev(%class.B* {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.B* @_ZN1BD1Ev(%class.B* {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1BC2EPi(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1BC1EPi(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1BD2Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1BD1Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKI686RET-LABEL: define{{.*}} %class.B* @_ZN1BC2EPi(%class.B* {{[^,]*}} %this, i32* noundef %i)
-// CHECKI686RET-LABEL: define{{.*}} %class.B* @_ZN1BC1EPi(%class.B* {{[^,]*}} %this, i32* noundef %i)
-// CHECKI686RET-LABEL: define{{.*}} %class.B* @_ZN1BD2Ev(%class.B* {{[^,]*}} %this)
-// CHECKI686RET-LABEL: define{{.*}} %class.B* @_ZN1BD1Ev(%class.B* {{[^,]*}} %this)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1BC2EPi(ptr {{[^,]*}} %this, ptr noundef %i)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1BC1EPi(ptr {{[^,]*}} %this, ptr noundef %i)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1BD2Ev(ptr {{[^,]*}} %this)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1BD1Ev(ptr {{[^,]*}} %this)
-// CHECKIOS5-LABEL: define{{.*}} %class.B* @_ZN1BC2EPi(%class.B* {{[^,]*}} %this, i32* noundef %i)
-// CHECKIOS5-LABEL: define{{.*}} %class.B* @_ZN1BC1EPi(%class.B* {{[^,]*}} %this, i32* noundef %i)
-// CHECKIOS5-LABEL: define{{.*}} %class.B* @_ZN1BD2Ev(%class.B* {{[^,]*}} %this)
-// CHECKIOS5-LABEL: define{{.*}} %class.B* @_ZN1BD1Ev(%class.B* {{[^,]*}} %this)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1BC2EPi(ptr {{[^,]*}} %this, ptr noundef %i)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1BC1EPi(ptr {{[^,]*}} %this, ptr noundef %i)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1BD2Ev(ptr {{[^,]*}} %this)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1BD1Ev(ptr {{[^,]*}} %this)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.B* @_ZN1BC2EPi(%class.B* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.B* @_ZN1BC1EPi(%class.B* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.B* @_ZN1BD2Ev(%class.B* {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.B* @_ZN1BD1Ev(%class.B* {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1BC2EPi(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1BC1EPi(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1BD2Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1BD1Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKMS-LABEL: define dso_local x86_thiscallcc noundef %class.B* @"??0B@@QAE@PAH@Z"(%class.B* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i)
-// CHECKMS-LABEL: define dso_local x86_thiscallcc void @"??1B@@UAE@XZ"(%class.B* {{[^,]*}} %this)
+// CHECKMS-LABEL: define dso_local x86_thiscallcc noundef ptr @"??0B@@QAE@PAH@Z"(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i)
+// CHECKMS-LABEL: define dso_local x86_thiscallcc void @"??1B@@UAE@XZ"(ptr {{[^,]*}} %this)
class C : public A, public B {
public:
C::C(int *i, char *c) : B(i), c_(c) { }
C::~C() { }
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1CC2EPiPc(%class.C* {{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1CC1EPiPc(%class.C* {{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1CD2Ev(%class.C* {{[^,]*}} %this)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1CD1Ev(%class.C* {{[^,]*}} %this)
-// CHECKGEN-LABEL: define{{.*}} void @_ZThn8_N1CD1Ev(%class.C* noundef %this)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1CD0Ev(%class.C* {{[^,]*}} %this)
-// CHECKGEN-LABEL: define{{.*}} void @_ZThn8_N1CD0Ev(%class.C* noundef %this)
-
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.C* @_ZN1CC2EPiPc(%class.C* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.C* @_ZN1CC1EPiPc(%class.C* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.C* @_ZN1CD2Ev(%class.C* {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.C* @_ZN1CD1Ev(%class.C* {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKARM-LABEL: define{{.*}} %class.C* @_ZThn8_N1CD1Ev(%class.C* noundef %this)
-// CHECKAARCH64RET-LABEL: define{{.*}} %class.C* @_ZThn16_N1CD1Ev(%class.C* noundef %this)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} void @_ZN1CD0Ev(%class.C* {{[^,]*}} %this)
-// CHECKARM-LABEL: define{{.*}} void @_ZThn8_N1CD0Ev(%class.C* noundef %this)
-// CHECKAARCH64RET-LABEL: define{{.*}} void @_ZThn16_N1CD0Ev(%class.C* noundef %this)
-
-// CHECKI686RET-LABEL: define{{.*}} %class.C* @_ZN1CC2EPiPc(%class.C* {{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKI686RET-LABEL: define{{.*}} %class.C* @_ZN1CC1EPiPc(%class.C* {{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKI686RET-LABEL: define{{.*}} %class.C* @_ZN1CD2Ev(%class.C* {{[^,]*}} %this)
-// CHECKI686RET-LABEL: define{{.*}} %class.C* @_ZN1CD1Ev(%class.C* {{[^,]*}} %this)
-// CHECKI686RET-LABEL: define{{.*}} %class.C* @_ZThn8_N1CD1Ev(%class.C* noundef %this)
-// CHECKI686RET-LABEL: define{{.*}} void @_ZN1CD0Ev(%class.C* {{[^,]*}} %this)
-// CHECKI686RET-LABEL: define{{.*}} void @_ZThn8_N1CD0Ev(%class.C* noundef %this)
-
-// CHECKIOS5-LABEL: define{{.*}} %class.C* @_ZN1CC2EPiPc(%class.C* {{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKIOS5-LABEL: define{{.*}} %class.C* @_ZN1CC1EPiPc(%class.C* {{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKIOS5-LABEL: define{{.*}} %class.C* @_ZN1CD2Ev(%class.C* {{[^,]*}} %this)
-// CHECKIOS5-LABEL: define{{.*}} %class.C* @_ZN1CD1Ev(%class.C* {{[^,]*}} %this)
-// CHECKIOS5-LABEL: define{{.*}} %class.C* @_ZThn8_N1CD1Ev(%class.C* noundef %this)
-// CHECKIOS5-LABEL: define{{.*}} void @_ZN1CD0Ev(%class.C* {{[^,]*}} %this)
-// CHECKIOS5-LABEL: define{{.*}} void @_ZThn8_N1CD0Ev(%class.C* noundef %this)
-
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.C* @_ZN1CC2EPiPc(%class.C* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.C* @_ZN1CC1EPiPc(%class.C* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.C* @_ZN1CD2Ev(%class.C* {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.C* @_ZN1CD1Ev(%class.C* {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.C* @_ZThn16_N1CD1Ev(%class.C* noundef %this)
-// CHECKFUCHSIA-LABEL: define{{.*}} void @_ZN1CD0Ev(%class.C* {{[^,]*}} %this)
-// CHECKFUCHSIA-LABEL: define{{.*}} void @_ZThn16_N1CD0Ev(%class.C* noundef %this)
-
-// CHECKMS-LABEL: define dso_local x86_thiscallcc noundef %class.C* @"??0C@@QAE@PAHPAD@Z"(%class.C* {{[^,]*}} returned{{[^,]*}} %this, i32* noundef %i, i8* noundef %c)
-// CHECKMS-LABEL: define dso_local x86_thiscallcc void @"??1C@@UAE@XZ"(%class.C* {{[^,]*}} %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1CC2EPiPc(ptr {{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1CC1EPiPc(ptr {{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1CD2Ev(ptr {{[^,]*}} %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1CD1Ev(ptr {{[^,]*}} %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZThn8_N1CD1Ev(ptr noundef %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1CD0Ev(ptr {{[^,]*}} %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZThn8_N1CD0Ev(ptr noundef %this)
+
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1CC2EPiPc(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1CC1EPiPc(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1CD2Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1CD1Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKARM-LABEL: define{{.*}} ptr @_ZThn8_N1CD1Ev(ptr noundef %this)
+// CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZThn16_N1CD1Ev(ptr noundef %this)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} void @_ZN1CD0Ev(ptr {{[^,]*}} %this)
+// CHECKARM-LABEL: define{{.*}} void @_ZThn8_N1CD0Ev(ptr noundef %this)
+// CHECKAARCH64RET-LABEL: define{{.*}} void @_ZThn16_N1CD0Ev(ptr noundef %this)
+
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1CC2EPiPc(ptr {{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1CC1EPiPc(ptr {{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1CD2Ev(ptr {{[^,]*}} %this)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1CD1Ev(ptr {{[^,]*}} %this)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZThn8_N1CD1Ev(ptr noundef %this)
+// CHECKI686RET-LABEL: define{{.*}} void @_ZN1CD0Ev(ptr {{[^,]*}} %this)
+// CHECKI686RET-LABEL: define{{.*}} void @_ZThn8_N1CD0Ev(ptr noundef %this)
+
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1CC2EPiPc(ptr {{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1CC1EPiPc(ptr {{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1CD2Ev(ptr {{[^,]*}} %this)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1CD1Ev(ptr {{[^,]*}} %this)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZThn8_N1CD1Ev(ptr noundef %this)
+// CHECKIOS5-LABEL: define{{.*}} void @_ZN1CD0Ev(ptr {{[^,]*}} %this)
+// CHECKIOS5-LABEL: define{{.*}} void @_ZThn8_N1CD0Ev(ptr noundef %this)
+
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1CC2EPiPc(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1CC1EPiPc(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1CD2Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1CD1Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZThn16_N1CD1Ev(ptr noundef %this)
+// CHECKFUCHSIA-LABEL: define{{.*}} void @_ZN1CD0Ev(ptr {{[^,]*}} %this)
+// CHECKFUCHSIA-LABEL: define{{.*}} void @_ZThn16_N1CD0Ev(ptr noundef %this)
+
+// CHECKMS-LABEL: define dso_local x86_thiscallcc noundef ptr @"??0C@@QAE@PAHPAD@Z"(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %i, ptr noundef %c)
+// CHECKMS-LABEL: define dso_local x86_thiscallcc void @"??1C@@UAE@XZ"(ptr {{[^,]*}} %this)
class D : public virtual A {
public:
D::D() { }
D::~D() { }
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1DC2Ev(%class.D* {{[^,]*}} %this, i8** noundef %vtt)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1DC1Ev(%class.D* {{[^,]*}} %this)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1DD2Ev(%class.D* {{[^,]*}} %this, i8** noundef %vtt)
-// CHECKGEN-LABEL: define{{.*}} void @_ZN1DD1Ev(%class.D* {{[^,]*}} %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1DC2Ev(ptr {{[^,]*}} %this, ptr noundef %vtt)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1DC1Ev(ptr {{[^,]*}} %this)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1DD2Ev(ptr {{[^,]*}} %this, ptr noundef %vtt)
+// CHECKGEN-LABEL: define{{.*}} void @_ZN1DD1Ev(ptr {{[^,]*}} %this)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.D* @_ZN1DC2Ev(%class.D* {{[^,]*}} returned{{[^,]*}} %this, i8** noundef %vtt)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.D* @_ZN1DC1Ev(%class.D* {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.D* @_ZN1DD2Ev(%class.D* {{[^,]*}} returned{{[^,]*}} %this, i8** noundef %vtt)
-// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} %class.D* @_ZN1DD1Ev(%class.D* {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1DC2Ev(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %vtt)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1DC1Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1DD2Ev(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %vtt)
+// CHECKARM-LABEL,CHECKAARCH64RET-LABEL: define{{.*}} ptr @_ZN1DD1Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKI686RET-LABEL: define{{.*}} %class.D* @_ZN1DC2Ev(%class.D* {{[^,]*}} %this, i8** noundef %vtt)
-// CHECKI686RET-LABEL: define{{.*}} %class.D* @_ZN1DC1Ev(%class.D* {{[^,]*}} %this)
-// CHECKI686RET-LABEL: define{{.*}} %class.D* @_ZN1DD2Ev(%class.D* {{[^,]*}} %this, i8** noundef %vtt)
-// CHECKI686RET-LABEL: define{{.*}} %class.D* @_ZN1DD1Ev(%class.D* {{[^,]*}} %this)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1DC2Ev(ptr {{[^,]*}} %this, ptr noundef %vtt)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1DC1Ev(ptr {{[^,]*}} %this)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1DD2Ev(ptr {{[^,]*}} %this, ptr noundef %vtt)
+// CHECKI686RET-LABEL: define{{.*}} ptr @_ZN1DD1Ev(ptr {{[^,]*}} %this)
-// CHECKIOS5-LABEL: define{{.*}} %class.D* @_ZN1DC2Ev(%class.D* {{[^,]*}} %this, i8** noundef %vtt)
-// CHECKIOS5-LABEL: define{{.*}} %class.D* @_ZN1DC1Ev(%class.D* {{[^,]*}} %this)
-// CHECKIOS5-LABEL: define{{.*}} %class.D* @_ZN1DD2Ev(%class.D* {{[^,]*}} %this, i8** noundef %vtt)
-// CHECKIOS5-LABEL: define{{.*}} %class.D* @_ZN1DD1Ev(%class.D* {{[^,]*}} %this)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1DC2Ev(ptr {{[^,]*}} %this, ptr noundef %vtt)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1DC1Ev(ptr {{[^,]*}} %this)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1DD2Ev(ptr {{[^,]*}} %this, ptr noundef %vtt)
+// CHECKIOS5-LABEL: define{{.*}} ptr @_ZN1DD1Ev(ptr {{[^,]*}} %this)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.D* @_ZN1DC2Ev(%class.D* {{[^,]*}} returned{{[^,]*}} %this, i8** noundef %vtt)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.D* @_ZN1DC1Ev(%class.D* {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.D* @_ZN1DD2Ev(%class.D* {{[^,]*}} returned{{[^,]*}} %this, i8** noundef %vtt)
-// CHECKFUCHSIA-LABEL: define{{.*}} %class.D* @_ZN1DD1Ev(%class.D* {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1DC2Ev(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %vtt)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1DC1Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1DD2Ev(ptr {{[^,]*}} returned{{[^,]*}} %this, ptr noundef %vtt)
+// CHECKFUCHSIA-LABEL: define{{.*}} ptr @_ZN1DD1Ev(ptr {{[^,]*}} returned{{[^,]*}} %this)
-// CHECKMS-LABEL: define dso_local x86_thiscallcc noundef %class.D* @"??0D@@QAE@XZ"(%class.D* {{[^,]*}} returned{{[^,]*}} %this, i32 noundef %is_most_derived)
-// CHECKMS-LABEL: define dso_local x86_thiscallcc void @"??1D@@UAE@XZ"(i8*{{[^,]*}} %this.coerce)
+// CHECKMS-LABEL: define dso_local x86_thiscallcc noundef ptr @"??0D@@QAE@XZ"(ptr {{[^,]*}} returned{{[^,]*}} %this, i32 noundef %is_most_derived)
+// CHECKMS-LABEL: define dso_local x86_thiscallcc void @"??1D@@UAE@XZ"(ptr{{[^,]*}} %this)
class E {
public:
// Verify that virtual calls to destructors are not marked with a 'returned'
// this parameter at the call site...
-// CHECKARM,CHECKAARCH64RET: [[VFN:%.*]] = getelementptr inbounds %class.E* (%class.E*)*, %class.E* (%class.E*)**
-// CHECKARM,CHECKAARCH64RET: [[THUNK:%.*]] = load %class.E* (%class.E*)*, %class.E* (%class.E*)** [[VFN]]
-// CHECKFUCHSIA: [[THUNK_I8:%.*]] = call i8* @llvm.load.relative.i32(i8* {{.*}}, i32 0)
-// CHECKFUCHSIA: [[THUNK:%.*]] = bitcast i8* [[THUNK_I8]] to %class.E* (%class.E*)*
-// CHECKARM,CHECKFUCHSIA,CHECKAARCH64RET: call noundef %class.E* [[THUNK]](%class.E* {{[^,]*}} %
+// CHECKARM,CHECKAARCH64RET: [[VFN:%.*]] = getelementptr inbounds ptr, ptr
+// CHECKARM,CHECKAARCH64RET: [[THUNK:%.*]] = load ptr, ptr [[VFN]]
+// CHECKFUCHSIA: [[THUNK:%.*]] = call ptr @llvm.load.relative.i32(ptr {{.*}}, i32 0)
+// CHECKARM,CHECKFUCHSIA,CHECKAARCH64RET: call noundef ptr [[THUNK]](ptr {{[^,]*}} %
// ...but static calls create declarations with 'returned' this
-// CHECKARM,CHECKFUCHSIA,CHECKAARCH64RET: {{%.*}} = call noundef %class.E* @_ZN1ED1Ev(%class.E* {{[^,]*}} %
+// CHECKARM,CHECKFUCHSIA,CHECKAARCH64RET: {{%.*}} = call noundef ptr @_ZN1ED1Ev(ptr {{[^,]*}} %
-// CHECKARM,CHECKFUCHSIA,CHECKAARCH64RET: declare noundef %class.E* @_ZN1ED1Ev(%class.E* {{[^,]*}} returned{{[^,]*}})
+// CHECKARM,CHECKFUCHSIA,CHECKAARCH64RET: declare noundef ptr @_ZN1ED1Ev(ptr {{[^,]*}} returned{{[^,]*}})
-// RUN: %clang_cc1 -no-opaque-pointers -std=c++11 -triple x86_64-apple-darwin10 %s -emit-llvm -o %t
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 %s -emit-llvm -o %t
// RUN: FileCheck %s < %t
// RUN: FileCheck -check-prefix=CHECK-PR10720 %s < %t
B(int);
};
- // CHECK-LABEL: define{{.*}} void @_ZN10InitVTable1BC2Ev(%"struct.InitVTable::B"* {{[^,]*}} %this) unnamed_addr
- // CHECK: [[T0:%.*]] = bitcast [[B:%.*]]* [[THIS:%.*]] to i32 (...)***
- // CHECK-NEXT: store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTVN10InitVTable1BE, i32 0, inrange i32 0, i32 2) to i32 (...)**), i32 (...)*** [[T0]]
- // CHECK: [[VTBL:%.*]] = load i32 ([[B]]*)**, i32 ([[B]]*)*** {{%.*}}
- // CHECK-NEXT: [[FNP:%.*]] = getelementptr inbounds i32 ([[B]]*)*, i32 ([[B]]*)** [[VTBL]], i64 0
- // CHECK-NEXT: [[FN:%.*]] = load i32 ([[B]]*)*, i32 ([[B]]*)** [[FNP]]
- // CHECK-NEXT: [[ARG:%.*]] = call noundef i32 [[FN]]([[B]]* {{[^,]*}} [[THIS]])
- // CHECK-NEXT: call void @_ZN10InitVTable1AC2Ei({{.*}}* {{[^,]*}} {{%.*}}, i32 noundef [[ARG]])
- // CHECK-NEXT: [[T0:%.*]] = bitcast [[B]]* [[THIS]] to i32 (...)***
- // CHECK-NEXT: store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTVN10InitVTable1BE, i32 0, inrange i32 0, i32 2) to i32 (...)**), i32 (...)*** [[T0]]
+ // CHECK-LABEL: define{{.*}} void @_ZN10InitVTable1BC2Ev(ptr {{[^,]*}} %this) unnamed_addr
+ // CHECK: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN10InitVTable1BE, i32 0, inrange i32 0, i32 2), ptr [[THIS:%.*]],
+ // CHECK: [[VTBL:%.*]] = load ptr, ptr {{%.*}}
+ // CHECK-NEXT: [[FNP:%.*]] = getelementptr inbounds ptr, ptr [[VTBL]], i64 0
+ // CHECK-NEXT: [[FN:%.*]] = load ptr, ptr [[FNP]]
+ // CHECK-NEXT: [[ARG:%.*]] = call noundef i32 [[FN]](ptr {{[^,]*}} [[THIS]])
+ // CHECK-NEXT: call void @_ZN10InitVTable1AC2Ei(ptr {{[^,]*}} {{%.*}}, i32 noundef [[ARG]])
+ // CHECK-NEXT: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN10InitVTable1BE, i32 0, inrange i32 0, i32 2), ptr [[THIS]]
// CHECK-NEXT: ret void
B::B() : A(foo()) {}
- // CHECK-LABEL: define{{.*}} void @_ZN10InitVTable1BC2Ei(%"struct.InitVTable::B"* {{[^,]*}} %this, i32 noundef %x) unnamed_addr
+ // CHECK-LABEL: define{{.*}} void @_ZN10InitVTable1BC2Ei(ptr {{[^,]*}} %this, i32 noundef %x) unnamed_addr
// CHECK: [[ARG:%.*]] = add nsw i32 {{%.*}}, 5
- // CHECK-NEXT: call void @_ZN10InitVTable1AC2Ei({{.*}}* {{[^,]*}} {{%.*}}, i32 noundef [[ARG]])
- // CHECK-NEXT: [[T0:%.*]] = bitcast [[B]]* {{%.*}} to i32 (...)***
- // CHECK-NEXT: store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTVN10InitVTable1BE, i32 0, inrange i32 0, i32 2) to i32 (...)**), i32 (...)*** [[T0]]
+ // CHECK-NEXT: call void @_ZN10InitVTable1AC2Ei(ptr {{[^,]*}} {{%.*}}, i32 noundef [[ARG]])
+ // CHECK-NEXT: store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTVN10InitVTable1BE, i32 0, inrange i32 0, i32 2), ptr {{%.*}}
// CHECK-NEXT: ret void
B::B(int x) : A(x + 5) {}
}
// CHECK: alloca
X x;
// CHECK-NEXT: [[I:%.*]] = alloca i32
- // CHECK-NEXT: store i32 17, i32* [[I]]
+ // CHECK-NEXT: store i32 17, ptr [[I]]
int i = 17;
// CHECK-NEXT: ret void
}
// Make sure that the instantiated constructor initializes start and
// end properly.
-// CHECK-LABEL: define linkonce_odr void @_ZN1XIiEC2ERKS0_(%struct.X* {{[^,]*}} %this, %struct.X* noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %other) unnamed_addr
+// CHECK-LABEL: define linkonce_odr void @_ZN1XIiEC2ERKS0_(ptr {{[^,]*}} %this, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %other) unnamed_addr
// CHECK: {{store.*null}}
// CHECK: {{store.*null}}
// CHECK: ret
-// RUN: %clang_cc1 -no-opaque-pointers %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases | FileCheck --check-prefix=NOOPT %s
+// RUN: %clang_cc1 %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases | FileCheck --check-prefix=NOOPT %s
-// RUN: %clang_cc1 -no-opaque-pointers %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-passes > %t
+// RUN: %clang_cc1 %s -triple i686-linux -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-passes > %t
// RUN: FileCheck --check-prefix=CHECK1 --input-file=%t %s
// RUN: FileCheck --check-prefix=CHECK2 --input-file=%t %s
// RUN: FileCheck --check-prefix=CHECK3 --input-file=%t %s
// RUN: FileCheck --check-prefix=CHECK5 --input-file=%t %s
// RUN: FileCheck --check-prefix=CHECK6 --input-file=%t %s
-// RUN: %clang_cc1 -no-opaque-pointers %s -triple i686-pc-windows-gnu -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-passes | FileCheck --check-prefix=COFF %s
+// RUN: %clang_cc1 %s -triple i686-pc-windows-gnu -emit-llvm -o - -mconstructor-aliases -O1 -disable-llvm-passes | FileCheck --check-prefix=COFF %s
namespace test1 {
// Test that we produce the appropriate comdats when creating aliases to
// weak_odr constructors and destructors.
// CHECK1: @_ZN5test16foobarIvEC1Ev = weak_odr unnamed_addr alias void {{.*}} @_ZN5test16foobarIvEC2Ev
-// CHECK1: @_ZN5test16foobarIvED1Ev = weak_odr unnamed_addr alias void (%"struct.test1::foobar"*), void (%"struct.test1::foobar"*)* @_ZN5test16foobarIvED2Ev
+// CHECK1: @_ZN5test16foobarIvED1Ev = weak_odr unnamed_addr alias void (ptr), ptr @_ZN5test16foobarIvED2Ev
// CHECK1: define weak_odr void @_ZN5test16foobarIvEC2Ev({{.*}} comdat($_ZN5test16foobarIvEC5Ev)
// CHECK1: define weak_odr void @_ZN5test16foobarIvED2Ev({{.*}} comdat($_ZN5test16foobarIvED5Ev)
// CHECK1: define weak_odr void @_ZN5test16foobarIvED0Ev({{.*}} comdat($_ZN5test16foobarIvED5Ev)
}
}
-// CHECK5: @_ZTV1C = linkonce_odr unnamed_addr constant { [4 x i8*] } {{[^@]*}}@_ZTI1C {{[^@]*}}@_ZN1CD2Ev {{[^@]*}}@_ZN1CD0Ev {{[^@]*}}]
+// CHECK5: @_ZTV1C = linkonce_odr unnamed_addr constant { [4 x ptr] } {{[^@]*}}@_ZTI1C, {{[^@]*}}@_ZN1CD2Ev, {{[^@]*}}@_ZN1CD0Ev]
// r194296 replaced C::~C with B::~B without emitting the later.
class A {