Merge pull request #59 from Uraniumm/canary_experimental

Add nullptr check in CheckScalarConstCmp
This commit is contained in:
Radosław Gliński 2022-08-08 19:47:35 +02:00 committed by GitHub
commit 2f59487bf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -796,7 +796,10 @@ bool SimplificationPass::CheckScalarConstCmp(hir::Instr* i,
if (var_definition) {
var_definition = var_definition->GetDestDefSkipAssigns();
def_opcode = var_definition->opcode->num;
if (var_definition != NULL)
{
def_opcode = var_definition->opcode->num;
}
}
// x == 0 -> !x
if (cmpop == OPCODE_COMPARE_EQ && constant_unpacked == 0) {