Author: Timm Bäder
Date: 2024-02-10T18:01:30+01:00
New Revision: b4c6ab600f2ef6f3a842afee569dcf86bce7a43a

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

LOG: [clang][Interp][NFC] Don't use visitLocalInitializer in visitExpr

We were unnecessarily getting the pointer of the local variable twice.

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 aaa8ac834cf9fe..6993d751fe58f0 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -2555,10 +2555,13 @@ bool ByteCodeExprGen<Emitter>::visitExpr(const Expr *E) 
{
   // For us, that means everything we don't
   // have a PrimType for.
   if (std::optional<unsigned> LocalOffset = this->allocateLocal(E)) {
-    if (!this->visitLocalInitializer(E, *LocalOffset))
+    if (!this->emitGetPtrLocal(*LocalOffset, E))
       return false;
 
-    if (!this->emitGetPtrLocal(*LocalOffset, E))
+    if (!visitInitializer(E))
+      return false;
+
+    if (!this->emitInitPtr(E))
       return false;
     return this->emitRetValue(E);
   }


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

Reply via email to