Merge pull request #59 from Uraniumm/canary_experimental
Add nullptr check in CheckScalarConstCmp
This commit is contained in:
@@ -796,8 +796,11 @@ bool SimplificationPass::CheckScalarConstCmp(hir::Instr* i,
|
|||||||
|
|
||||||
if (var_definition) {
|
if (var_definition) {
|
||||||
var_definition = var_definition->GetDestDefSkipAssigns();
|
var_definition = var_definition->GetDestDefSkipAssigns();
|
||||||
|
if (var_definition != NULL)
|
||||||
|
{
|
||||||
def_opcode = var_definition->opcode->num;
|
def_opcode = var_definition->opcode->num;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// x == 0 -> !x
|
// x == 0 -> !x
|
||||||
if (cmpop == OPCODE_COMPARE_EQ && constant_unpacked == 0) {
|
if (cmpop == OPCODE_COMPARE_EQ && constant_unpacked == 0) {
|
||||||
i->Replace(&OPCODE_IS_FALSE_info, 0);
|
i->Replace(&OPCODE_IS_FALSE_info, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user