diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-04-28 13:11:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-28 13:11:15 +0200 |
commit | e086d7b1464ad091ae849cb907f8647c8439cb66 (patch) | |
tree | 1ff24f88f052792a09eef3dd62a173a6f56c2ef6 /clang/lib/AST/ByteCode/Interp.cpp | |
parent | 73d90ec8257488deaf6cc9b00dc778b109d5dfc0 (diff) | |
download | llvm-e086d7b1464ad091ae849cb907f8647c8439cb66.zip llvm-e086d7b1464ad091ae849cb907f8647c8439cb66.tar.gz llvm-e086d7b1464ad091ae849cb907f8647c8439cb66.tar.bz2 |
[clang][bytecode] Don't create function frames for builtin calls (#137607)
They don't have local variables etc. so don't create frames for them.
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Interp.cpp | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index 4f94bb5..af9b3bf 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -251,22 +251,6 @@ void cleanupAfterFunctionCall(InterpState &S, CodePtr OpPC, assert(S.Current); assert(Func); - if (Func->isUnevaluatedBuiltin()) - return; - - // Some builtin functions require us to only look at the call site, since - // the classified parameter types do not match. - if (unsigned BID = Func->getBuiltinID(); - BID && S.getASTContext().BuiltinInfo.hasCustomTypechecking(BID)) { - const auto *CE = - cast<CallExpr>(S.Current->Caller->getExpr(S.Current->getRetPC())); - for (int32_t I = CE->getNumArgs() - 1; I >= 0; --I) { - const Expr *A = CE->getArg(I); - popArg(S, A); - } - return; - } - if (S.Current->Caller && Func->isVariadic()) { // CallExpr we're look for is at the return PC of the current function, i.e. // in the caller. @@ -1630,23 +1614,8 @@ bool CallBI(InterpState &S, CodePtr OpPC, const Function *Func, if (BuiltinID == Builtin::BI__builtin_operator_new && S.checkingPotentialConstantExpression()) return false; - auto NewFrame = std::make_unique<InterpFrame>(S, Func, OpPC); - - InterpFrame *FrameBefore = S.Current; - S.Current = NewFrame.get(); - - if (InterpretBuiltin(S, OpPC, Func, CE, BuiltinID)) { - // Release ownership of NewFrame to prevent it from being deleted. - NewFrame.release(); // Frame was deleted already. - // Ensure that S.Current is correctly reset to the previous frame. - assert(S.Current == FrameBefore); - return true; - } - // Interpreting the function failed somehow. Reset to - // previous state. - S.Current = FrameBefore; - return false; + return InterpretBuiltin(S, OpPC, Func, CE, BuiltinID); } bool CallPtr(InterpState &S, CodePtr OpPC, uint32_t ArgSize, |