[clang] eee8075 - [clang][Interp][NFCI] Remove an unnecessary DupPtr op
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 25 08:11:10 PST 2023
Author: Timm Bäder
Date: 2023-01-25T17:09:33+01:00
New Revision: eee8075f57f018e047b5bc8923b0284a6f62ea3e
URL: https://github.com/llvm/llvm-project/commit/eee8075f57f018e047b5bc8923b0284a6f62ea3e
DIFF: https://github.com/llvm/llvm-project/commit/eee8075f57f018e047b5bc8923b0284a6f62ea3e.diff
LOG: [clang][Interp][NFCI] Remove an unnecessary DupPtr op
When initializing a primitive array, we don't need to dup the base
pointer for every element.
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 7777392052f2..a2f0a77142ad 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -1022,8 +1022,6 @@ bool ByteCodeExprGen<Emitter>::visitArrayInitializer(const Expr *Initializer) {
for (const Expr *Init : InitList->inits()) {
if (std::optional<PrimType> T = classify(Init->getType())) {
// Visit the primitive element like normal.
- if (!this->emitDupPtr(Init))
- return false;
if (!this->visit(Init))
return false;
if (!this->emitInitElem(*T, ElementIndex, Init))
@@ -1042,9 +1040,9 @@ bool ByteCodeExprGen<Emitter>::visitArrayInitializer(const Expr *Initializer) {
if (!visitInitializer(Init))
return false;
- }
if (!this->emitPopPtr(Init))
return false;
+ }
++ElementIndex;
}
More information about the cfe-commits
mailing list