summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-09-17 04:07:02 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-09-17 04:07:02 +0000
commit1409e6e7c63bb1038ff3d36dc217f595d22762d4 (patch)
tree1c20e70c11c58acaa5140d5a47a816c49c43c6a7 /clang
parent79d1bff2ad2c7fac06418b5e4f74edb1d8cce03d (diff)
downloadbcm5719-llvm-1409e6e7c63bb1038ff3d36dc217f595d22762d4.tar.gz
bcm5719-llvm-1409e6e7c63bb1038ff3d36dc217f595d22762d4.zip
Fix const-eval of vector init-lists of a vector.
Like any other type, an init list for a vector can have the same type as the vector itself; handle that case. <rdar://problem/14990460> llvm-svn: 190844
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ExprConstant.cpp2
-rw-r--r--clang/test/CodeGenCXX/static-init-4.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 0a2cc7b3d6d..8ca33cbd20c 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -5262,7 +5262,7 @@ VectorExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
while (CountElts < NumElements) {
// Handle nested vector initialization.
if (CountInits < NumInits
- && E->getInit(CountInits)->getType()->isExtVectorType()) {
+ && E->getInit(CountInits)->getType()->isVectorType()) {
APValue v;
if (!EvaluateVector(E->getInit(CountInits), v, Info))
return Error(E);
diff --git a/clang/test/CodeGenCXX/static-init-4.cpp b/clang/test/CodeGenCXX/static-init-4.cpp
new file mode 100644
index 00000000000..a4bb987c8d3
--- /dev/null
+++ b/clang/test/CodeGenCXX/static-init-4.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -std=c++11 -S -emit-llvm -o - %s -triple x86_64-linux-gnu | FileCheck %s
+
+typedef __attribute__((vector_size(4*4))) float float32x4_t;
+union QDSUnion { float32x4_t q; float s[4]; };
+constexpr float32x4_t a = {1,2,3,4};
+QDSUnion t = {{(a)}};
+// CHECK: @t = global %union.QDSUnion { <4 x float> <float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00> }
OpenPOWER on IntegriCloud