diff options
| author | John McCall <rjmccall@apple.com> | 2011-06-24 21:55:10 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2011-06-24 21:55:10 +0000 |
| commit | 23c29fea92a130313bd389f23a696165eae4a36b (patch) | |
| tree | eb365d076c07900ff896e24907685ec3fb80dcc0 /clang/test/CodeGen | |
| parent | 932e5b5d52be4f901bf5370ee6d98349ee209643 (diff) | |
| download | bcm5719-llvm-23c29fea92a130313bd389f23a696165eae4a36b.tar.gz bcm5719-llvm-23c29fea92a130313bd389f23a696165eae4a36b.zip | |
Change the IR-generation of VLAs so that we capture bounds,
not sizes; so that we use well-typed allocas; and so that we
properly recurse through the full set of variably-modified types.
llvm-svn: 133827
Diffstat (limited to 'clang/test/CodeGen')
| -rw-r--r-- | clang/test/CodeGen/vla.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/clang/test/CodeGen/vla.c b/clang/test/CodeGen/vla.c index e5114a5b0db..f7cba25d934 100644 --- a/clang/test/CodeGen/vla.c +++ b/clang/test/CodeGen/vla.c @@ -88,13 +88,17 @@ int test2(int n) // http://llvm.org/PR8567 // CHECK: define double @test_PR8567 double test_PR8567(int n, double (*p)[n][5]) { - // CHECK: store [[vla_type:.*]] %p, - // CHECK: load i32* - // CHECK-NEXT: mul i32 40 - // CHECK-NEXT: [[byte_idx:%.*]] = mul i32 1 - // CHECK-NEXT: [[tmp_1:%.*]] = load [[vla_type]]* - // CHECK-NEXT: [[tmp_2:%.*]] = bitcast [[vla_type]] [[tmp_1]] to i8* - // CHECK-NEXT: [[idx:%.*]] = getelementptr inbounds i8* [[tmp_2]], i32 [[byte_idx]] - // CHECK-NEXT: bitcast i8* [[idx]] to [[vla_type]] + // CHECK: [[NV:%.*]] = alloca i32, align 4 + // CHECK-NEXT: [[PV:%.*]] = alloca [5 x double]*, align 4 + // CHECK-NEXT: store + // CHECK-NEXT: store + // CHECK-NEXT: [[N:%.*]] = load i32* [[NV]], align 4 + // CHECK-NEXT: [[P:%.*]] = load [5 x double]** [[PV]], align 4 + // CHECK-NEXT: [[T0:%.*]] = mul i32 1, [[N]] + // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds [5 x double]* [[P]], i32 [[T0]] + // CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds [5 x double]* [[T1]], i32 2 + // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds [5 x double]* [[T2]], i32 0, i32 3 + // CHECK-NEXT: [[T4:%.*]] = load double* [[T3]] + // CHECK-NEXT: ret double [[T4]] return p[1][2][3]; } |

