Author: Timm Bäder
Date: 2022-11-07T07:56:25+01:00
New Revision: 7c0a2d9cda996a04c9eb55244a0ebf57545de849

URL: 
https://github.com/llvm/llvm-project/commit/7c0a2d9cda996a04c9eb55244a0ebf57545de849
DIFF: 
https://github.com/llvm/llvm-project/commit/7c0a2d9cda996a04c9eb55244a0ebf57545de849.diff

LOG: [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.

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeExprGen.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp 
b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index a78758cf2e45..24b5160eafbc 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -234,9 +234,9 @@ bool ByteCodeExprGen<Emitter>::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:


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to