1 // RUN: %clang_cc1 -no-opaque-pointers %s -triple=x86_64-apple-darwin10 -emit-llvm -O3 -o - | FileCheck %s 2 /// Check that we pass the member pointers indirectly for MinGW64 3 // RUN: %clang_cc1 -no-opaque-pointers %s -triple=x86_64-windows-gnu -emit-llvm -o - | FileCheck %s -check-prefix MINGW64 4 /// We should be able to optimize calls via the indirectly passed member pointers 5 // RUN: %clang_cc1 -no-opaque-pointers %s -triple=x86_64-windows-gnu -emit-llvm -O3 -o - | FileCheck %s 6 struct A { 7 virtual int vf1() { return 1; } 8 virtual int vf2() { return 2; } 9 }; 10 11 int f(A* a, int (A::*fp)()) { 12 return (a->*fp)(); 13 } 14 15 // CHECK-LABEL: define{{.*}} i32 @_Z2g1v() 16 // CHECK-NOT: } 17 // CHECK: ret i32 1 18 // MINGW64-LABEL: define dso_local noundef i32 @_Z2g1v() 19 // MINGW64: call noundef i32 @_Z1fP1AMS_FivE(%struct.A* noundef %{{.*}}, { i64, i64 }* noundef %{{.*}}) 20 int g1() { 21 A a; 22 return f(&a, &A::vf1); 23 } 24 25 // CHECK-LABEL: define{{.*}} i32 @_Z2g2v() 26 // CHECK-NOT: } 27 // CHECK: ret i32 2 28 // MINGW64-LABEL: define dso_local noundef i32 @_Z2g2v() 29 // MINGW64: call noundef i32 @_Z1fP1AMS_FivE(%struct.A* noundef %{{.*}}, { i64, i64 }* noundef %{{.*}}) 30 int g2() { 31 A a; 32 return f(&a, &A::vf2); 33 } 34