return nullptr;
Expr *Arg = ArgRes.get();
QualType ArgType = Arg->getType();
- if (!ParamType->isPointerType() ||
- ParamType.hasAddressSpace() ||
+ if (!ParamType->isPointerType() || ParamType.hasAddressSpace() ||
!ArgType->isPointerType() ||
- !ArgType->getPointeeType().hasAddressSpace()) {
+ !ArgType->getPointeeType().hasAddressSpace() ||
+ isPtrSizeAddressSpace(ArgType->getPointeeType().getAddressSpace())) {
OverloadParams.push_back(ParamType);
continue;
}
int_star __ptr32 p;
return sizeof(p);
}
+
+typedef __SIZE_TYPE__ size_t;
+size_t strlen(const char *);
+
+size_t test_calling_strlen_with_32_bit_pointer ( char *__ptr32 s ) {
+ // CHECK-LABEL: define dso_local i64 @test_calling_strlen_with_32_bit_pointer(ptr addrspace(270) noundef %s)
+ // CHECK-NEXT: entry:
+ // CHECK-NEXT: %s.addr = alloca ptr addrspace(270), align 4
+ // CHECK-NEXT: store ptr addrspace(270) %s, ptr %s.addr, align 4
+ // CHECK-NEXT: %0 = load ptr addrspace(270), ptr %s.addr, align 4
+ // CHECK-NEXT: %1 = addrspacecast ptr addrspace(270) %0 to ptr
+ // CHECK-NEXT: %call = call i64 @strlen(ptr noundef %1)
+ // CHECK-NEXT: ret i64 %call
+ return strlen ( s );
+}
+
+// CHECK-LABEL: declare dso_local i64 @strlen(ptr noundef)
+
+size_t test_calling_strlen_with_64_bit_pointer ( char *s ) {
+ // CHECK-LABEL: define dso_local i64 @test_calling_strlen_with_64_bit_pointer(ptr noundef %s)
+ // CHECK-NEXT: entry:
+ // CHECK-NEXT: %s.addr = alloca ptr, align 8
+ // CHECK-NEXT: store ptr %s, ptr %s.addr, align 8
+ // CHECK-NEXT: %0 = load ptr, ptr %s.addr, align 8
+ // CHECK-NEXT: %call = call i64 @strlen(ptr noundef %0)
+ // CHECK-NEXT: ret i64 %call
+ return strlen ( s );
+}