From: Matthias Braun Date: Thu, 1 Mar 2012 15:01:09 +0000 (+0100) Subject: fix backend Cond/Cmp flag optimization failing for unoptimized code X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=28defa00beefe55bd6f00c4b1375f1387fd31141;p=libfirm fix backend Cond/Cmp flag optimization failing for unoptimized code --- diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c index 0b15ad7e2..e3d86b566 100644 --- a/ir/be/ia32/ia32_transform.c +++ b/ir/be/ia32/ia32_transform.c @@ -2110,13 +2110,16 @@ static ir_node *get_flags_node(ir_node *cmp, ia32_condition_code_t *cc_out) } } - /* the middle-end tries to eliminate impossible relations, so a ptr != 0 + /* the middle-end tries to eliminate impossible relations, so a ptr <> 0 * test becomes ptr > 0. But for x86 an equal comparison is preferable to * a >0 (we can sometimes eliminate the cmp in favor of flags produced by - * a predecessor node). So add the < bit */ + * a predecessor node). So add the < bit. + * (Note that we do not want to produce <=> (which can happen for + * unoptimized code), because no x86 flag can represent that */ possible = ir_get_possible_cmp_relations(l, r); - if (((relation & ir_relation_less) && !(possible & ir_relation_greater)) - || ((relation & ir_relation_greater) && !(possible & ir_relation_less))) + if (!(relation & ir_relation_equal) && + ( ((relation & ir_relation_less) && !(possible & ir_relation_greater)) + || ((relation & ir_relation_greater) && !(possible & ir_relation_less)))) relation |= ir_relation_less_greater; overflow_possible = true;