From 7c0a2d9cda996a04c9eb55244a0ebf57545de849 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Fri, 21 Oct 2022 12:26:05 +0200 Subject: [PATCH] [clang][Interp][NFC] Use StorePop for assignments with DiscardResult If we don't need the result anyway, use StorePop, instead of a Store+Pop combination. That way we save one instruction and not using the result is the common case anyway. --- clang/lib/AST/Interp/ByteCodeExprGen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index a78758c..24b5160 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -234,9 +234,9 @@ bool ByteCodeExprGen::VisitBinaryOperator(const BinaryOperator *BO) { case BO_Div: return Discard(this->emitDiv(*T, BO)); case BO_Assign: - if (!this->emitStore(*T, BO)) - return false; - return DiscardResult ? this->emitPopPtr(BO) : true; + if (DiscardResult) + return this->emitStorePop(*T, BO); + return this->emitStore(*T, BO); case BO_And: return Discard(this->emitBitAnd(*T, BO)); case BO_Or: -- 2.7.4