diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index 7a95278914276..3968e33ea5d0f 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -673,10 +673,12 @@ class InterfaceKindVisitor } private: - // Force cast these types to uint64 to reduce the number of overloads of - // `__clang_Interpreter_SetValueNoAlloc`. + // Force cast these types to the uint that fits the register size. That way we + // reduce the number of overloads of `__clang_Interpreter_SetValueNoAlloc`. void HandleIntegralOrEnumType(const Type *Ty) { - TypeSourceInfo *TSI = Ctx.getTrivialTypeSourceInfo(Ctx.UnsignedLongLongTy); + uint64_t PtrBits = Ctx.getTypeSize(Ctx.VoidPtrTy); + QualType UIntTy = Ctx.getBitIntType(/*Unsigned=*/true, PtrBits); + TypeSourceInfo *TSI = Ctx.getTrivialTypeSourceInfo(UIntTy); ExprResult CastedExpr = S.BuildCStyleCastExpr(SourceLocation(), TSI, SourceLocation(), E); assert(!CastedExpr.isInvalid() && "Cannot create cstyle cast expr"); diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp index bbd854149d5f5..83e0cc6b73d9c 100644 --- a/clang/unittests/Interpreter/InterpreterTest.cpp +++ b/clang/unittests/Interpreter/InterpreterTest.cpp @@ -282,9 +282,6 @@ TEST_F(InterpreterTest, InstantiateTemplate) { EXPECT_EQ(42, fn(NewA.getPtr())); } -// This test exposes an ARM specific problem in the interpreter, see -// https://github.com/llvm/llvm-project/issues/94994. -#ifndef __arm__ TEST_F(InterpreterTest, Value) { std::vector Args = {"-fno-sized-deallocation"}; std::unique_ptr Interp = createInterpreter(Args); @@ -383,6 +380,5 @@ TEST_F(InterpreterTest, Value) { EXPECT_EQ(V9.getKind(), Value::K_PtrOrObj); EXPECT_TRUE(V9.isManuallyAlloc()); } -#endif /* ifndef __arm__ */ } // end anonymous namespace