Skip to content

Commit 503acc9

Browse files
committed
Edits
1 parent dddffbf commit 503acc9

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,46 +2822,43 @@ static bool interp__builtin_elementwise_fsh(InterpState &S, CodePtr OpPC,
28222822
unsigned BuiltinID) {
28232823
assert(Call->getNumArgs() == 3);
28242824

2825-
const QualType &Arg1Type = Call->getArg(0)->getType();
2826-
const QualType &Arg2Type = Call->getArg(1)->getType();
2827-
const QualType &Arg3Type = Call->getArg(2)->getType();
2825+
const QualType Arg0Type = Call->getArg(0)->getType();
2826+
const QualType Arg1Type = Call->getArg(1)->getType();
2827+
const QualType Arg2Type = Call->getArg(2)->getType();
28282828

28292829
// Non-vector integer types.
2830-
if (!Arg1Type->isVectorType()) {
2830+
if (!Arg0Type->isVectorType()) {
2831+
assert(!Arg1Type->isVectorType());
28312832
assert(!Arg2Type->isVectorType());
2832-
assert(!Arg3Type->isVectorType());
2833-
const APSInt &Shift = popToAPSInt(
2834-
S.Stk, *S.getContext().classify(Call->getArg(2)->getType()));
2835-
const APSInt &Lo = popToAPSInt(
2836-
S.Stk, *S.getContext().classify(Call->getArg(1)->getType()));
2837-
const APSInt &Hi = popToAPSInt(
2838-
S.Stk, *S.getContext().classify(Call->getArg(0)->getType()));
2833+
const APSInt &Shift =
2834+
popToAPSInt(S.Stk, *S.getContext().classify(Arg2Type));
2835+
const APSInt &Lo = popToAPSInt(S.Stk, *S.getContext().classify(Arg1Type));
2836+
const APSInt &Hi = popToAPSInt(S.Stk, *S.getContext().classify(Arg0Type));
28392837
APSInt Result;
2840-
if (BuiltinID == Builtin::BI__builtin_elementwise_fshl) {
2838+
if (BuiltinID == Builtin::BI__builtin_elementwise_fshl)
28412839
Result = APSInt(llvm::APIntOps::fshl(Hi, Lo, Shift), Hi.isUnsigned());
2842-
} else if (BuiltinID == Builtin::BI__builtin_elementwise_fshr) {
2840+
else if (BuiltinID == Builtin::BI__builtin_elementwise_fshr)
28432841
Result = APSInt(llvm::APIntOps::fshr(Hi, Lo, Shift), Hi.isUnsigned());
2844-
} else {
2842+
else
28452843
llvm_unreachable("Wrong builtin ID");
2846-
}
28472844
pushInteger(S, Result, Call->getType());
28482845
return true;
28492846
}
28502847

28512848
// Vector type.
2852-
assert(Arg1Type->isVectorType() && Arg2Type->isVectorType() &&
2853-
Arg3Type->isVectorType());
2849+
assert(Arg0Type->isVectorType() && Arg1Type->isVectorType() &&
2850+
Arg2Type->isVectorType());
28542851

2855-
const VectorType *VecT = Arg1Type->castAs<VectorType>();
2852+
const auto *VecT = Arg0Type->castAs<VectorType>();
28562853
const PrimType &ElemT = *S.getContext().classify(VecT->getElementType());
28572854
unsigned NumElems = VecT->getNumElements();
28582855

28592856
assert(VecT->getElementType() ==
2860-
Arg2Type->castAs<VectorType>()->getElementType() &&
2857+
Arg1Type->castAs<VectorType>()->getElementType() &&
28612858
VecT->getElementType() ==
2862-
Arg3Type->castAs<VectorType>()->getElementType());
2863-
assert(NumElems == Arg2Type->castAs<VectorType>()->getNumElements() &&
2864-
NumElems == Arg3Type->castAs<VectorType>()->getNumElements());
2859+
Arg2Type->castAs<VectorType>()->getElementType());
2860+
assert(NumElems == Arg1Type->castAs<VectorType>()->getNumElements() &&
2861+
NumElems == Arg2Type->castAs<VectorType>()->getNumElements());
28652862
assert(VecT->getElementType()->isIntegralOrEnumerationType());
28662863

28672864
const Pointer &VecShift = S.Stk.pop<Pointer>();

clang/lib/AST/ExprConstant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11950,7 +11950,7 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1195011950
!EvaluateAsRValue(Info, E->getArg(2), SourceShift))
1195111951
return false;
1195211952

11953-
const QualType &DestEltTy =
11953+
const QualType DestEltTy =
1195411954
E->getType()->castAs<VectorType>()->getElementType();
1195511955

1195611956
if (!DestEltTy->isIntegerType())

0 commit comments

Comments
 (0)