1 // RUN: %clang_cc1 -triple=i686-pc-win32 -fms-extensions %s -emit-llvm -o- | FileCheck %s 2 3 union A { 4 int *&ref; 5 int **ptr; 6 }; 7 8 int *f1(A *a) { 9 return a->ref; 10 } 11 // CHECK-LABEL: define {{.*}}i32* @"?f1@@YAPAHPATA@@@Z"(%union.A* noundef %a) 12 // CHECK: [[REF:%[^[:space:]]+]] = bitcast %union.A* %{{.*}} to i32*** 13 // CHECK: [[IPP:%[^[:space:]]+]] = load i32**, i32*** [[REF]] 14 // CHECK: [[IP:%[^[:space:]]+]] = load i32*, i32** [[IPP]] 15 // CHECK: ret i32* [[IP]] 16 17 void f2(A *a) { 18 *a->ref = 1; 19 } 20 // CHECK-LABEL: define {{.*}}void @"?f2@@YAXPATA@@@Z"(%union.A* noundef %a) 21 // CHECK: [[REF:%[^[:space:]]+]] = bitcast %union.A* %{{.*}} to i32*** 22 // CHECK: [[IPP:%[^[:space:]]+]] = load i32**, i32*** [[REF]] 23 // CHECK: [[IP:%[^[:space:]]+]] = load i32*, i32** [[IPP]] 24 // CHECK: store i32 1, i32* [[IP]] 25 26 bool f3(A *a, int *b) { 27 return a->ref != b; 28 } 29 // CHECK-LABEL: define {{.*}}i1 @"?f3@@YA_NPATA@@PAH@Z"(%union.A* noundef %a, i32* noundef %b) 30 // CHECK: [[REF:%[^[:space:]]+]] = bitcast %union.A* %{{.*}} to i32*** 31 // CHECK: [[IPP:%[^[:space:]]+]] = load i32**, i32*** [[REF]] 32 // CHECK: [[IP:%[^[:space:]]+]] = load i32*, i32** [[IPP]] 33 // CHECK: [[IP2:%[^[:space:]]+]] = load i32*, i32** %b.addr 34 // CHECK: icmp ne i32* [[IP]], [[IP2]] 35