summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-10-29 12:21:55 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-10-29 12:21:55 +0000
commit330de03083138a9e4d93e9877352016c55abd668 (patch)
treefab39bf7b2b2bee4fefcc7e57f6852c00d43b3d6 /clang/test/CodeGen
parent77af3812ec50d0ff427cde119ea561e229f50ab2 (diff)
downloadbcm5719-llvm-330de03083138a9e4d93e9877352016c55abd668.tar.gz
bcm5719-llvm-330de03083138a9e4d93e9877352016c55abd668.zip
Improved capturing variable-length array types in CapturedStmt.
An updated implemnentation of VLA types capturing based on previously committed solution for Lambdas. This version captures the whole VLA type instead of particular variables which are part of VLA size expression and allows to use previusly calculated size of VLA type in captured regions. Required for OpenMP. Differential Revision: http://reviews.llvm.org/D5099 llvm-svn: 220850
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/captured-statements-nested.c74
-rw-r--r--clang/test/CodeGen/captured-statements.c11
2 files changed, 47 insertions, 38 deletions
diff --git a/clang/test/CodeGen/captured-statements-nested.c b/clang/test/CodeGen/captured-statements-nested.c
index 2ff9ee9cc88..c57226f259e 100644
--- a/clang/test/CodeGen/captured-statements-nested.c
+++ b/clang/test/CodeGen/captured-statements-nested.c
@@ -11,9 +11,9 @@ struct A {
void test_nest_captured_stmt(int param, int size, int param_arr[size]) {
int w;
int arr[param][size];
- // CHECK1: %struct.anon{{.*}} = type { i32*, i32*, i{{.+}}*, i32**, i32* }
- // CHECK1: %struct.anon{{.*}} = type { i32*, i32*, i32**, i32*, i{{.+}}*, i32**, i32* }
- // CHECK1: [[T:%struct.anon.*]] = type { i32*, i32*, %struct.A*, i32**, i32*, i{{.+}}*, i32**, i32* }
+ // CHECK1: %struct.anon{{.*}} = type { [[INT:i.+]]*, [[INT]]*, [[SIZE_TYPE:i.+]], [[INT]]**, [[INT]]*, [[SIZE_TYPE]], [[SIZE_TYPE]], [[INT]]* }
+ // CHECK1: %struct.anon{{.*}} = type { [[INT]]*, [[INT]]*, [[INT]]**, [[INT]]*, [[SIZE_TYPE]], [[INT]]**, [[INT]]*, [[SIZE_TYPE]], [[SIZE_TYPE]], [[INT]]* }
+ // CHECK1: [[T:%struct.anon.*]] = type { [[INT]]*, [[INT]]*, %struct.A*, [[INT]]**, [[INT]]*, [[SIZE_TYPE]], [[INT]]**, [[INT]]*, [[SIZE_TYPE]], [[SIZE_TYPE]], [[INT]]* }
#pragma clang __debug captured
{
int x;
@@ -31,39 +31,45 @@ void test_nest_captured_stmt(int param, int size, int param_arr[size]) {
arr[10][z.a] = 12;
// CHECK1: define internal void @__captured_stmt{{.*}}([[T]]
+ // CHECK1: [[PARAM_ARR_SIZE_REF:%.+]] = getelementptr inbounds [[T]]* {{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 5
+ // CHECK1: [[PARAM_ARR_SIZE:%.+]] = load [[SIZE_TYPE]]* [[PARAM_ARR_SIZE_REF]]
+ // CHECK1: [[ARR_SIZE1_REF:%.+]] = getelementptr inbounds [[T]]* {{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 8
+ // CHECK1: [[ARR_SIZE1:%.+]] = load [[SIZE_TYPE]]* [[ARR_SIZE1_REF]]
+ // CHECK1: [[ARR_SIZE2_REF:%.+]] = getelementptr inbounds [[T]]* {{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 9
+ // CHECK1: [[ARR_SIZE2:%.+]] = load [[SIZE_TYPE]]* [[ARR_SIZE2_REF]]
//
- // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i32 0, i32 2
+ // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2
// CHECK1-NEXT: load %struct.A**
// CHECK1-NEXT: getelementptr inbounds %struct.A*
// CHECK1-NEXT: store i{{.+}} 1
//
- // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i32 0, i32 1
- // CHECK1-NEXT: load i32**
- // CHECK1-NEXT: store i32 1
+ // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 1
+ // CHECK1-NEXT: load i{{[0-9]+}}**
+ // CHECK1-NEXT: store i{{[0-9]+}} 1
//
- // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i32 0, i32 0
- // CHECK1-NEXT: load i32**
- // CHECK1-NEXT: store i32 1
+ // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0
+ // CHECK1-NEXT: load i{{[0-9]+}}**
+ // CHECK1-NEXT: store i{{[0-9]+}} 1
//
- // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i32 0, i32 4
- // CHECK1-NEXT: load i32**
- // CHECK1-NEXT: load i32*
- // CHECK1-NEXT: getelementptr inbounds [[T]]* {{.*}}, i32 0, i32 3
- // CHECK1-NEXT: load i32***
- // CHECK1-NEXT: load i32**
- // CHECK1-NEXT: store i32
+ // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 4
+ // CHECK1-NEXT: load i{{[0-9]+}}**
+ // CHECK1-NEXT: load i{{[0-9]+}}*
+ // CHECK1-NEXT: getelementptr inbounds [[T]]* {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 3
+ // CHECK1-NEXT: load i{{[0-9]+}}***
+ // CHECK1-NEXT: load i{{[0-9]+}}**
+ // CHECK1-NEXT: store i{{[0-9]+}}
//
- // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i32 0, i32 2
+ // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2
// CHECK1-NEXT: load %struct.A**
// CHECK1-NEXT: getelementptr inbounds %struct.A*
// CHECK1-NEXT: store float
//
- // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i32 0, i32 2
+ // CHECK1: getelementptr inbounds [[T]]* {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2
// CHECK1-NEXT: load %struct.A**
// CHECK1-NEXT: getelementptr inbounds %struct.A*
// CHECK1-NEXT: store i8 99
//
- // CHECK1: [[SIZE_ADDR_REF:%.*]] = getelementptr inbounds [[T]]* {{.*}}, i{{.+}} 0, i{{.+}} 5
+ // CHECK1: [[SIZE_ADDR_REF:%.*]] = getelementptr inbounds [[T]]* {{.*}}, i{{.+}} 0, i{{.+}} 7
// CHECK1-DAG: [[SIZE_ADDR:%.*]] = load i{{.+}}** [[SIZE_ADDR_REF]]
// CHECK1-DAG: [[SIZE:%.*]] = load i{{.+}}* [[SIZE_ADDR]]
// CHECK1-DAG: [[PARAM_ARR_IDX:%.*]] = sub nsw i{{.+}} [[SIZE]], 1
@@ -77,7 +83,7 @@ void test_nest_captured_stmt(int param, int size, int param_arr[size]) {
// CHECK1-DAG: [[Z_ADDR:%.*]] = load %struct.A** [[Z_ADDR_REF]]
// CHECK1-DAG: [[Z_A_ADDR:%.*]] = getelementptr inbounds %struct.A* [[Z_ADDR]], i{{.+}} 0, i{{.+}} 0
// CHECK1-DAG: [[ARR_IDX_2:%.*]] = load i{{.+}}* [[Z_A_ADDR]]
- // CHECK1-DAG: [[ARR_ADDR_REF:%.*]] = getelementptr inbounds [[T]]* {{.*}}, i{{.+}} 0, i{{.+}} 7
+ // CHECK1-DAG: [[ARR_ADDR_REF:%.*]] = getelementptr inbounds [[T]]* {{.*}}, i{{.+}} 0, i{{.+}} 10
// CHECK1-DAG: [[ARR_ADDR:%.*]] = load i{{.+}}** [[ARR_ADDR_REF]]
// CHECK1-DAG: [[ARR_IDX_1:%.*]] = mul {{.*}} 10
// CHECK1-DAG: [[ARR_10_ADDR:%.*]] = getelementptr inbounds i{{.+}}* [[ARR_ADDR]], i{{.*}} [[ARR_IDX_1]]
@@ -102,15 +108,15 @@ void test_nest_block() {
// CHECK2: define internal void @{{.*}}test_nest_block_block_invoke
//
- // CHECK2: [[Z:%[0-9a-z_]*]] = alloca i32
+ // CHECK2: [[Z:%[0-9a-z_]*]] = alloca i{{[0-9]+}}
// CHECK2: alloca %struct.anon{{.*}}
//
- // CHECK2: store i32
- // CHECK2: store i32* [[Z]]
+ // CHECK2: store i{{[0-9]+}}
+ // CHECK2: store i{{[0-9]+}}* [[Z]]
//
// CHECK2: getelementptr inbounds %struct.anon
// CHECK2-NEXT: getelementptr inbounds
- // CHECK2-NEXT: store i32*
+ // CHECK2-NEXT: store i{{[0-9]+}}*
//
// CHECK2: call void @__captured_stmt
@@ -128,22 +134,22 @@ void test_nest_block() {
}
// CHECK2: alloca %struct.__block_byref_b
- // CHECK2-NEXT: [[C:%[0-9a-z_]*]] = alloca i32
+ // CHECK2-NEXT: [[C:%[0-9a-z_]*]] = alloca i{{[0-9]+}}
// CHECK2-NEXT: alloca %struct.__block_byref_d
//
// CHECK2: bitcast %struct.__block_byref_b*
// CHECK2-NEXT: store i8*
//
- // CHECK2: [[CapA:%[0-9a-z_.]*]] = getelementptr inbounds {{.*}}, i32 0, i32 7
+ // CHECK2: [[CapA:%[0-9a-z_.]*]] = getelementptr inbounds {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 7
//
- // CHECK2: getelementptr inbounds %struct.anon{{.*}}, i32 0, i32 0
- // CHECK2: load i32**
- // CHECK2: load i32*
- // CHECK2: store i32 {{.*}}, i32* [[CapA]]
+ // CHECK2: getelementptr inbounds %struct.anon{{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0
+ // CHECK2: load i{{[0-9]+}}**
+ // CHECK2: load i{{[0-9]+}}*
+ // CHECK2: store i{{[0-9]+}} {{.*}}, i{{[0-9]+}}* [[CapA]]
//
- // CHECK2: [[CapC:%[0-9a-z_.]*]] = getelementptr inbounds {{.*}}, i32 0, i32 8
- // CHECK2-NEXT: [[Val:%[0-9a-z_]*]] = load i32* [[C]]
- // CHECK2-NEXT: store i32 [[Val]], i32* [[CapC]]
+ // CHECK2: [[CapC:%[0-9a-z_.]*]] = getelementptr inbounds {{.*}}, i{{[0-9]+}} 0, i{{[0-9]+}} 8
+ // CHECK2-NEXT: [[Val:%[0-9a-z_]*]] = load i{{[0-9]+}}* [[C]]
+ // CHECK2-NEXT: store i{{[0-9]+}} [[Val]], i{{[0-9]+}}* [[CapC]]
//
// CHECK2: bitcast %struct.__block_byref_d*
// CHECK2-NEXT: store i8*
diff --git a/clang/test/CodeGen/captured-statements.c b/clang/test/CodeGen/captured-statements.c
index 85d597aeb3c..52747fba1e9 100644
--- a/clang/test/CodeGen/captured-statements.c
+++ b/clang/test/CodeGen/captured-statements.c
@@ -4,6 +4,8 @@
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-3
+typedef __INTPTR_TYPE__ intptr_t;
+
int foo();
int global;
@@ -61,15 +63,16 @@ void test3(int size) {
}
// Capture VLA array
-void test4(int size, int vla_arr[size]) {
+void test4(intptr_t size, intptr_t vla_arr[size]) {
#pragma clang __debug captured
{
vla_arr[0] = 1;
}
- // CHECK-3: test4([[INT:i.+]] {{.*}}[[SIZE:%.+]], [[INT]]*
- // CHECK-3: store [[INT]] {{.*}}[[SIZE]], [[INT]]* [[SIZE_ADDR:%.+]],
+ // CHECK-3: test4([[INTPTR_T:i.+]] {{.*}}[[SIZE_ARG:%.+]], [[INTPTR_T]]*
+ // CHECK-3: store [[INTPTR_T]] {{.*}}[[SIZE_ARG]], [[INTPTR_T]]* [[SIZE_ADDR:%.+]],
+ // CHECK-3: [[SIZE:%.+]] = load [[INTPTR_T]]* [[SIZE_ADDR]],
// CHECK-3: [[REF:%.+]] = getelementptr inbounds
- // CHECK-3: store [[INT]]* [[SIZE_ADDR]], [[INT]]** [[REF]]
+ // CHECK-3: store [[INTPTR_T]] [[SIZE]], [[INTPTR_T]]* [[REF]]
// CHECK-3: call void @__captured_stmt
}
OpenPOWER on IntegriCloud