Commit 14f1541a authored by yb9976's avatar yb9976
Browse files

Prevent compare simplification for trivial compares.

The optimization does not work properly for relation_true and relation_false.
parent 0e5b00fb
......@@ -5400,7 +5400,8 @@ cmp_x_eq_0:
if ((relation == ir_relation_less || relation == ir_relation_greater_equal) &&
tarval_cmp(tv, get_mode_null(mode)) == ir_relation_greater) {
bitinfo const *const bl = get_bitinfo(left);
if (bl) {
if (bl && !is_relation(ir_relation_false, relation, possible)
&& !is_relation(ir_relation_true, relation, possible)) {
ir_tarval *const uneq = tarval_or(tarval_andnot(tv, bl->z), tarval_andnot(bl->o, tv));
int const hi = get_tarval_highest_bit(uneq);
if (hi >= 0) {
......@@ -5425,7 +5426,8 @@ cmp_x_eq_0:
} else if ((relation == ir_relation_greater || relation == ir_relation_less_equal) &&
tarval_cmp(tv, get_mode_null(mode)) == ir_relation_less) {
bitinfo const *const bl = get_bitinfo(left);
if (bl) {
if (bl && !is_relation(ir_relation_false, relation, possible)
&& !is_relation(ir_relation_true, relation, possible)) {
ir_tarval *const uneq = tarval_or(tarval_andnot(tv, bl->z), tarval_andnot(bl->o, tv));
int const hi = get_tarval_highest_bit(uneq);
if (hi >= 0) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment