Skip to content

Commit 8328f8d

Browse files
hliao2igcbot
authored andcommitted
Check operand before computing the right bound.
Ensure the operand is valid before computing its right bound.
1 parent 9378bc3 commit 8328f8d

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

visa/G4_IR.hpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4229,16 +4229,18 @@ class G4_SpillIntrinsic : public G4_InstIntrinsic
42294229

42304230
void computeRightBound(G4_Operand* opnd)
42314231
{
4232-
uint16_t numReg = 0;
4233-
if (opnd == getSrc(1))
4234-
{
4235-
numReg = asSpillIntrinsic()->getNumRows();
4236-
}
4237-
else if (opnd->isSrcRegRegion() && opnd == getSrc(0))
4238-
{
4239-
numReg = 1;
4232+
if (opnd) {
4233+
uint16_t numReg = 0;
4234+
if (opnd == getSrc(1))
4235+
{
4236+
numReg = asSpillIntrinsic()->getNumRows();
4237+
}
4238+
else if (opnd->isSrcRegRegion() && opnd == getSrc(0))
4239+
{
4240+
numReg = 1;
4241+
}
4242+
computeSpillFillOperandBound(opnd, opnd->left_bound, numReg);
42404243
}
4241-
computeSpillFillOperandBound(opnd, opnd->left_bound, numReg);
42424244
}
42434245

42444246
private:
@@ -4303,17 +4305,16 @@ class G4_FillIntrinsic : public G4_InstIntrinsic
43034305

43044306
void computeRightBound(G4_Operand* opnd)
43054307
{
4306-
uint16_t numReg = 0;
4307-
if (opnd == getDst())
4308-
{
4309-
numReg = asFillIntrinsic()->getNumRows();
4310-
}
4311-
else if (opnd->isSrcRegRegion() &&
4312-
(opnd == getSrc(0) || opnd == getSrc(1)))
4313-
{
4314-
numReg = 1;
4308+
if (opnd) {
4309+
uint16_t numReg = 0;
4310+
if (opnd == getDst()) {
4311+
numReg = asFillIntrinsic()->getNumRows();
4312+
} else if (opnd->isSrcRegRegion() &&
4313+
(opnd == getSrc(0) || opnd == getSrc(1))) {
4314+
numReg = 1;
4315+
}
4316+
computeSpillFillOperandBound(opnd, opnd->left_bound, numReg);
43154317
}
4316-
computeSpillFillOperandBound(opnd, opnd->left_bound, numReg);
43174318
}
43184319

43194320
private:

0 commit comments

Comments
 (0)