Skip to content

Commit 2c67a38

Browse files
committed
Address feedback from code review
* Use tmp variable to hold the inedx of the byte to avoid duplication and help with clang-format
1 parent b646720 commit 2c67a38

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,21 +3566,17 @@ static bool interp__builtin_ia32_multishiftqb(InterpState &S, CodePtr OpPC,
35663566
}
35673567

35683568
for (unsigned ByteIdx = 0; ByteIdx != NumBytesInQWord; ++ByteIdx) {
3569+
unsigned Idx = QWordId * NumBytesInQWord + ByteIdx;
35693570
uint64_t Ctrl = 0;
3570-
INT_TYPE_SWITCH(ElemT, {
3571-
Ctrl = static_cast<uint64_t>(
3572-
APtr.elem<T>(QWordId * NumBytesInQWord + ByteIdx)) &
3573-
0x3F;
3574-
});
3571+
INT_TYPE_SWITCH(
3572+
ElemT, { Ctrl = static_cast<uint64_t>(APtr.elem<T>(Idx)) & 0x3F; });
35753573

35763574
APInt Byte(8, 0);
35773575
for (unsigned BitIdx = 0; BitIdx != NumBitsInByte; ++BitIdx) {
35783576
Byte.setBitVal(BitIdx, BQWord[(Ctrl + BitIdx) & 0x3F]);
35793577
}
3580-
INT_TYPE_SWITCH(ElemT, {
3581-
Dst.elem<T>(QWordId * NumBytesInQWord + ByteIdx) =
3582-
T::from(Byte.getZExtValue());
3583-
});
3578+
INT_TYPE_SWITCH(ElemT,
3579+
{ Dst.elem<T>(Idx) = T::from(Byte.getZExtValue()); });
35843580
}
35853581
}
35863582

clang/lib/AST/ExprConstant.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13122,10 +13122,8 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr *E) {
1312213122
}
1312313123

1312413124
for (unsigned ByteIdx = 0; ByteIdx != NumBytesInQWord; ++ByteIdx) {
13125-
uint64_t Ctrl = A.getVectorElt(QWordId * NumBytesInQWord + ByteIdx)
13126-
.getInt()
13127-
.getZExtValue() &
13128-
0x3F;
13125+
unsigned Idx = QWordId * NumBytesInQWord + ByteIdx;
13126+
uint64_t Ctrl = A.getVectorElt(Idx).getInt().getZExtValue() & 0x3F;
1312913127

1313013128
APInt Byte(8, 0);
1313113129
for (unsigned BitIdx = 0; BitIdx != NumBitsInByte; ++BitIdx) {

0 commit comments

Comments
 (0)