Add support for passing -1 to __builtin_shufflevector to signify an undefined element value to match IR capabilities.
llvm-svn: 187694
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 4e0e76b..78995e3 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -1786,6 +1786,10 @@
diag::err_shufflevector_nonconstant_argument)
<< TheCall->getArg(i)->getSourceRange());
+ // Allow -1 which will be translated to undef in the IR.
+ if (Result.isSigned() && Result.isAllOnesValue())
+ continue;
+
if (Result.getActiveBits() > 64 || Result.getZExtValue() >= numElements*2)
return ExprError(Diag(TheCall->getLocStart(),
diag::err_shufflevector_argument_too_large)