Skip to content

Commit de04a97

Browse files
address review comments
1 parent 6d298fe commit de04a97

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Backend/arm64/LegalizeMD.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,14 @@ void LegalizeMD::LegalizeIndirOffset(IR::Instr * instr, IR::IndirOpnd * indirOpn
376376
Lowerer::HoistIndirIndexOpndAsAdd(instr, indirOpnd, baseOpnd, indexOpnd, fPostRegAlloc ? SCRATCH_REG : RegNOREG);
377377
}
378378
}
379-
else if (indirOpnd->GetIndexOpnd() != NULL && offset != 0)
379+
else if (indirOpnd->GetIndexOpnd() != nullptr && offset != 0)
380380
{
381381
// Can't have both offset and index, so hoist the offset and try again.
382382
IR::Instr *addInstr = Lowerer::HoistIndirOffset(instr, indirOpnd, fPostRegAlloc ? SCRATCH_REG : RegNOREG);
383383
LegalizeMD::LegalizeInstr(addInstr, fPostRegAlloc);
384384
if (instr->m_opcode == Js::OpCode::LEA)
385385
{
386+
AssertOrFailFastMsg(indirOpnd->GetBaseOpnd() != nullptr && indirOpnd->GetBaseOpnd()->GetSize() == TySize[TyMachPtr], "Base operand of LEA must have pointer-width!");
386387
correctSize(instr, indirOpnd);
387388
}
388389
return;
@@ -408,6 +409,7 @@ void LegalizeMD::LegalizeIndirOffset(IR::Instr * instr, IR::IndirOpnd * indirOpn
408409
{
409410
// Only one opcode with this form right now
410411
Assert(instr->m_opcode == Js::OpCode::LEA);
412+
AssertOrFailFastMsg(indirOpnd->GetBaseOpnd() != nullptr && indirOpnd->GetBaseOpnd()->GetSize() == TySize[TyMachPtr], "Base operand of LEA must have pointer-width!");
411413
if (offset != 0)
412414
{
413415
// Should have already handled this case

0 commit comments

Comments
 (0)