@@ -5342,29 +5342,29 @@ ExprResult Sema::BuiltinShuffleVector(CallExpr *TheCall) {
53425342 }
53435343
53445344 for (unsigned i = 2; i < TheCall->getNumArgs(); i++) {
5345- if ( TheCall->getArg(i)->isTypeDependent() ||
5346- TheCall->getArg(i) ->isValueDependent())
5345+ Expr *Arg = TheCall->getArg(i);
5346+ if (Arg->isTypeDependent() || Arg ->isValueDependent())
53475347 continue;
53485348
53495349 std::optional<llvm::APSInt> Result;
5350- if (!(Result = TheCall->getArg(i) ->getIntegerConstantExpr(Context)))
5350+ if (!(Result = Arg ->getIntegerConstantExpr(Context)))
53515351 return ExprError(Diag(TheCall->getBeginLoc(),
53525352 diag::err_shufflevector_nonconstant_argument)
5353- << TheCall->getArg(i) ->getSourceRange());
5353+ << Arg ->getSourceRange());
53545354
53555355 // Allow -1 which will be translated to undef in the IR.
53565356 if (Result->isSigned() && Result->isAllOnes())
5357- continue;
5358-
5359- if (Result->getActiveBits() > 64 ||
5360- Result->getZExtValue() >= numElements * 2)
5357+ ;
5358+ else if (Result->getActiveBits() > 64 ||
5359+ Result->getZExtValue() >= numElements * 2)
53615360 return ExprError(Diag(TheCall->getBeginLoc(),
53625361 diag::err_shufflevector_argument_too_large)
5363- << TheCall->getArg(i)->getSourceRange());
5364- }
5362+ << Arg->getSourceRange());
53655363
5366- SmallVector<Expr*, 32> exprs;
5364+ TheCall->setArg(i, ConstantExpr::Create(Context, Arg, APValue(*Result)));
5365+ }
53675366
5367+ SmallVector<Expr *> exprs;
53685368 for (unsigned i = 0, e = TheCall->getNumArgs(); i != e; i++) {
53695369 exprs.push_back(TheCall->getArg(i));
53705370 TheCall->setArg(i, nullptr);
0 commit comments