Skip to content

Commit 6f50bc2

Browse files
kychendevigcbot
authored andcommitted
Fix a bug in AVS translation.
Updated code to avoid potential null ptr deference.
1 parent 868b4ff commit 6f50bc2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

visa/VisaToG4/TranslateSendMedia.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,9 +1017,10 @@ int IR_Builder::translateVISAAvsInst(
10171017
unsigned int upper_bits = 0;
10181018
upper_bits += execMode << 25;
10191019

1020-
if (eifbypass->isImm())
1020+
if (!eifbypass || eifbypass->isImm())
10211021
{
1022-
upper_bits += (eifbypass->asImm()->getInt() & 1) << 27;
1022+
int64_t eifbypassVal = (eifbypass != NULL) ? eifbypass->asImm()->getInt() : 0;
1023+
upper_bits += (eifbypassVal & 1) << 27;
10231024

10241025
G4_DstRegRegion* dst2_opnd = createDst(dcl1_ud->getRegVar(), 0, 7, 1, Type_UD);
10251026
createBinOp(G4_add, g4::SIMD1, dst2_opnd, groupIDOpnd,

0 commit comments

Comments
 (0)