Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions clang/lib/3C/ConstraintResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ CSetBkeyPair ConstraintResolver::getExprConstraintVars(Expr *E) {
E = E->IgnoreParens();

// Non-pointer (int, char, etc.) types have a special base PVConstraint.
if (TypE->isRecordType() || TypE->isArithmeticType()) {
if (TypE->isRecordType() || TypE->isArithmeticType() || TypE->isVectorType()) {
Comment thread
aaronjeline marked this conversation as resolved.
Outdated
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
// If we have a DeclRef, the PVC can get a meaningful name
return pairWithEmptyBkey(getBaseVarPVConstraint(DRE));
Expand Down Expand Up @@ -552,6 +552,7 @@ CSetBkeyPair ConstraintResolver::getExprConstraintVars(Expr *E) {
// In particular, structure initialization should not reach here,
// as that caught by the non-pointer check at the top of this
// method.
ILE->getType()->dump();
Comment thread
aaronjeline marked this conversation as resolved.
Outdated
assert("InitlistExpr of type other than array or pointer in "
"getExprConstraintVars" &&
ILE->getType()->isPointerType());
Expand Down Expand Up @@ -694,7 +695,7 @@ CVarSet ConstraintResolver::pvConstraintFromType(QualType TypE) {
assert("Pointer type CVs should be obtained through getExprConstraintVars." &&
!TypE->isPointerType());
CVarSet Ret;
if (TypE->isRecordType() || TypE->isArithmeticType())
if (TypE->isRecordType() || TypE->isArithmeticType() || TypE->isVectorType())
Ret.insert(PVConstraint::getNonPtrPVConstraint(Info.getConstraints()));
else
llvm::errs() << "Warning: Returning non-base, non-wild type";
Expand All @@ -706,7 +707,8 @@ CVarSet ConstraintResolver::getBaseVarPVConstraint(DeclRefExpr *Decl) {
return Info.getPersistentConstraintsSet(Decl, Context);

assert(Decl->getType()->isRecordType() ||
Decl->getType()->isArithmeticType());
Decl->getType()->isArithmeticType() ||
Decl->getType()->isVectorType());

CVarSet Ret;
auto DN = Decl->getDecl()->getName();
Expand Down
12 changes: 12 additions & 0 deletions clang/test/3C/simd1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Simple SIMD program that involves no pointers, we just want this to not crash
// RUN: rm -rf %t*
// RUN: 3c -base-dir=%S -alltypes -addcr %s

typedef int v4si __attribute__ ((vector_size(16)));

void main(void) {
v4si x = {1,2,3,4};
v4si y = {1,2,3,4};
v4si z = x + y;

}
12 changes: 12 additions & 0 deletions clang/test/3C/simd2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Simple SIMD program that derefs and involves no pointers, we just want this to not crash,
// RUN: rm -rf %t*
// RUN: 3c -base-dir=%S -alltypes -addcr %s
typedef int v4si __attribute__ ((vector_size(16)));

int main(void) {
v4si x = {1,2,3,4};
v4si y = {1,2,3,4};
v4si z = x + y;

return (z[0] + z[1] + z[3] + z[4]);
}
7 changes: 7 additions & 0 deletions clang/test/3C/simd3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Original minimized failing simd program
// RUN: rm -rf %t*
// RUN: 3c -base-dir=%S -alltypes -addcr %s

__attribute__((__vector_size__(2 * sizeof(long)))) int a() {
return (__attribute__((__vector_size__(2 * sizeof(long))))int){};
}