llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> We only need to get the bitwdith in the IntAP/IntAPS case, so avoid it in the others. --- Full diff: https://github.com/llvm/llvm-project/pull/202873.diff 1 Files Affected: - (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+5-4) ``````````diff diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index 7bb1372ff202c..08fc8252d0708 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -94,11 +94,11 @@ static bool isReadable(const Pointer &P) { static void pushInteger(InterpState &S, const APSInt &Val, QualType QT) { assert(QT->isSignedIntegerOrEnumerationType() || QT->isUnsignedIntegerOrEnumerationType()); - OptPrimType T = S.getContext().classify(QT); + OptPrimType T = *S.getContext().classify(QT); assert(T); - unsigned BitWidth = S.getASTContext().getIntWidth(QT); if (T == PT_IntAPS) { + unsigned BitWidth = S.getASTContext().getIntWidth(QT); auto Result = S.allocAP<IntegralAP<true>>(BitWidth); Result.copy(Val); S.Stk.push<IntegralAP<true>>(Result); @@ -106,6 +106,7 @@ static void pushInteger(InterpState &S, const APSInt &Val, QualType QT) { } if (T == PT_IntAP) { + unsigned BitWidth = S.getASTContext().getIntWidth(QT); auto Result = S.allocAP<IntegralAP<false>>(BitWidth); Result.copy(Val); S.Stk.push<IntegralAP<false>>(Result); @@ -114,11 +115,11 @@ static void pushInteger(InterpState &S, const APSInt &Val, QualType QT) { if (QT->isSignedIntegerOrEnumerationType()) { int64_t V = Val.getSExtValue(); - INT_TYPE_SWITCH(*T, { S.Stk.push<T>(T::from(V, BitWidth)); }); + INT_TYPE_SWITCH(*T, { S.Stk.push<T>(T::from(V)); }); } else { assert(QT->isUnsignedIntegerOrEnumerationType()); uint64_t V = Val.getZExtValue(); - INT_TYPE_SWITCH(*T, { S.Stk.push<T>(T::from(V, BitWidth)); }); + INT_TYPE_SWITCH(*T, { S.Stk.push<T>(T::from(V)); }); } } `````````` </details> https://github.com/llvm/llvm-project/pull/202873 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
