https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/237106

The additional indirection through InterpretReflectionBuiltin adds nothing 
other than more complexity and a function call that returns `false` for 
basically ALL cases.

Remove the call to InterpretReflectionBuiltin and just add the reflection 
builtin to the existing switch. If this file gets to big, we can still move the 
individual reflection functions in a different file.

>From f0e70e41c8a72d0fca9ad2bcf4b1e23849179c36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Fri, 30 Oct 2026 06:42:43 +0100
Subject: [PATCH] [clang][bytecode][NFC] Remove reflection indirection in
 builtins

The additional indirection through InterpretReflectionBuiltin adds
nothing other than more complexity and a function call that returns
`false` for basically ALL cases.

Remove the call to InterpretReflectionBuiltin and just add the
reflection builtin to the existing switch. If this file gets to big, we
can still move the individual reflection functions in a different file.
---
 clang/lib/AST/ByteCode/InterpBuiltin.cpp | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp 
b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 8fefaa97c9f63..51ea5469f2af6 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -4780,22 +4780,8 @@ static bool interp__builtin_meta_is_type(InterpState &S, 
CodePtr OpPC,
   return true;
 }
 
-static bool InterpretReflectionBuiltin(InterpState &S, CodePtr OpPC,
-                                       const CallExpr *Call,
-                                       uint32_t BuiltinID) {
-  switch (BuiltinID) {
-  case Builtin::BI__builtin_meta_is_type:
-    return interp__builtin_meta_is_type(S, OpPC, Call);
-  default:
-    llvm_unreachable("unknown metafunction builtin");
-  }
-}
-
 bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
                       uint32_t BuiltinID) {
-  if (S.getASTContext().BuiltinInfo.isReflectionMetafunctionBuiltin(BuiltinID))
-    return InterpretReflectionBuiltin(S, OpPC, Call, BuiltinID);
-
   const InterpFrame *Frame = S.Current;
   switch (BuiltinID) {
   case Builtin::BI__builtin_is_constant_evaluated:
@@ -6951,6 +6937,10 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, 
const CallExpr *Call,
   case X86::BI__builtin_ia32_cvttpd2dq256:
   case X86::BI__builtin_ia32_cvttps2dq256:
     return interp_builtin_ia32_cvt_vector_to_int(S, OpPC, Call);
+
+  case Builtin::BI__builtin_meta_is_type:
+    return interp__builtin_meta_is_type(S, OpPC, Call);
+
   default:
     return Invalid(S, OpPC);
   }

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to