Fix SCCP support for IF with integer and floating point condition

This commit is contained in:
Dmitry Stogov 2022-09-12 14:53:33 +03:00
parent dee45adc8c
commit a998590dfb

View File

@ -142,6 +142,12 @@ static bool ir_sccp_is_true(ir_ctx *ctx, ir_insn *_values, ir_ref a)
if (v->type == IR_BOOL) {
return v->val.b;
} else if (IR_IS_TYPE_INT(v->type)) {
return v->val.i64 != 0;
} else if (v->type == IR_DOUBLE) {
return v->val.d != 0.0;
} else if (v->type == IR_FLOAT) {
return v->val.f != 0.0;
}
IR_ASSERT(0 && "NYI");
return 0;