Skip to content

Commit eee8075

Browse files
committed
[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.
1 parent 4ef085c commit eee8075

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,6 @@ bool ByteCodeExprGen<Emitter>::visitArrayInitializer(const Expr *Initializer) {
10221022
for (const Expr *Init : InitList->inits()) {
10231023
if (std::optional<PrimType> T = classify(Init->getType())) {
10241024
// Visit the primitive element like normal.
1025-
if (!this->emitDupPtr(Init))
1026-
return false;
10271025
if (!this->visit(Init))
10281026
return false;
10291027
if (!this->emitInitElem(*T, ElementIndex, Init))
@@ -1042,9 +1040,9 @@ bool ByteCodeExprGen<Emitter>::visitArrayInitializer(const Expr *Initializer) {
10421040

10431041
if (!visitInitializer(Init))
10441042
return false;
1045-
}
10461043
if (!this->emitPopPtr(Init))
10471044
return false;
1045+
}
10481046

10491047
++ElementIndex;
10501048
}

0 commit comments

Comments
 (0)