Skip to content

Commit 010f96a

Browse files
authored
[clang][bytecode] Use existing Descriptor local in InitElem op (#160535)
Instead of going the way through `Pointer::isUnknownSizeArray()`.
1 parent 06a5834 commit 010f96a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/AST/ByteCode/Interp.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,10 +2126,10 @@ bool InitElem(InterpState &S, CodePtr OpPC, uint32_t Idx) {
21262126
const T &Value = S.Stk.pop<T>();
21272127
const Pointer &Ptr = S.Stk.peek<Pointer>();
21282128

2129-
if (Ptr.isUnknownSizeArray())
2129+
const Descriptor *Desc = Ptr.getFieldDesc();
2130+
if (Desc->isUnknownSizeArray())
21302131
return false;
21312132

2132-
const Descriptor *Desc = Ptr.getFieldDesc();
21332133
// In the unlikely event that we're initializing the first item of
21342134
// a non-array, skip the atIndex().
21352135
if (Idx == 0 && !Desc->isArray()) {
@@ -2160,10 +2160,10 @@ bool InitElemPop(InterpState &S, CodePtr OpPC, uint32_t Idx) {
21602160
const T &Value = S.Stk.pop<T>();
21612161
const Pointer &Ptr = S.Stk.pop<Pointer>();
21622162

2163-
if (Ptr.isUnknownSizeArray())
2163+
const Descriptor *Desc = Ptr.getFieldDesc();
2164+
if (Desc->isUnknownSizeArray())
21642165
return false;
21652166

2166-
const Descriptor *Desc = Ptr.getFieldDesc();
21672167
// In the unlikely event that we're initializing the first item of
21682168
// a non-array, skip the atIndex().
21692169
if (Idx == 0 && !Desc->isArray()) {

0 commit comments

Comments
 (0)