[clang] [Clang][ExprConstant] Normalize aux target builtin IDs before dispatch (PR #201805)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 03:03:44 PDT 2026


================
@@ -4443,7 +4443,16 @@ static bool interp__builtin_ia32_gfni_mul(InterpState &S, CodePtr OpPC,
 
 bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
                       uint32_t BuiltinID) {
-  if (!S.getASTContext().BuiltinInfo.isConstantEvaluated(BuiltinID))
+  // BuiltinID has already been normalized (see getConstantEvaluatedBuiltinID),
+  // i.e. an auxiliary target builtin ID has been translated to its canonical
+  // value. The "is constant evaluated" check below needs the *raw* builtin ID
+  // so that aux-target IDs resolve into the correct (aux-target) builtin
+  // records; recover it from the call, falling back to BuiltinID for builtins
+  // emitted without a direct callee (e.g. operator new/delete).
+  unsigned RawBuiltinID = Call->getBuiltinCallee();
----------------
tbaederr wrote:

*sigh*, the entire point of passing the builtin id here is that getting it from the expr is slow. Now we do it again.

https://github.com/llvm/llvm-project/pull/201805


More information about the cfe-commits mailing list