diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index aaab8ade0ae01..5423d3ca73c81 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -666,16 +666,6 @@ static bool interp__builtin_abs(InterpState &S, CodePtr OpPC, return true; } -static bool interp__builtin_knot(InterpState &S, CodePtr OpPC, - const InterpFrame *Frame, - const CallExpr *Call) { - APSInt Val = - popToAPSInt(S.Stk, *S.getContext().classify(Call->getArg(0)->getType())); - APInt Result = ~Val; - pushInteger(S, APSInt(std::move(Result), true), Call->getType()); - return true; -} - static bool interp__builtin_popcount(InterpState &S, CodePtr OpPC, const InterpFrame *Frame, const CallExpr *Call) { @@ -3659,7 +3649,8 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call, case X86::BI__builtin_ia32_knothi: case X86::BI__builtin_ia32_knotsi: case X86::BI__builtin_ia32_knotdi: - return interp__builtin_knot(S, OpPC, Frame, Call); + return interp__builtin_elementwise_int_unaryop( + S, OpPC, Call, [](const APSInt &Src) { return ~Src; }); case X86::BI__builtin_ia32_kaddqi: case X86::BI__builtin_ia32_kaddhi: