xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/vla-4.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int f();
4*f4a2713aSLionel Sambuc int h();
5*f4a2713aSLionel Sambuc 
t1()6*f4a2713aSLionel Sambuc void t1() {
7*f4a2713aSLionel Sambuc   _Atomic(typeof((int (*)[f()]) h())) v;
8*f4a2713aSLionel Sambuc   // CHECK:      [[N:%.*]] = alloca i32*, align 4
9*f4a2713aSLionel Sambuc   // CHECK-NEXT: [[P:%.*]] = call i32 bitcast (i32 (...)* @f to i32 ()*)()
10*f4a2713aSLionel Sambuc   // CHECK-NEXT: [[P:%.*]] = call i32 bitcast (i32 (...)* @h to i32 ()*)()
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
t2()13*f4a2713aSLionel Sambuc void t2() {
14*f4a2713aSLionel Sambuc   typeof(typeof((int (*)[f()]) h())) v;
15*f4a2713aSLionel Sambuc   // CHECK:      [[N:%.*]] = alloca i32*, align 4
16*f4a2713aSLionel Sambuc   // CHECK-NEXT: [[P:%.*]] = call i32 bitcast (i32 (...)* @f to i32 ()*)()
17*f4a2713aSLionel Sambuc   // CHECK-NEXT: [[P:%.*]] = call i32 bitcast (i32 (...)* @h to i32 ()*)()
18*f4a2713aSLionel Sambuc }
19*f4a2713aSLionel Sambuc 
h()20*f4a2713aSLionel Sambuc void t3(typeof((int (*)[f()]) h()) v) {
21*f4a2713aSLionel Sambuc   // CHECK:      store i32* %v, i32** %{{[.0-9A-Za-z]+}}, align 4
22*f4a2713aSLionel Sambuc   // CHECK-NEXT: [[P:%.*]] = call i32 bitcast (i32 (...)* @f to i32 ()*)()
23*f4a2713aSLionel Sambuc   // CHECK-NEXT: [[P:%.*]] = call i32 bitcast (i32 (...)* @h to i32 ()*)()
24*f4a2713aSLionel Sambuc }
25